From d3aa3852d36afe0ad4e46d0a4524cc13957175fc Mon Sep 17 00:00:00 2001 From: Frederic Pillon Date: Fri, 27 Jan 2023 17:02:38 +0100 Subject: [PATCH] chore: allow some redefinitions Fixes #10 Signed-off-by: Frederic Pillon --- src/BSP/radio_conf.h | 28 ++++++++++++++----- .../LoRaWAN/Mac/Region/RegionEU868.h | 16 ++++++++--- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/BSP/radio_conf.h b/src/BSP/radio_conf.h index e6430ec..a02f98c 100644 --- a/src/BSP/radio_conf.h +++ b/src/BSP/radio_conf.h @@ -50,7 +50,9 @@ * @brief drive value used anytime radio is NOT in TX low power mode * @note override the default configuration of radio_driver.c */ -#define SMPS_DRIVE_SETTING_DEFAULT SMPS_DRV_40 +#ifndef SMPS_DRIVE_SETTING_DEFAULT + #define SMPS_DRIVE_SETTING_DEFAULT SMPS_DRV_40 +#endif /** * @brief drive value used anytime radio is in TX low power mode @@ -58,32 +60,42 @@ * while in high power mode, current is sunk directly from the battery * @note override the default configuration of radio_driver.c */ -#define SMPS_DRIVE_SETTING_MAX SMPS_DRV_60 +#ifndef SMPS_DRIVE_SETTING_MAX + #define SMPS_DRIVE_SETTING_MAX SMPS_DRV_60 +#endif /** * @brief Provides the frequency of the chip running on the radio and the frequency step * @remark These defines are used for computing the frequency divider to set the RF frequency * @note override the default configuration of radio_driver.c */ -#define XTAL_FREQ ( 32000000UL ) +#ifndef XTAL_FREQ + #define XTAL_FREQ ( 32000000UL ) +#endif /** * @brief in XO mode, set internal capacitor (from 0x00 to 0x2F starting 11.2pF with 0.47pF steps) * @note override the default configuration of radio_driver.c */ -#define XTAL_DEFAULT_CAP_VALUE ( 0x20UL ) +#ifndef XTAL_DEFAULT_CAP_VALUE + #define XTAL_DEFAULT_CAP_VALUE ( 0x20UL ) +#endif /* XTAL_DEFAULT_CAP_VALUE */ /** * @brief voltage of vdd tcxo. * @note override the default configuration of radio_driver.c */ -#define TCXO_CTRL_VOLTAGE TCXO_CTRL_1_7V +#ifndef TCXO_CTRL_VOLTAGE + #define TCXO_CTRL_VOLTAGE TCXO_CTRL_1_7V +#endif /** * @brief Radio maximum wakeup time (in ms) * @note override the default configuration of radio_driver.c */ -#define RF_WAKEUP_TIME ( 1UL ) +#ifndef RF_WAKEUP_TIME + #define RF_WAKEUP_TIME ( 1UL ) +#endif /** * @brief DCDC is enabled @@ -91,7 +103,9 @@ * (as indicated by RBI_IsDCDC()) * @note override the default configuration of radio_driver.c */ -#define DCDC_ENABLE ( 1UL ) +#ifndef DCDC_ENABLE + #define DCDC_ENABLE ( 1UL ) +#endif /** * @brief disable the Sigfox radio modulation diff --git a/src/STM32CubeWL/LoRaWAN/Mac/Region/RegionEU868.h b/src/STM32CubeWL/LoRaWAN/Mac/Region/RegionEU868.h index 975a2d0..db8ddc6 100644 --- a/src/STM32CubeWL/LoRaWAN/Mac/Region/RegionEU868.h +++ b/src/STM32CubeWL/LoRaWAN/Mac/Region/RegionEU868.h @@ -77,7 +77,9 @@ extern "C" /*! * Maximal datarate that can be used by the node */ -#define EU868_TX_MAX_DATARATE DR_7 +#ifndef EU868_TX_MAX_DATARATE + #define EU868_TX_MAX_DATARATE DR_7 +#endif /*! * Minimal datarate that can be used by the node @@ -87,12 +89,16 @@ extern "C" /*! * Maximal datarate that can be used by the node */ -#define EU868_RX_MAX_DATARATE DR_7 +#ifndef EU868_RX_MAX_DATARATE + #define EU868_RX_MAX_DATARATE DR_7 +#endif /*! * Default datarate used by the node */ -#define EU868_DEFAULT_DATARATE DR_0 +#ifndef EU868_DEFAULT_DATARATE + #define EU868_DEFAULT_DATARATE DR_0 +#endif /*! * Minimal Rx1 receive datarate offset @@ -127,7 +133,9 @@ extern "C" /*! * Default antenna gain */ -#define EU868_DEFAULT_ANTENNA_GAIN 2.15f +#ifndef EU868_DEFAULT_ANTENNA_GAIN + #define EU868_DEFAULT_ANTENNA_GAIN 2.15f +#endif /*! * Enabled or disabled the duty cycle