Skip to content

Commit

Permalink
gnrc_netif: set-up 6Lo for NRFmin
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Jan 18, 2018
1 parent 83b1110 commit 851eb76
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ ifneq (,$(filter trickle,$(USEMODULE)))
USEMODULE += xtimer
endif

ifneq (,$(filter ieee802154,$(USEMODULE)))
ifneq (,$(filter ieee802154 nrfmin,$(USEMODULE)))
ifneq (,$(filter gnrc_ipv6, $(USEMODULE)))
USEMODULE += gnrc_sixlowpan
endif
Expand Down
11 changes: 9 additions & 2 deletions cpu/nrf5x_common/radio/nrfmin/nrfmin.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#include "nrfmin.h"
#include "net/netdev.h"

#ifdef MODULE_GNRC_SIXLOWPAN
#include "net/gnrc/nettype.h"
#endif

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

Expand Down Expand Up @@ -495,9 +499,12 @@ static int nrfmin_get(netdev_t *dev, netopt_t opt, void *val, size_t max_len)
assert(max_len >= sizeof(uint16_t));
*((uint16_t*)val) = CONF_PSEUDO_NID;
return sizeof(uint16_t);
#ifdef MODULE_GNRC_SIXLOWPAN
case NETOPT_PROTO:
*((uint16_t *)val) = 809; /* TODO */
return 2;
assert(max_len >= sizeof(uint16_t));
*((uint16_t *)val) = GNRC_NETTYPE_SIXLOWPAN;
return sizeof(uint16_t);
#endif
case NETOPT_DEVICE_TYPE:
assert(max_len >= sizeof(uint16_t));
*((uint16_t *)val) = NETDEV_TYPE_NRFMIN;
Expand Down
3 changes: 2 additions & 1 deletion sys/net/gnrc/netif/gnrc_netif.c
Original file line number Diff line number Diff line change
Expand Up @@ -1157,8 +1157,9 @@ static void _init_from_device(gnrc_netif_t *netif)
assert(res == sizeof(tmp));
netif->device_type = (uint8_t)tmp;
switch (netif->device_type) {
#ifdef MODULE_NETDEV_IEEE802154
#if defined(MODULE_NETDEV_IEEE802154) || defined(MODULE_NRFMIN)
case NETDEV_TYPE_IEEE802154:
case NETDEV_TYPE_NRFMIN:
#ifdef MODULE_GNRC_SIXLOWPAN_IPHC
netif->flags |= GNRC_NETIF_FLAGS_6LO_HC;
#endif
Expand Down

0 comments on commit 851eb76

Please sign in to comment.