Skip to content

Commit

Permalink
Merge pull request ARMmbed#15320 from dgoo2308/lora_as923_sub_region
Browse files Browse the repository at this point in the history
LoRaWAN AS923 Add SUB_REGION AS1..AS4
  • Loading branch information
0xc0170 authored Aug 25, 2022
2 parents d4f97aa + 3508ec2 commit 807fd79
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
74 changes: 74 additions & 0 deletions connectivity/lorawan/lorastack/phy/LoRaPHYAS923.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,80 @@
*/
#define AS923_NUMB_DEFAULT_CHANNELS 2

/*!
* Set default SUB region if not defined
*/
#ifndef MBED_CONF_LORA_PHY_AS923_SUB_REGION
#define MBED_CONF_LORA_PHY_AS923_SUB_REGION AS1
#warning "MBED_CONF_LORA_PHY_AS923_SUB_REGION is not set in mbed_app.json, default to `AS1`!"
#endif

/*!
* Define the SUB-REGION's
*/
#define LORA_AS923_SUB_REGION_AS1 0x01
#define LORA_AS923_SUB_REGION_AS2 0x02
#define LORA_AS923_SUB_REGION_AS3 0x03
#define LORA_AS923_SUB_REGION_AS4 0x04

/*!
* Parse SUB-REGION config
*/
#define mbed_lora_concat_(x) LORA_AS923_SUB_REGION_##x
#define mbed_lora_concat(x) mbed_lora_concat_(x)
#define LORA_AS923_SUB_REGION mbed_lora_concat(MBED_CONF_LORA_PHY_AS923_SUB_REGION)


/*!
* Define the Frequencies for teh SUB REGION within AS923 for AS1,AS2, AS3,AS4.
*/
#if ( LORA_AS923_SUB_REGION == LORA_AS923_SUB_REGION_AS1 )
// Singapore, Japan, Malaysia, Myanmar ....
// Historical AS923 =>RP002-1.0.0 LoRaWAN - 923..928Mhz
/*!
* Default transmit channel frequency's definition.
*/
#define AS923_LC1_FREQ 923200000
#define AS923_LC2_FREQ 923400000
/*!
* channel frequnetie range.
*/
#define AS923_LOWER_FREQ 923000000
#define AS923_UPPER_FREQ 928000000
/*!
* Second reception window channel frequency definition.
*/
#define AS923_RX_WND_2_FREQ 923200000
#elif ( LORA_AS923_SUB_REGION == LORA_AS923_SUB_REGION_AS2 )
// Brunei, Hong Kong, Indonesia, Laos, Cambodia, Thaland, Taiwan, Vietnam
// OFFSET -1.8 MHz AS923-1 =>RP002-1.0.1 LoRaWAN - 920..923Mhz
#define AS923_LC1_FREQ 921400000
#define AS923_LC2_FREQ 921600000
#define AS923_LOWER_FREQ 920000000
#define AS923_UPPER_FREQ 923000000
#define AS923_RX_WND_2_FREQ 921400000
#elif ( LORA_AS923_SUB_REGION == LORA_AS923_SUB_REGION_AS3 )
// Philipines, Quatar, Switzerland, Hungary, Cuba, Denmark .... 18 countries
// OFFSET -6.6Mhz AS923-1 =>RP002-1.0.1 LoRaWAN - 915..921Mhz
#define AS923_LC1_FREQ 916600000
#define AS923_LC2_FREQ 916800000
#define AS923_LOWER_FREQ 915000000
#define AS923_UPPER_FREQ 921000000
#define AS923_RX_WND_2_FREQ 916600000
#elif ( LORA_AS923_SUB_REGION == LORA_AS923_SUB_REGION_AS4 )
// Israel
// OFFSET -5.9MHz AS923-1 =>RP002-1.0.3 LoRaWAN - 917..920Mhz
#define AS923_LC1_FREQ 917300000
#define AS923_LC2_FREQ 917500000
#define AS923_LOWER_FREQ 917000000
#define AS923_UPPER_FREQ 920000000
#define AS923_RX_WND_2_FREQ 917300000
#else
#error "Invalid SUB region configuration, update mbed_app.json with correct MBED_CONF_LORA_PHY_AS923_SUB_REGION value"
#endif



/*!
* Number of channels to apply for the CF list
*/
Expand Down
4 changes: 4 additions & 0 deletions connectivity/lorawan/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"help": "LoRa PHY region: EU868, AS923, AU915, CN470, CN779, EU433, IN865, KR920, US915",
"value": "EU868"
},
"phy-as923-sub-region" : {
"help": "AS923 sub region: AS1, AS2, AS3, AS4",
"value": "AS1"
},
"over-the-air-activation": {
"help": "When set to 1 the application uses the Over-the-Air activation procedure, default: true",
"value": true
Expand Down

0 comments on commit 807fd79

Please sign in to comment.