mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-30 17:01:19 +01:00
drivers/at86rf2xx: improve precondition checks on state transition
The rational behind this change is the following: If the transceiver is in any *_BUSY state when `at86rf2xx_set_state()` gets called this would bypass the `(state == old_state)` check and unneeded state transitions could be triggered.
This commit is contained in:
parent
9fc75c14bb
commit
4ebbda844c
@ -429,9 +429,6 @@ void at86rf2xx_set_state(at86rf2xx_t *dev, uint8_t state)
|
||||
{
|
||||
uint8_t old_state = at86rf2xx_get_status(dev);
|
||||
|
||||
if (state == old_state) {
|
||||
return;
|
||||
}
|
||||
/* make sure there is no ongoing transmission, or state transition already
|
||||
* in progress */
|
||||
while (old_state == AT86RF2XX_STATE_BUSY_RX_AACK ||
|
||||
@ -440,6 +437,10 @@ void at86rf2xx_set_state(at86rf2xx_t *dev, uint8_t state)
|
||||
old_state = at86rf2xx_get_status(dev);
|
||||
}
|
||||
|
||||
if (state == old_state) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* we need to go via PLL_ON if we are moving between RX_AACK_ON <-> TX_ARET_ON */
|
||||
if ((old_state == AT86RF2XX_STATE_RX_AACK_ON &&
|
||||
state == AT86RF2XX_STATE_TX_ARET_ON) ||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user