File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -157,16 +157,24 @@ uint32_t Sd2Card::cardSize(void) {
157
157
}
158
158
}
159
159
// ------------------------------------------------------------------------------
160
+ static uint8_t chip_select_asserted = 0 ;
161
+
160
162
void Sd2Card::chipSelectHigh (void ) {
161
163
digitalWrite (chipSelectPin_, HIGH);
162
164
#ifdef USE_SPI_LIB
163
- SPI.endTransaction ();
165
+ if (chip_select_asserted) {
166
+ chip_select_asserted = 0 ;
167
+ SPI.endTransaction ();
168
+ }
164
169
#endif
165
170
}
166
171
// ------------------------------------------------------------------------------
167
172
void Sd2Card::chipSelectLow (void ) {
168
173
#ifdef USE_SPI_LIB
169
- SPI.beginTransaction (settings);
174
+ if (!chip_select_asserted) {
175
+ chip_select_asserted = 1 ;
176
+ SPI.beginTransaction (settings);
177
+ }
170
178
#endif
171
179
digitalWrite (chipSelectPin_, LOW);
172
180
}
You can’t perform that action at this time.
0 commit comments