1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 04:52:59 +01:00

drivers/at86rf2xx: move TX_STARTED logic to netdev

This commit is contained in:
Jose Alamos 2022-11-28 15:53:10 +01:00
parent fc43cec430
commit 5a46bba376
No known key found for this signature in database
GPG Key ID: F483EB800EF89DD9
2 changed files with 6 additions and 5 deletions

View File

@ -265,8 +265,6 @@ size_t at86rf2xx_tx_load(at86rf2xx_t *dev, const uint8_t *data,
void at86rf2xx_tx_exec(at86rf2xx_t *dev)
{
netdev_t *netdev = &dev->netdev.netdev;
#if AT86RF2XX_HAVE_RETRIES
dev->tx_retries = -1;
#endif
@ -276,9 +274,6 @@ void at86rf2xx_tx_exec(at86rf2xx_t *dev)
/* trigger sending of pre-loaded frame */
at86rf2xx_reg_write(dev, AT86RF2XX_REG__TRX_STATE,
AT86RF2XX_TRX_STATE__TX_START);
if (netdev->event_callback) {
netdev->event_callback(netdev, NETDEV_EVENT_TX_STARTED);
}
}
bool at86rf2xx_cca(at86rf2xx_t *dev)

View File

@ -133,6 +133,9 @@ static int _send(netdev_t *netdev, const iolist_t *iolist)
/* send data out directly if pre-loading id disabled */
if (!(dev->flags & AT86RF2XX_OPT_PRELOADING)) {
at86rf2xx_tx_exec(dev);
if (netdev->event_callback) {
netdev->event_callback(netdev, NETDEV_EVENT_TX_STARTED);
}
}
/* return the number of bytes that were actually loaded into the frame
* buffer/send out */
@ -269,6 +272,9 @@ static int _set_state(at86rf2xx_t *dev, netopt_state_t state)
}
at86rf2xx_set_state(dev, AT86RF2XX_PHY_STATE_TX);
at86rf2xx_tx_exec(dev);
if (dev->netdev.netdev.event_callback) {
dev->netdev.netdev.event_callback(&dev->netdev.netdev, NETDEV_EVENT_TX_STARTED);
}
}
break;
case NETOPT_STATE_RESET: