diff --git a/drivers/rn2xx3/rn2xx3.c b/drivers/rn2xx3/rn2xx3.c index 4aaef94245..1a2fab6de6 100644 --- a/drivers/rn2xx3/rn2xx3.c +++ b/drivers/rn2xx3/rn2xx3.c @@ -252,7 +252,7 @@ int rn2xx3_mac_init(rn2xx3_t *dev) rn2xx3_mac_set_dr(dev, CONFIG_LORAMAC_DEFAULT_DR); rn2xx3_mac_set_tx_power(dev, CONFIG_LORAMAC_DEFAULT_TX_POWER); rn2xx3_mac_set_tx_port(dev, CONFIG_LORAMAC_DEFAULT_TX_PORT); - rn2xx3_mac_set_tx_mode(dev, LORAMAC_DEFAULT_TX_MODE); + rn2xx3_mac_set_tx_mode(dev, CONFIG_LORAMAC_DEFAULT_TX_MODE); rn2xx3_mac_set_adr(dev, LORAMAC_DEFAULT_ADR); rn2xx3_mac_set_retx(dev, LORAMAC_DEFAULT_RETX); rn2xx3_mac_set_linkchk_interval(dev, LORAMAC_DEFAULT_LINKCHK); diff --git a/examples/gnrc_lorawan/Makefile b/examples/gnrc_lorawan/Makefile index 81cc5cf47c..98d05a671e 100644 --- a/examples/gnrc_lorawan/Makefile +++ b/examples/gnrc_lorawan/Makefile @@ -47,7 +47,7 @@ CFLAGS += -DLORAMAC_DEFAULT_JOIN_PROCEDURE=LORAMAC_JOIN_OTAA #CFLAGS += -DCONFIG_LORAMAC_DEFAULT_DR=LORAMAC_DR_5 # Set default messages to unconfirmable -CFLAGS += -DLORAMAC_DEFAULT_TX_MODE=LORAMAC_TX_CNF +CFLAGS += -DCONFIG_LORAMAC_DEFAULT_TX_MODE=LORAMAC_TX_UNCNF include $(RIOTBASE)/Makefile.include diff --git a/pkg/semtech-loramac/contrib/semtech_loramac.c b/pkg/semtech-loramac/contrib/semtech_loramac.c index 84aba663e3..92b6b4b4b0 100644 --- a/pkg/semtech-loramac/contrib/semtech_loramac.c +++ b/pkg/semtech-loramac/contrib/semtech_loramac.c @@ -381,7 +381,7 @@ void _init_loramac(semtech_loramac_t *mac, semtech_loramac_set_public_network(mac, LORAMAC_DEFAULT_PUBLIC_NETWORK); semtech_loramac_set_class(mac, CONFIG_LORAMAC_DEFAULT_DEVICE_CLASS); semtech_loramac_set_tx_port(mac, CONFIG_LORAMAC_DEFAULT_TX_PORT); - semtech_loramac_set_tx_mode(mac, LORAMAC_DEFAULT_TX_MODE); + semtech_loramac_set_tx_mode(mac, CONFIG_LORAMAC_DEFAULT_TX_MODE); semtech_loramac_set_system_max_rx_error(mac, LORAMAC_DEFAULT_SYSTEM_MAX_RX_ERROR); semtech_loramac_set_min_rx_symbols(mac, LORAMAC_DEFAULT_MIN_RX_SYMBOLS); diff --git a/sys/include/net/loramac.h b/sys/include/net/loramac.h index 9254c7b630..b81e9dc962 100644 --- a/sys/include/net/loramac.h +++ b/sys/include/net/loramac.h @@ -246,9 +246,15 @@ extern "C" { /** * @brief Default MAC TX mode (confirmable or unconfirmable) */ - #ifndef LORAMAC_DEFAULT_TX_MODE - #define LORAMAC_DEFAULT_TX_MODE (LORAMAC_TX_CNF) - #endif +#if IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_MODE_CNF) +#define CONFIG_LORAMAC_DEFAULT_TX_MODE (LORAMAC_TX_CNF) +#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_MODE_UNCNF) +#define CONFIG_LORAMAC_DEFAULT_TX_MODE (LORAMAC_TX_UNCNF) +#endif + +#ifndef CONFIG_LORAMAC_DEFAULT_TX_MODE +#define CONFIG_LORAMAC_DEFAULT_TX_MODE (LORAMAC_TX_CNF) +#endif /** * @brief Default adaptive datarate state diff --git a/sys/net/gnrc/netif/lorawan/gnrc_netif_lorawan.c b/sys/net/gnrc/netif/lorawan/gnrc_netif_lorawan.c index c1542631fa..efe7bfdd52 100644 --- a/sys/net/gnrc/netif/lorawan/gnrc_netif_lorawan.c +++ b/sys/net/gnrc/netif/lorawan/gnrc_netif_lorawan.c @@ -183,7 +183,7 @@ static void _reset(gnrc_netif_t *netif) netif->lorawan.demod_margin = 0; netif->lorawan.num_gateways = 0; netif->lorawan.port = CONFIG_LORAMAC_DEFAULT_TX_PORT; - netif->lorawan.ack_req = LORAMAC_DEFAULT_TX_MODE == LORAMAC_TX_CNF; + netif->lorawan.ack_req = CONFIG_LORAMAC_DEFAULT_TX_MODE == LORAMAC_TX_CNF; netif->lorawan.flags = 0; } diff --git a/sys/shell/commands/sc_loramac.c b/sys/shell/commands/sc_loramac.c index 1d494f7237..72cd487f41 100644 --- a/sys/shell/commands/sc_loramac.c +++ b/sys/shell/commands/sc_loramac.c @@ -397,7 +397,7 @@ int _loramac_handler(int argc, char **argv) return 1; } - uint8_t cnf = LORAMAC_DEFAULT_TX_MODE; /* Default: confirmable */ + uint8_t cnf = CONFIG_LORAMAC_DEFAULT_TX_MODE; /* Default: confirmable */ uint8_t port = CONFIG_LORAMAC_DEFAULT_TX_PORT; /* Default: 2 */ /* handle optional parameters */ if (argc > 3) {