File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,26 @@ void SPIClass::usingInterrupt(int interruptNumber)
112112 interrupts ();
113113}
114114
115+ void SPIClass::notUsingInterrupt (int interruptNumber)
116+ {
117+ if ((interruptNumber == NOT_AN_INTERRUPT) || (interruptNumber == EXTERNAL_INT_NMI))
118+ return ;
119+
120+ if (interruptMode & SPI_IMODE_GLOBAL)
121+ return ; // can't go back, as there is no reference count
122+
123+ uint8_t irestore = interruptsStatus ();
124+ noInterrupts ();
125+
126+ interruptMask &= ~(1 << interruptNumber);
127+
128+ if (interruptMask == 0 )
129+ interruptMode = SPI_IMODE_NONE;
130+
131+ if (irestore)
132+ interrupts ();
133+ }
134+
115135void SPIClass::beginTransaction (SPISettings settings)
116136{
117137 if (interruptMode != SPI_IMODE_NONE)
Original file line number Diff line number Diff line change 2929// - SPISetting(clock, bitOrder, dataMode)
3030#define SPI_HAS_TRANSACTION 1
3131
32+ // SPI_HAS_NOTUSINGINTERRUPT means that SPI has notUsingInterrupt() method
33+ #define SPI_HAS_NOTUSINGINTERRUPT 1
34+
3235#define SPI_MODE0 0x02
3336#define SPI_MODE1 0x00
3437#define SPI_MODE2 0x03
@@ -100,6 +103,7 @@ class SPIClass {
100103
101104 // Transaction Functions
102105 void usingInterrupt (int interruptNumber);
106+ void notUsingInterrupt (int interruptNumber);
103107 void beginTransaction (SPISettings settings);
104108 void endTransaction (void );
105109
You can’t perform that action at this time.
0 commit comments