Skip to content

Commit d1bbd21

Browse files
author
Antti Kauppila
committed
LoRa: Improved handling of region selection
- This implements IOTCELL-697 - This touches API, but does not break it, old ones still work in a same manner!
1 parent 192a8e5 commit d1bbd21

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

features/lorawan/lorastack/phy/loraphy_target.h

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,50 @@
1818
#ifndef LORAPHY_TARGET
1919
#define LORAPHY_TARGET
2020

21+
#define EU868 0
22+
#define AS923 1
23+
#define AU915 2
24+
#define CN470 3
25+
#define CN779 4
26+
#define EU433 5
27+
#define IN865 6
28+
#define KR920 7
29+
#define US915 8
30+
#define US915_HYBRID 9
31+
2132
#ifdef MBED_CONF_LORA_PHY
22-
#if MBED_CONF_LORA_PHY == 0
33+
#if MBED_CONF_LORA_PHY == EU868
2334
#include "lorawan/lorastack/phy/LoRaPHYEU868.h"
2435
#define LoRaPHY_region LoRaPHYEU868
25-
#elif MBED_CONF_LORA_PHY == 1
36+
#elif MBED_CONF_LORA_PHY == AS923
2637
#include "lorawan/lorastack/phy/LoRaPHYAS923.h"
2738
#define LoRaPHY_region LoRaPHYAS923
28-
#elif MBED_CONF_LORA_PHY == 2
39+
#elif MBED_CONF_LORA_PHY == AU915
2940
#include "lorawan/lorastack/phy/LoRaPHYAU915.h"
3041
#define LoRaPHY_region LoRaPHYAU915;
31-
#elif MBED_CONF_LORA_PHY == 3
42+
#elif MBED_CONF_LORA_PHY == CN470
3243
#include "lorawan/lorastack/phy/LoRaPHYCN470.h"
3344
#define LoRaPHY_region LoRaPHYCN470
34-
#elif MBED_CONF_LORA_PHY == 4
45+
#elif MBED_CONF_LORA_PHY == CN779
3546
#include "lorawan/lorastack/phy/LoRaPHYCN779.h"
3647
#define LoRaPHY_region LoRaPHYCN779
37-
#elif MBED_CONF_LORA_PHY == 5
48+
#elif MBED_CONF_LORA_PHY == EU433
3849
#include "lorawan/lorastack/phy/LoRaPHYEU433.h"
3950
#define LoRaPHY_region LoRaPHYEU433
40-
#elif MBED_CONF_LORA_PHY == 6
51+
#elif MBED_CONF_LORA_PHY == IN865
4152
#include "lorawan/lorastack/phy/LoRaPHYIN865.h"
4253
#define LoRaPHY_region LoRaPHYIN865
43-
#elif MBED_CONF_LORA_PHY == 7
54+
#elif MBED_CONF_LORA_PHY == KR920
4455
#include "lorawan/lorastack/phy/LoRaPHYKR920.h"
4556
#define LoRaPHY_region LoRaPHYKR920
46-
#elif MBED_CONF_LORA_PHY == 8
57+
#elif MBED_CONF_LORA_PHY == US915
4758
#include "lorawan/lorastack/phy/LoRaPHYUS915.h"
4859
#define LoRaPHY_region LoRaPHYUS915
49-
#elif MBED_CONF_LORA_PHY == 9
60+
#elif MBED_CONF_LORA_PHY == US915_HYBRID
5061
#include "lorawan/lorastack/phy/LoRaPHYUS915Hybrid.h"
5162
#define LoRaPHY_region LoRaPHYUS915Hybrid
63+
#else
64+
#error "Unsupported region, check your configuration."
5265
#endif //MBED_CONF_LORA_PHY == VALUE
5366
#else
5467
#error "Must set LoRa PHY layer parameters."

features/lorawan/mbed_lib.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "lora",
33
"config": {
44
"phy": {
5-
"help": "LoRa PHY region. 0 = EU868 (default), 1 = AS923, 2 = AU915, 3 = CN470, 4 = CN779, 5 = EU433, 6 = IN865, 7 = KR920, 8 = US915, 9 = US915_HYBRID",
6-
"value": "0"
5+
"help": "LoRa PHY region: EU868, AS923, AU915, CN470, CN779, EU433, IN865, KR920, US915, US915_HYBRID",
6+
"value": "EU868"
77
},
88
"over-the-air-activation": {
99
"help": "When set to 1 the application uses the Over-the-Air activation procedure, default: true",

0 commit comments

Comments
 (0)