@@ -315,6 +315,7 @@ void Adafruit_EPD::writeSRAMFramebufferToEPD(uint16_t SRAM_buffer_addr,
315
315
uint8_t c;
316
316
// use SRAM
317
317
sram.csLow ();
318
+ _isInTransaction = true ;
318
319
// send read command
319
320
SPItransfer (MCPSRAM_READ);
320
321
// send address
@@ -340,6 +341,7 @@ void Adafruit_EPD::writeSRAMFramebufferToEPD(uint16_t SRAM_buffer_addr,
340
341
}
341
342
csHigh ();
342
343
sram.csHigh ();
344
+ _isInTransaction = false ;
343
345
}
344
346
345
347
/* *************************************************************************/
@@ -658,8 +660,10 @@ void Adafruit_EPD::csHigh() {
658
660
digitalWrite (_cs_pin, HIGH);
659
661
#endif
660
662
661
- spi_dev->endTransaction ();
662
- _isInTransaction = false ;
663
+ if (_isInTransaction) {
664
+ spi_dev->endTransaction ();
665
+ _isInTransaction = false ;
666
+ }
663
667
}
664
668
665
669
/* *************************************************************************/
@@ -668,8 +672,11 @@ void Adafruit_EPD::csHigh() {
668
672
*/
669
673
/* *************************************************************************/
670
674
void Adafruit_EPD::csLow () {
671
- spi_dev->beginTransaction ();
672
- _isInTransaction = true ;
675
+
676
+ if (!_isInTransaction) {
677
+ spi_dev->beginTransaction ();
678
+ _isInTransaction = true ;
679
+ }
673
680
674
681
#ifdef BUSIO_USE_FAST_PINIO
675
682
*csPort &= ~csPinMask;
0 commit comments