From a161476041cef07ffc2025fbbc66312f2a89e411 Mon Sep 17 00:00:00 2001 From: Akshai M Date: Tue, 8 Sep 2020 19:16:03 +0530 Subject: [PATCH] net/lora : Move 'LORA_CR_DEFAULT' to 'CONFIG_' Added choices and moved 'LORA_CR_DEFAULT' to 'CONFIG_' namespace --- drivers/sx127x/sx127x.c | 2 +- sys/include/net/lora.h | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/sx127x/sx127x.c b/drivers/sx127x/sx127x.c index 29a2767215..0c2b7f0757 100644 --- a/drivers/sx127x/sx127x.c +++ b/drivers/sx127x/sx127x.c @@ -173,7 +173,7 @@ void sx127x_init_radio_settings(sx127x_t *dev) sx127x_set_tx_power(dev, SX127X_RADIO_TX_POWER); sx127x_set_bandwidth(dev, CONFIG_LORA_BW_DEFAULT); sx127x_set_spreading_factor(dev, CONFIG_LORA_SF_DEFAULT); - sx127x_set_coding_rate(dev, LORA_CR_DEFAULT); + sx127x_set_coding_rate(dev, CONFIG_LORA_CR_DEFAULT); sx127x_set_crc(dev, LORA_PAYLOAD_CRC_ON_DEFAULT); sx127x_set_freq_hop(dev, LORA_FREQUENCY_HOPPING_DEFAULT); sx127x_set_hop_period(dev, LORA_FREQUENCY_HOPPING_PERIOD_DEFAULT); diff --git a/sys/include/net/lora.h b/sys/include/net/lora.h index 4d4e8fd3de..63bcb281ce 100644 --- a/sys/include/net/lora.h +++ b/sys/include/net/lora.h @@ -84,9 +84,19 @@ extern "C" { #define CONFIG_LORA_SF_DEFAULT (LORA_SF12) #endif +#if IS_ACTIVE(CONFIG_LORA_CR_DEFAULT_CR_4_5) +#define CONFIG_LORA_CR_DEFAULT (LORA_CR_4_5) +#elif IS_ACTIVE(CONFIG_LORA_CR_DEFAULT_CR_4_6) +#define CONFIG_LORA_CR_DEFAULT (LORA_CR_4_6) +#elif IS_ACTIVE(CONFIG_LORA_CR_DEFAULT_CR_4_7) +#define CONFIG_LORA_CR_DEFAULT (LORA_CR_4_7) +#elif IS_ACTIVE(CONFIG_LORA_CR_DEFAULT_CR_4_8) +#define CONFIG_LORA_CR_DEFAULT (LORA_CR_4_8) +#endif + /** @brief Set default coding rate to 8 */ -#ifndef LORA_CR_DEFAULT -#define LORA_CR_DEFAULT (LORA_CR_4_8) +#ifndef CONFIG_LORA_CR_DEFAULT +#define CONFIG_LORA_CR_DEFAULT (LORA_CR_4_8) #endif /** @brief Set fixed payload length on */