From 8697eae52fb89c986ee4e7c09ec2b2afcc8a3b87 Mon Sep 17 00:00:00 2001 From: Miguel Luis Date: Fri, 21 May 2021 13:04:37 +0200 Subject: [PATCH] Added possibility to override LORAWAN_DEFAULT_CLASS --- src/apps/LoRaMac/CMakeLists.txt | 10 ++++++++++ .../LoRaMac/periodic-uplink-lpp/B-L072Z-LRWAN1/main.c | 2 ++ src/apps/LoRaMac/periodic-uplink-lpp/NAMote72/main.c | 2 ++ src/apps/LoRaMac/periodic-uplink-lpp/NucleoL073/main.c | 2 ++ src/apps/LoRaMac/periodic-uplink-lpp/NucleoL152/main.c | 2 ++ src/apps/LoRaMac/periodic-uplink-lpp/NucleoL476/main.c | 2 ++ src/apps/LoRaMac/periodic-uplink-lpp/SAMR34/main.c | 2 ++ src/apps/LoRaMac/periodic-uplink-lpp/SKiM880B/main.c | 2 ++ src/apps/LoRaMac/periodic-uplink-lpp/SKiM881AXL/main.c | 2 ++ src/apps/LoRaMac/periodic-uplink-lpp/SKiM980A/main.c | 2 ++ 10 files changed, 28 insertions(+) diff --git a/src/apps/LoRaMac/CMakeLists.txt b/src/apps/LoRaMac/CMakeLists.txt index 90ec0ca6a..814e307e6 100644 --- a/src/apps/LoRaMac/CMakeLists.txt +++ b/src/apps/LoRaMac/CMakeLists.txt @@ -27,6 +27,13 @@ set(SUB_PROJECT_LIST periodic-uplink-lpp fuota-test-01) set(SUB_PROJECT periodic-uplink-lpp CACHE STRING "Default sub project is periodic-uplink-lpp") set_property(CACHE SUB_PROJECT PROPERTY STRINGS ${SUB_PROJECT_LIST}) +# Allow LORAWAN_DEFAULT_CLASS overriding for periodic-uplink-lpp project +if(SUB_PROJECT STREQUAL periodic-uplink-lpp) + set(LORAWAN_DEFAULT_CLASS_LIST CLASS_A CLASS_B CLASS_C) + set(LORAWAN_DEFAULT_CLASS CLASS_A CACHE STRING "Default LoRaWAN class is ClassA") + set_property(CACHE LORAWAN_DEFAULT_CLASS PROPERTY STRINGS ${LORAWAN_DEFAULT_CLASS_LIST}) +endif() + # Allow switching of active region set(ACTIVE_REGION_LIST LORAMAC_REGION_EU868 LORAMAC_REGION_US915 LORAMAC_REGION_CN779 LORAMAC_REGION_EU433 LORAMAC_REGION_AU915 LORAMAC_REGION_AS923 LORAMAC_REGION_CN470 @@ -124,6 +131,9 @@ add_executable(${PROJECT_NAME}-${SUB_PROJECT} target_compile_definitions(${PROJECT_NAME}-${SUB_PROJECT} PRIVATE $<$:LORAMAC_CLASSB_ENABLED>) target_compile_definitions(${PROJECT_NAME}-${SUB_PROJECT} PRIVATE ACTIVE_REGION=${ACTIVE_REGION}) +if(SUB_PROJECT STREQUAL periodic-uplink-lpp) + target_compile_definitions(${PROJECT_NAME}-${SUB_PROJECT} PRIVATE LORAWAN_DEFAULT_CLASS=${LORAWAN_DEFAULT_CLASS}) +endif() if(${SECURE_ELEMENT_PRE_PROVISIONED} MATCHES ON) target_compile_definitions(${PROJECT_NAME}-${SUB_PROJECT} PRIVATE -DSECURE_ELEMENT_PRE_PROVISIONED) endif() diff --git a/src/apps/LoRaMac/periodic-uplink-lpp/B-L072Z-LRWAN1/main.c b/src/apps/LoRaMac/periodic-uplink-lpp/B-L072Z-LRWAN1/main.c index 2fc002e8d..5e2d4467b 100644 --- a/src/apps/LoRaMac/periodic-uplink-lpp/B-L072Z-LRWAN1/main.c +++ b/src/apps/LoRaMac/periodic-uplink-lpp/B-L072Z-LRWAN1/main.c @@ -48,7 +48,9 @@ /*! * LoRaWAN default end-device class */ +#ifndef LORAWAN_DEFAULT_CLASS #define LORAWAN_DEFAULT_CLASS CLASS_A +#endif /*! * Defines the application data transmission duty cycle. 5s, value in [ms]. diff --git a/src/apps/LoRaMac/periodic-uplink-lpp/NAMote72/main.c b/src/apps/LoRaMac/periodic-uplink-lpp/NAMote72/main.c index e8277ffe4..16a5401ce 100644 --- a/src/apps/LoRaMac/periodic-uplink-lpp/NAMote72/main.c +++ b/src/apps/LoRaMac/periodic-uplink-lpp/NAMote72/main.c @@ -51,7 +51,9 @@ /*! * LoRaWAN default end-device class */ +#ifndef LORAWAN_DEFAULT_CLASS #define LORAWAN_DEFAULT_CLASS CLASS_A +#endif /*! * Defines the application data transmission duty cycle. 5s, value in [ms]. diff --git a/src/apps/LoRaMac/periodic-uplink-lpp/NucleoL073/main.c b/src/apps/LoRaMac/periodic-uplink-lpp/NucleoL073/main.c index 64e8554e5..d05a47124 100644 --- a/src/apps/LoRaMac/periodic-uplink-lpp/NucleoL073/main.c +++ b/src/apps/LoRaMac/periodic-uplink-lpp/NucleoL073/main.c @@ -48,7 +48,9 @@ /*! * LoRaWAN default end-device class */ +#ifndef LORAWAN_DEFAULT_CLASS #define LORAWAN_DEFAULT_CLASS CLASS_A +#endif /*! * Defines the application data transmission duty cycle. 5s, value in [ms]. diff --git a/src/apps/LoRaMac/periodic-uplink-lpp/NucleoL152/main.c b/src/apps/LoRaMac/periodic-uplink-lpp/NucleoL152/main.c index d56346c3a..fc29ec447 100644 --- a/src/apps/LoRaMac/periodic-uplink-lpp/NucleoL152/main.c +++ b/src/apps/LoRaMac/periodic-uplink-lpp/NucleoL152/main.c @@ -48,7 +48,9 @@ /*! * LoRaWAN default end-device class */ +#ifndef LORAWAN_DEFAULT_CLASS #define LORAWAN_DEFAULT_CLASS CLASS_A +#endif /*! * Defines the application data transmission duty cycle. 5s, value in [ms]. diff --git a/src/apps/LoRaMac/periodic-uplink-lpp/NucleoL476/main.c b/src/apps/LoRaMac/periodic-uplink-lpp/NucleoL476/main.c index 80865d071..6ef69b241 100644 --- a/src/apps/LoRaMac/periodic-uplink-lpp/NucleoL476/main.c +++ b/src/apps/LoRaMac/periodic-uplink-lpp/NucleoL476/main.c @@ -48,7 +48,9 @@ /*! * LoRaWAN default end-device class */ +#ifndef LORAWAN_DEFAULT_CLASS #define LORAWAN_DEFAULT_CLASS CLASS_A +#endif /*! * Defines the application data transmission duty cycle. 5s, value in [ms]. diff --git a/src/apps/LoRaMac/periodic-uplink-lpp/SAMR34/main.c b/src/apps/LoRaMac/periodic-uplink-lpp/SAMR34/main.c index f07b2cb17..cb7a38368 100644 --- a/src/apps/LoRaMac/periodic-uplink-lpp/SAMR34/main.c +++ b/src/apps/LoRaMac/periodic-uplink-lpp/SAMR34/main.c @@ -48,7 +48,9 @@ /*! * LoRaWAN default end-device class */ +#ifndef LORAWAN_DEFAULT_CLASS #define LORAWAN_DEFAULT_CLASS CLASS_A +#endif /*! * Defines the application data transmission duty cycle. 5s, value in [ms]. diff --git a/src/apps/LoRaMac/periodic-uplink-lpp/SKiM880B/main.c b/src/apps/LoRaMac/periodic-uplink-lpp/SKiM880B/main.c index 8750b3385..74000f62f 100644 --- a/src/apps/LoRaMac/periodic-uplink-lpp/SKiM880B/main.c +++ b/src/apps/LoRaMac/periodic-uplink-lpp/SKiM880B/main.c @@ -48,7 +48,9 @@ /*! * LoRaWAN default end-device class */ +#ifndef LORAWAN_DEFAULT_CLASS #define LORAWAN_DEFAULT_CLASS CLASS_A +#endif /*! * Defines the application data transmission duty cycle. 5s, value in [ms]. diff --git a/src/apps/LoRaMac/periodic-uplink-lpp/SKiM881AXL/main.c b/src/apps/LoRaMac/periodic-uplink-lpp/SKiM881AXL/main.c index 545e3cf9f..2090b4724 100644 --- a/src/apps/LoRaMac/periodic-uplink-lpp/SKiM881AXL/main.c +++ b/src/apps/LoRaMac/periodic-uplink-lpp/SKiM881AXL/main.c @@ -48,7 +48,9 @@ /*! * LoRaWAN default end-device class */ +#ifndef LORAWAN_DEFAULT_CLASS #define LORAWAN_DEFAULT_CLASS CLASS_A +#endif /*! * Defines the application data transmission duty cycle. 5s, value in [ms]. diff --git a/src/apps/LoRaMac/periodic-uplink-lpp/SKiM980A/main.c b/src/apps/LoRaMac/periodic-uplink-lpp/SKiM980A/main.c index b91be7571..abbb68411 100644 --- a/src/apps/LoRaMac/periodic-uplink-lpp/SKiM980A/main.c +++ b/src/apps/LoRaMac/periodic-uplink-lpp/SKiM980A/main.c @@ -48,7 +48,9 @@ /*! * LoRaWAN default end-device class */ +#ifndef LORAWAN_DEFAULT_CLASS #define LORAWAN_DEFAULT_CLASS CLASS_A +#endif /*! * Defines the application data transmission duty cycle. 5s, value in [ms].