1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

net/lorawan : Move 'LORAMAC_DEFAULT_DR' to 'CONFIG_'

Move 'LORAMAC_DEFAULT_DR' to 'CONFIG_' and enable options for
Kconfig
This commit is contained in:
Akshai M 2020-11-20 16:31:30 +01:00
parent 1befae9022
commit 55f196095d
5 changed files with 40 additions and 6 deletions

View File

@ -249,7 +249,7 @@ int rn2xx3_sys_sleep(rn2xx3_t *dev)
int rn2xx3_mac_init(rn2xx3_t *dev)
{
rn2xx3_mac_set_dr(dev, LORAMAC_DEFAULT_DR);
rn2xx3_mac_set_dr(dev, CONFIG_LORAMAC_DEFAULT_DR);
rn2xx3_mac_set_tx_power(dev, LORAMAC_DEFAULT_TX_POWER);
rn2xx3_mac_set_tx_port(dev, LORAMAC_DEFAULT_TX_PORT);
rn2xx3_mac_set_tx_mode(dev, LORAMAC_DEFAULT_TX_MODE);

View File

@ -44,7 +44,7 @@ CFLAGS += -DLORAMAC_DEFAULT_JOIN_PROCEDURE=LORAMAC_JOIN_OTAA
# Uncomment to set the highest DR for the EU868 in order to maximize throughput.
# If uncommented, the default value (DR0) is used.
# Note this value is also used for the OTAA.
#CFLAGS += -DLORAMAC_DEFAULT_DR=LORAMAC_DR_5
#CFLAGS += -DCONFIG_LORAMAC_DEFAULT_DR=LORAMAC_DR_5
# Set default messages to unconfirmable
CFLAGS += -DLORAMAC_DEFAULT_TX_MODE=LORAMAC_TX_CNF

View File

@ -376,7 +376,7 @@ void _init_loramac(semtech_loramac_t *mac,
#endif
mutex_unlock(&mac->lock);
semtech_loramac_set_dr(mac, LORAMAC_DEFAULT_DR);
semtech_loramac_set_dr(mac, CONFIG_LORAMAC_DEFAULT_DR);
semtech_loramac_set_adr(mac, LORAMAC_DEFAULT_ADR);
semtech_loramac_set_public_network(mac, LORAMAC_DEFAULT_PUBLIC_NETWORK);
semtech_loramac_set_class(mac, CONFIG_LORAMAC_DEFAULT_DEVICE_CLASS);

View File

@ -157,8 +157,42 @@ extern "C" {
/**
* @brief Default datarate
*/
#ifndef LORAMAC_DEFAULT_DR
#define LORAMAC_DEFAULT_DR (LORAMAC_DR_0)
#if IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_0)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_0)
#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_1)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_1)
#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_2)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_2)
#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_3)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_3)
#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_4)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_4)
#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_5)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_5)
#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_6)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_6)
#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_7)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_7)
#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_8)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_8)
#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_9)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_9)
#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_10)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_10)
#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_11)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_11)
#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_12)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_12)
#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_13)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_13)
#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_14)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_14)
#elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_15)
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_15)
#endif
#ifndef CONFIG_LORAMAC_DEFAULT_DR
#define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_0)
#endif
/**

View File

@ -179,7 +179,7 @@ static void _reset(gnrc_netif_t *netif)
{
netif->lorawan.otaa = LORAMAC_DEFAULT_JOIN_PROCEDURE ==
LORAMAC_JOIN_OTAA ? NETOPT_ENABLE : NETOPT_DISABLE;
netif->lorawan.datarate = LORAMAC_DEFAULT_DR;
netif->lorawan.datarate = CONFIG_LORAMAC_DEFAULT_DR;
netif->lorawan.demod_margin = 0;
netif->lorawan.num_gateways = 0;
netif->lorawan.port = LORAMAC_DEFAULT_TX_PORT;