mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cc110x: make use of netdev_register()
Call netdev_register() in cc110x_setup() and pass the index in auto_init_cc110x()
This commit is contained in:
parent
320b1c4206
commit
39adf908ce
@ -26,7 +26,7 @@
|
||||
#define ENABLE_DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
int cc110x_setup(cc110x_t *dev, const cc110x_params_t *params)
|
||||
int cc110x_setup(cc110x_t *dev, const cc110x_params_t *params, uint8_t index)
|
||||
{
|
||||
if (!dev || !params) {
|
||||
return -EINVAL;
|
||||
@ -40,6 +40,7 @@ int cc110x_setup(cc110x_t *dev, const cc110x_params_t *params)
|
||||
dev->params = *params;
|
||||
dev->netdev.driver = &cc110x_driver;
|
||||
dev->state = CC110X_STATE_OFF;
|
||||
netdev_register(&dev->netdev, NETDEV_CC110X, index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -558,11 +558,13 @@ typedef struct {
|
||||
*
|
||||
* @param dev Device descriptor to use
|
||||
* @param params Parameter of the device to setup
|
||||
* @param 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
|
||||
* @retval -EINVAL @p dev or @p params is `NULL`, or @p params is invalid
|
||||
*/
|
||||
int cc110x_setup(cc110x_t *dev, const cc110x_params_t *params);
|
||||
int cc110x_setup(cc110x_t *dev, const cc110x_params_t *params, uint8_t index);
|
||||
|
||||
/**
|
||||
* @brief Apply the given configuration and the given channel map and performs
|
||||
|
@ -73,7 +73,7 @@ void auto_init_cc110x(void)
|
||||
for (unsigned i = 0; i < CC110X_NUM; i++) {
|
||||
LOG_DEBUG("[auto_init_netif] initializing cc110x #%u\n", i);
|
||||
|
||||
cc110x_setup(&_cc110x_devs[i], &cc110x_params[i]);
|
||||
cc110x_setup(&_cc110x_devs[i], &cc110x_params[i], i);
|
||||
gnrc_netif_cc1xxx_create(&_netif[i], stacks[i], CC110X_MAC_STACKSIZE, CC110X_MAC_PRIO,
|
||||
"cc110x", (netdev_t *)&_cc110x_devs[i]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user