File tree 2 files changed +24
-0
lines changed
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)
112
112
interrupts ();
113
113
}
114
114
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
+
115
135
void SPIClass::beginTransaction (SPISettings settings)
116
136
{
117
137
if (interruptMode != SPI_IMODE_NONE)
Original file line number Diff line number Diff line change 29
29
// - SPISetting(clock, bitOrder, dataMode)
30
30
#define SPI_HAS_TRANSACTION 1
31
31
32
+ // SPI_HAS_NOTUSINGINTERRUPT means that SPI has notUsingInterrupt() method
33
+ #define SPI_HAS_NOTUSINGINTERRUPT 1
34
+
32
35
#define SPI_MODE0 0x02
33
36
#define SPI_MODE1 0x00
34
37
#define SPI_MODE2 0x03
@@ -100,6 +103,7 @@ class SPIClass {
100
103
101
104
// Transaction Functions
102
105
void usingInterrupt (int interruptNumber);
106
+ void notUsingInterrupt (int interruptNumber);
103
107
void beginTransaction (SPISettings settings);
104
108
void endTransaction (void );
105
109
You can’t perform that action at this time.
0 commit comments