|
18 | 18 | #ifndef LORAPHY_TARGET
|
19 | 19 | #define LORAPHY_TARGET
|
20 | 20 |
|
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 |
| - |
32 | 21 | #ifdef MBED_CONF_LORA_PHY
|
33 |
| - #if MBED_CONF_LORA_PHY == EU868 |
| 22 | + |
| 23 | +#define LORA_REGION_EU868 0x10 |
| 24 | +#define LORA_REGION_AS923 0x11 |
| 25 | +#define LORA_REGION_AU915 0x12 |
| 26 | +#define LORA_REGION_CN470 0x13 |
| 27 | +#define LORA_REGION_CN779 0x14 |
| 28 | +#define LORA_REGION_EU433 0x15 |
| 29 | +#define LORA_REGION_IN865 0x16 |
| 30 | +#define LORA_REGION_KR920 0x17 |
| 31 | +#define LORA_REGION_US915 0x18 |
| 32 | +#define LORA_REGION_US915_HYBRID 0x19 |
| 33 | + |
| 34 | +//DO NOT USE integer values in mbed_app.json! |
| 35 | +//These are defined for backward compatibility and |
| 36 | +//Will be DEPRECATED in the future |
| 37 | +#define LORA_REGION_0 0x10 |
| 38 | +#define LORA_REGION_1 0x11 |
| 39 | +#define LORA_REGION_2 0x12 |
| 40 | +#define LORA_REGION_3 0x13 |
| 41 | +#define LORA_REGION_4 0x14 |
| 42 | +#define LORA_REGION_5 0x15 |
| 43 | +#define LORA_REGION_6 0x16 |
| 44 | +#define LORA_REGION_7 0x17 |
| 45 | +#define LORA_REGION_8 0x18 |
| 46 | +#define LORA_REGION_9 0x19 |
| 47 | + |
| 48 | +//Since 0 would be equal to any undefined value we need to handle this in a other way |
| 49 | +#define mbed_lora_concat_(x) LORA_REGION_##x |
| 50 | +#define mbed_lora_concat(x) mbed_lora_concat_(x) |
| 51 | +#define LORA_REGION mbed_lora_concat(MBED_CONF_LORA_PHY) |
| 52 | + |
| 53 | + #if LORA_REGION == LORA_REGION_EU868 |
34 | 54 | #include "lorawan/lorastack/phy/LoRaPHYEU868.h"
|
35 | 55 | #define LoRaPHY_region LoRaPHYEU868
|
36 |
| - #elif MBED_CONF_LORA_PHY == AS923 |
| 56 | + #elif LORA_REGION == LORA_REGION_AS923 |
37 | 57 | #include "lorawan/lorastack/phy/LoRaPHYAS923.h"
|
38 | 58 | #define LoRaPHY_region LoRaPHYAS923
|
39 |
| - #elif MBED_CONF_LORA_PHY == AU915 |
| 59 | + #elif LORA_REGION == LORA_REGION_AU915 |
40 | 60 | #include "lorawan/lorastack/phy/LoRaPHYAU915.h"
|
41 | 61 | #define LoRaPHY_region LoRaPHYAU915;
|
42 |
| - #elif MBED_CONF_LORA_PHY == CN470 |
| 62 | + #elif LORA_REGION == LORA_REGION_CN470 |
43 | 63 | #include "lorawan/lorastack/phy/LoRaPHYCN470.h"
|
44 | 64 | #define LoRaPHY_region LoRaPHYCN470
|
45 |
| - #elif MBED_CONF_LORA_PHY == CN779 |
| 65 | + #elif LORA_REGION == LORA_REGION_CN779 |
46 | 66 | #include "lorawan/lorastack/phy/LoRaPHYCN779.h"
|
47 | 67 | #define LoRaPHY_region LoRaPHYCN779
|
48 |
| - #elif MBED_CONF_LORA_PHY == EU433 |
| 68 | + #elif LORA_REGION == LORA_REGION_EU433 |
49 | 69 | #include "lorawan/lorastack/phy/LoRaPHYEU433.h"
|
50 | 70 | #define LoRaPHY_region LoRaPHYEU433
|
51 |
| - #elif MBED_CONF_LORA_PHY == IN865 |
| 71 | + #elif LORA_REGION == LORA_REGION_IN865 |
52 | 72 | #include "lorawan/lorastack/phy/LoRaPHYIN865.h"
|
53 | 73 | #define LoRaPHY_region LoRaPHYIN865
|
54 |
| - #elif MBED_CONF_LORA_PHY == KR920 |
| 74 | + #elif LORA_REGION == LORA_REGION_KR920 |
55 | 75 | #include "lorawan/lorastack/phy/LoRaPHYKR920.h"
|
56 | 76 | #define LoRaPHY_region LoRaPHYKR920
|
57 |
| - #elif MBED_CONF_LORA_PHY == US915 |
| 77 | + #elif LORA_REGION == LORA_REGION_US915 |
58 | 78 | #include "lorawan/lorastack/phy/LoRaPHYUS915.h"
|
59 | 79 | #define LoRaPHY_region LoRaPHYUS915
|
60 |
| - #elif MBED_CONF_LORA_PHY == US915_HYBRID |
| 80 | + #elif LORA_REGION == LORA_REGION_US915_HYBRID |
61 | 81 | #include "lorawan/lorastack/phy/LoRaPHYUS915Hybrid.h"
|
62 | 82 | #define LoRaPHY_region LoRaPHYUS915Hybrid
|
| 83 | + #else |
| 84 | + #error "Invalid region configuration, update mbed_app.json with correct MBED_CONF_LORA_PHY value" |
63 | 85 | #endif //MBED_CONF_LORA_PHY == VALUE
|
64 | 86 | #else
|
65 | 87 | #error "Must set LoRa PHY layer parameters."
|
|
0 commit comments