Browse Source

Fix SPI beginTransaction race condition (thanks to Andrew Knoll)

http://forum.pjrc.com/threads/26776-Teensyduino-1-20-Released?p=56316&viewfull=1#post56316
main
PaulStoffregen 10 years ago
parent
commit
1708ef0d34
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      SPI.h

+ 4
- 1
SPI.h View File

@@ -176,8 +176,9 @@ public:
} else
#endif
{
interruptSave = SREG;
uint8_t tmp = SREG;
cli();
interruptSave = tmp;
}
}
#ifdef SPI_TRANSACTION_MISMATCH_LED
@@ -426,6 +427,7 @@ public:
// and configure the correct settings.
inline static void beginTransaction(SPISettings settings) {
if (interruptMasksUsed) {
__disable_irq();
if (interruptMasksUsed & 0x01) {
interruptSave[0] = NVIC_ICER0 & interruptMask[0];
NVIC_ICER0 = interruptSave[0];
@@ -448,6 +450,7 @@ public:
NVIC_ICER3 = interruptSave[3];
}
#endif
__enable_irq();
}
#ifdef SPI_TRANSACTION_MISMATCH_LED
if (inTransactionFlag) {

Loading…
Cancel
Save