Browse Source

disable interrupts during usingInterrupt() on AVR

main
PaulStoffregen 10 years ago
parent
commit
d0eca0a3f3
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      SPI.cpp

+ 4
- 3
SPI.cpp View File

@@ -97,10 +97,11 @@ void SPIClass::end() {

void SPIClass::usingInterrupt(uint8_t interruptNumber)
{
uint8_t mask;
uint8_t stmp, mask;

if (interruptMode > 1) return;

stmp = SREG;
noInterrupts();
switch (interruptNumber) {
#ifdef SPI_INT0_MASK
@@ -129,12 +130,12 @@ void SPIClass::usingInterrupt(uint8_t interruptNumber)
#endif
default:
interruptMode = 2;
interrupts();
SREG = stmp;
return;
}
interruptMode = 1;
interruptMask |= mask;
interrupts();
SREG = stmp;
}



Loading…
Cancel
Save