diff --git a/pkg/semtech-loramac/contrib/semtech_loramac.c b/pkg/semtech-loramac/contrib/semtech_loramac.c index 13b07ee4bb..39f406b0cb 100644 --- a/pkg/semtech-loramac/contrib/semtech_loramac.c +++ b/pkg/semtech-loramac/contrib/semtech_loramac.c @@ -29,6 +29,7 @@ #include "msg.h" #include "mutex.h" +#include "kernel_defines.h" #include "net/netdev.h" #include "net/netdev/lora.h" diff --git a/sys/include/net/loramac.h b/sys/include/net/loramac.h index 1be588c814..6114ef00ee 100644 --- a/sys/include/net/loramac.h +++ b/sys/include/net/loramac.h @@ -125,12 +125,35 @@ extern "C" { #define CONFIG_LORAMAC_DEFAULT_NETID (1U) #endif +/** + * @brief Toggle network type (public or private) + * + * Set "1" to enable private network, set "0" to enable public network. + * This configuration sets the sync word for LoRaWAN communication. This should + * be in concordance with the gateway configuration. Public networks use `0x34` + * while private networks use `0x12` as sync word. + */ +#ifdef DOXYGEN +#define CONFIG_LORAMAC_DEFAULT_PRIVATE_NETWORK +#endif + /** * @brief Default network type (public or private) + * + * This configuration sets the sync word for LoRaWAN communication. This should + * be in concordance with the gateway configuration. Public networks use `0x34` + * while private networks use `0x12` as sync word. + * @deprecated Use inverse @ref CONFIG_LORAMAC_DEFAULT_PRIVATE_NETWORK instead. + * Will be removed after 2021.04 release. */ #ifndef LORAMAC_DEFAULT_PUBLIC_NETWORK -#define LORAMAC_DEFAULT_PUBLIC_NETWORK (true) +#if IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_PRIVATE_NETWORK) +#define LORAMAC_DEFAULT_PUBLIC_NETWORK (false) +#else +#define LORAMAC_DEFAULT_PUBLIC_NETWORK (true) #endif +#endif + /** * @brief Default datarate */ diff --git a/sys/net/gnrc/link_layer/lorawan/gnrc_lorawan.c b/sys/net/gnrc/link_layer/lorawan/gnrc_lorawan.c index 03e6e3c3cf..bf7701a903 100644 --- a/sys/net/gnrc/link_layer/lorawan/gnrc_lorawan.c +++ b/sys/net/gnrc/link_layer/lorawan/gnrc_lorawan.c @@ -17,11 +17,13 @@ #include #include #include + +#include "errno.h" +#include "kernel_defines.h" + #include "net/lora.h" #include "net/gnrc/lorawan.h" -#include "errno.h" #include "net/gnrc/pktbuf.h" - #include "net/lorawan/hdr.h" #include "net/loramac.h" #include "net/gnrc/lorawan/region.h"