Skip to content

Commit

Permalink
auto_init/nrf52840: add support for SubMAC
Browse files Browse the repository at this point in the history
  • Loading branch information
jia200x committed Sep 30, 2020
1 parent d33651f commit e93c362
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion sys/net/gnrc/netif/init_devs/auto_init_nrf802154.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#include "nrf802154.h"
#include "net/gnrc/netif/ieee802154.h"

#include "net/ieee802154/radio.h"
#include "net/netdev/ieee802154_submac.h"

/**
* @brief Define stack parameters for the MAC layer thread
* @{
Expand All @@ -37,13 +40,27 @@
static char _stack[NRF802154_MAC_STACKSIZE];
static gnrc_netif_t _netif;

#if IS_USED(MODULE_IEEE802154_RADIO_HAL)
extern ieee802154_dev_t nrf802154_hal_dev;
static netdev_ieee802154_submac_t nrf802154_submac;
#endif

void auto_init_nrf802154(void)
{
LOG_DEBUG("[auto_init_netif] initializing nrf802154\n");

netdev_t *netdev;
#if IS_USED(MODULE_IEEE802154_RADIO_HAL)
netdev_ieee802154_submac_init(&nrf802154_submac, &nrf802154_hal_dev);
netdev = (netdev_t*) &nrf802154_submac;
nrf802154_init();
#else
netdev = (netdev_t*) &nrf802154_dev;
#endif

gnrc_netif_ieee802154_create(&_netif, _stack,
NRF802154_MAC_STACKSIZE,
NRF802154_MAC_PRIO, "nrf802154",
(netdev_t *)&nrf802154_dev);
netdev);
}
/** @} */

0 comments on commit e93c362

Please sign in to comment.