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

nrf24l01p_ng: make use of netdev_register()

This commit is contained in:
Fabian Hüßler 2020-12-01 13:44:29 +01:00
parent 063ff60890
commit 7d618afa17
3 changed files with 8 additions and 3 deletions

View File

@ -184,11 +184,14 @@ struct nrf24l01p_ng {
*
* @param[in] dev NRF24L01+ device handle
* @param[in] params Parameters of the device to setup
* @param[in] index Index of @p params in a global parameter struct array.
* If initialized manually, pass a unique identifier instead.
*
* @retval 0 Device successfully set up
*/
int nrf24l01p_ng_setup(nrf24l01p_ng_t *dev,
const nrf24l01p_ng_params_t *params);
const nrf24l01p_ng_params_t *params,
uint8_t index);
/**
* @brief Enable or disable data pipe @p pipe

View File

@ -36,7 +36,8 @@
#define NRF24L01P_NG_REG_RX_PW_PX(x) (NRF24L01P_NG_REG_RX_PW_P0 + (x))
int nrf24l01p_ng_setup(nrf24l01p_ng_t *dev,
const nrf24l01p_ng_params_t *params)
const nrf24l01p_ng_params_t *params,
uint8_t index)
{
assert(dev);
assert(params);
@ -46,6 +47,7 @@ int nrf24l01p_ng_setup(nrf24l01p_ng_t *dev,
dev->idle_state = NRF24L01P_NG_STATE_RX_MODE;
dev->params = *params;
dev->netdev.driver = &nrf24l01p_ng_driver;
netdev_register(&dev->netdev, NETDEV_NRF24L01P_NG, index);
return 0;
}

View File

@ -72,7 +72,7 @@ void auto_init_nrf24l01p_ng(void)
for (unsigned i = 0; i < NRF24L01P_NG_NUM; i++) {
LOG_DEBUG("[auto_init_netif] initializing nrf24l01p #%u\n", i);
nrf24l01p_ng_setup(&_nrf24l01p_ng_devs[i], &nrf24l01p_ng_params[i]);
nrf24l01p_ng_setup(&_nrf24l01p_ng_devs[i], &nrf24l01p_ng_params[i], i);
gnrc_netif_nrf24l01p_ng_create(&_netif[i], stacks[i],
NRF24L01P_NG_MAC_STACKSIZE,
NRF24L01P_NG_MAC_PRIO,