File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 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) {
157157 }
158158}
159159// ------------------------------------------------------------------------------
160+ static uint8_t chip_select_asserted = 0 ;
161+
160162void Sd2Card::chipSelectHigh (void ) {
161163 digitalWrite (chipSelectPin_, HIGH);
162164#ifdef USE_SPI_LIB
163- SPI.endTransaction ();
165+ if (chip_select_asserted) {
166+ chip_select_asserted = 0 ;
167+ SPI.endTransaction ();
168+ }
164169#endif
165170}
166171// ------------------------------------------------------------------------------
167172void Sd2Card::chipSelectLow (void ) {
168173#ifdef USE_SPI_LIB
169- SPI.beginTransaction (settings);
174+ if (!chip_select_asserted) {
175+ chip_select_asserted = 1 ;
176+ SPI.beginTransaction (settings);
177+ }
170178#endif
171179 digitalWrite (chipSelectPin_, LOW);
172180}
You can’t perform that action at this time.
0 commit comments