mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 12:25:20 +03:00
ELRS/SX127x - Cleanup NVIC/atomic block usage.
Since #11380 the sx127xISR will always be called from an ISR handler so no additional NVIC entry or ATOMIC_BLOCK is required. Also, since sx127xISR is always called from an ISR handler it means that there's no need to call rxSpiPollExti.
This commit is contained in:
parent
70a1b59687
commit
d43cb26b8e
1 changed files with 7 additions and 18 deletions
|
@ -76,27 +76,16 @@ static bool sx127xDetectChip(void)
|
|||
|
||||
uint8_t sx127xISR(timeUs_t *timeStamp)
|
||||
{
|
||||
bool extiTriggered = false;
|
||||
timeUs_t extiTimestamp;
|
||||
timeUs_t extiTimestamp = rxSpiGetLastExtiTimeUs();
|
||||
|
||||
ATOMIC_BLOCK(NVIC_PRIO_RX_SPI_INT_EXTI) {
|
||||
// prevent a data-race that can occur if a new EXTI ISR occurs during this block.
|
||||
extiTriggered = rxSpiPollExti();
|
||||
extiTimestamp = rxSpiGetLastExtiTimeUs();
|
||||
if (extiTriggered) {
|
||||
rxSpiResetExti();
|
||||
}
|
||||
rxSpiResetExti();
|
||||
|
||||
uint8_t irqReason = sx127xGetIrqReason();
|
||||
if (extiTimestamp) {
|
||||
*timeStamp = extiTimestamp;
|
||||
}
|
||||
|
||||
if (extiTriggered) {
|
||||
uint8_t irqReason = sx127xGetIrqReason();
|
||||
if (extiTimestamp) {
|
||||
*timeStamp = extiTimestamp;
|
||||
}
|
||||
|
||||
return irqReason;
|
||||
}
|
||||
return 0;
|
||||
return irqReason;
|
||||
}
|
||||
|
||||
bool sx127xInit(IO_t resetPin, IO_t busyPin)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue