1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #7275 from aabadie/fix_at86rf2xx_ping

drivers/at86rf2xx: fix tx prepare leading to inconsistent idle state
This commit is contained in:
Martine Lenders 2017-06-29 14:17:12 +02:00 committed by GitHub
commit adc02a962e

View File

@ -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;
}