diff --git a/examples/default/Makefile b/examples/default/Makefile index 0d524f94d606433141e5eb89a63b0fdb23ea4b64..b61bb59123ed96f4d020906805091c69e1e1ca54 100644 --- a/examples/default/Makefile +++ b/examples/default/Makefile @@ -34,6 +34,16 @@ USEMODULE += shell_commands USEMODULE += ps USEMODULE += config +# Use modules for networking +# gnrc is a meta module including all required, basic gnrc networking modules +USEMODULE += gnrc +# use the default network interface for the board +USEMODULE += gnrc_netif_default +# automatically initialize the network interface +USEMODULE += auto_init_gnrc_netif +# the application dumps received packets to stdout +USEMODULE += gnrc_pktdump + FEATURES_OPTIONAL += config FEATURES_OPTIONAL += periph_rtc diff --git a/examples/default/main.c b/examples/default/main.c index d7ffc937f3904929689c9b680725085c14604a3a..c43f9e7f5be1dac790802ab84b5a65b420973010 100644 --- a/examples/default/main.c +++ b/examples/default/main.c @@ -37,6 +37,11 @@ #include "ltc4150.h" #endif +#ifdef MODULE_NETIF +#include "net/gnrc/pktdump.h" +#include "net/gnrc.h" +#endif + int main(void) { #ifdef MODULE_LTC4150 @@ -47,6 +52,14 @@ int main(void) rtc_init(); #endif +#ifdef MODULE_NETIF + gnrc_netreg_entry_t dump; + + dump.pid = gnrc_pktdump_getpid(); + dump.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL; + gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &dump); +#endif + (void) puts("Welcome to RIOT!"); char line_buf[SHELL_DEFAULT_BUFSIZE];