瀏覽代碼

disable interrupts during usingInterrupt() on AVR

main
PaulStoffregen 10 年之前
父節點
當前提交
d0eca0a3f3
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. +4
    -3
      SPI.cpp

+ 4
- 3
SPI.cpp 查看文件

@@ -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…
取消
儲存