1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/at86rf2xx: move at86rf2xx_setup to netdev

This commit is contained in:
Jose Alamos 2022-11-28 15:54:19 +01:00
parent 5a46bba376
commit 99d490a3c1
No known key found for this signature in database
GPG Key ID: F483EB800EF89DD9
2 changed files with 26 additions and 25 deletions

View File

@ -113,31 +113,6 @@ static const ieee802154_radio_cipher_ops_t _at86rf2xx_cipher_ops = {
#endif /* IS_USED(MODULE_AT86RF2XX_AES_SPI) && \
IS_USED(MODULE_IEEE802154_SECURITY) */
void at86rf2xx_setup(at86rf2xx_t *dev, const at86rf2xx_params_t *params, uint8_t index)
{
netdev_t *netdev = &dev->netdev.netdev;
netdev->driver = &at86rf2xx_driver;
/* State to return after receiving or transmitting */
dev->idle_state = AT86RF2XX_STATE_TRX_OFF;
/* radio state is P_ON when first powered-on */
dev->state = AT86RF2XX_STATE_P_ON;
dev->pending_tx = 0;
#if AT86RF2XX_IS_PERIPH
(void) params;
/* set all interrupts off */
at86rf2xx_reg_write(dev, AT86RF2XX_REG__IRQ_MASK, 0x00);
#else
/* initialize device descriptor */
dev->params = *params;
#endif
netdev_register(netdev, NETDEV_AT86RF2XX, index);
/* set device address */
netdev_ieee802154_setup(&dev->netdev);
}
static void at86rf2xx_disable_clock_output(at86rf2xx_t *dev)
{
#if AT86RF2XX_IS_PERIPH

View File

@ -818,6 +818,32 @@ static void _isr(netdev_t *netdev)
}
}
void at86rf2xx_setup(at86rf2xx_t *dev, const at86rf2xx_params_t *params, uint8_t index)
{
netdev_t *netdev = &dev->netdev.netdev;
netdev->driver = &at86rf2xx_driver;
/* State to return after receiving or transmitting */
dev->idle_state = AT86RF2XX_STATE_TRX_OFF;
/* radio state is P_ON when first powered-on */
dev->state = AT86RF2XX_STATE_P_ON;
dev->pending_tx = 0;
#if AT86RF2XX_IS_PERIPH
(void) params;
/* set all interrupts off */
at86rf2xx_reg_write(dev, AT86RF2XX_REG__IRQ_MASK, 0x00);
#else
/* initialize device descriptor */
dev->params = *params;
#endif
netdev_register(netdev, NETDEV_AT86RF2XX, index);
/* set device address */
netdev_ieee802154_setup(&dev->netdev);
}
#if AT86RF2XX_IS_PERIPH
/**