Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion examples/openthread/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,25 @@ APPLICATION = openthread
BOARD ?= samr21-xpro

# These are the boards that OpenThread stack has been tested on
BOARD_WHITELIST := samr21-xpro iotlab-m3 fox iotlab-a8-m3 frdm-kw41z openlabs-kw41z-mini-256kib openlabs-kw41z-mini phynode-kw41z usb-kw41z
BOARD_WHITELIST := \
samr21-xpro \
iotlab-m3 \
fox \
iotlab-a8-m3 \
frdm-kw41z \
openlabs-kw41z-mini-256kib \
openlabs-kw41z-mini \
phynode-kw41z \
usb-kw41z \
cc2538dk \
remote-reva \
remote-revb \
omote \
openmote-cc2538 \
nrf52840dk \
nrf52840-mdk \
reel \
#

# This has to be the absolute path to the RIOT base directory:
RIOTBASE ?= $(CURDIR)/../..
Expand All @@ -28,6 +46,8 @@ USEMODULE += openthread-$(OPENTHREAD_TYPE)
# Comment the following line in order to disable the OpenThread CLI
USEMODULE += openthread-cli

USEMODULE += netdev_default

#Define PANID, CHANNEL and UART_BAUDRATE used by default
OPENTHREAD_PANID ?= 0xbeef
OPENTHREAD_CHANNEL ?= 26
Expand Down
5 changes: 5 additions & 0 deletions pkg/openthread/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ USEMODULE += openthread_contrib_netdev
USEMODULE += l2util
USEMODULE += xtimer
USEMODULE += event

ifneq (,$(filter cc2538_rf nrf802154,$(USEMODULE)))
USEMODULE += netdev_ieee802154_submac
endif

FEATURES_REQUIRED += cpp
24 changes: 24 additions & 0 deletions pkg/openthread/contrib/openthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
#include "kw41zrf.h"
#endif

#ifdef MODULE_CC2538_RF
#include "cc2538_rf.h"
#endif

#ifdef MODULE_NRF802154
#include "nrf802154.h"
#endif

#define ENABLE_DEBUG (0)
#include "debug.h"

Expand All @@ -45,6 +53,10 @@
#define OPENTHREAD_NETIF_NUMOF (1U)
#endif

#ifdef MODULE_CC2538_RF
static cc2538_rf_t cc2538_rf_dev;
#endif

#ifdef MODULE_AT86RF2XX
static at86rf2xx_t at86rf2xx_dev;
#endif
Expand All @@ -53,6 +65,10 @@ static at86rf2xx_t at86rf2xx_dev;
static kw41zrf_t kw41z_dev;
#endif

#ifdef MODULE_NRF802154
static nrf802154_t nrf802154_dev;
#endif

static uint8_t rx_buf[OPENTHREAD_NETDEV_BUFLEN];
static uint8_t tx_buf[OPENTHREAD_NETDEV_BUFLEN];
static char ot_thread_stack[2 * THREAD_STACKSIZE_MAIN];
Expand All @@ -71,6 +87,14 @@ void openthread_bootstrap(void)
kw41zrf_setup(&kw41z_dev);
netdev_t *netdev = (netdev_t *) &kw41z_dev;
#endif
#ifdef MODULE_CC2538_RF
cc2538_setup(&cc2538_rf_dev);
netdev_t *netdev = (netdev_t*) &cc2538_rf_dev;
#endif
#ifdef MODULE_NRF802154
nrf802154_setup(&nrf802154_dev);
netdev_t *netdev = (netdev_t*) &nrf802154_dev;
#endif

openthread_radio_init(netdev, tx_buf, rx_buf);
openthread_netdev_init(ot_thread_stack, sizeof(ot_thread_stack), THREAD_PRIORITY_MAIN - 5, "openthread", netdev);
Expand Down