Browse Source

drivers/at86rf2xx: fix tx prepare leading to inconsistent idle state

master
Alexandre Abadie 5 years ago
parent
commit
9834b1d9f9
  1. 14
      drivers/at86rf2xx/at86rf2xx.c

14
drivers/at86rf2xx/at86rf2xx.c

@ -136,9 +136,21 @@ size_t at86rf2xx_send(at86rf2xx_t *dev, uint8_t *data, size_t len)
void at86rf2xx_tx_prepare(at86rf2xx_t *dev)
{
uint8_t state;
dev->pending_tx++;
dev->idle_state = at86rf2xx_set_state(dev, AT86RF2XX_STATE_TX_ARET_ON);
/* make sure ongoing transmissions are finished */
do {
state = at86rf2xx_get_status(dev);
} while (state == AT86RF2XX_STATE_BUSY_RX_AACK ||
state == AT86RF2XX_STATE_BUSY_TX_ARET);
if (state != AT86RF2XX_STATE_TX_ARET_ON) {
dev->idle_state = state;
}
at86rf2xx_set_state(dev, AT86RF2XX_STATE_TX_ARET_ON);
dev->tx_frame_len = IEEE802154_FCS_LEN;
}

Loading…
Cancel
Save