Skip to content

Commit d44b798

Browse files
committed
Convert changeset to LMIC configuration style
1 parent 5b55ef8 commit d44b798

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

project_config/lmic_project_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define CFG_us915 1
44
//#define CFG_au915 1
55
//#define CFG_as923 1
6-
//#define CFG_as923jp 1
6+
// #define LMIC_COUNTRY_CODE LMIC_COUNTRY_CODE_JP /* for as923-JP; also define CFG_as923 */
77
//#define CFG_kr920 1
88
//#define CFG_in866 1
99
#define CFG_sx1276_radio 1

src/lmic/lmic_as923.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
//
3636
// BEG: AS923 related stuff
3737
//
38+
enum {
39+
AS923_REGION_TX_EIRP_MAX_DBM =
40+
(LMIC_COUNTRY_CODE == LMIC_COUNTRY_CODE_JP) ? AS923_JP_TX_EIRP_MAX_DBM
41+
: AS923_TX_EIRP_MAX_DBM
42+
};
3843

3944
// see table in section 2.7.3
4045
CONST_TABLE(u1_t, _DR2RPS_CRC)[] = {
@@ -130,7 +135,7 @@ static CONST_TABLE(s1_t, TXMAXEIRP)[16] = {
130135
static int8_t LMICas923_getMaxEIRP(uint8_t mcmd_txparam) {
131136
// if uninitialized, return default.
132137
if (mcmd_txparam == 0xFF)
133-
return AS923_TX_EIRP_MAX_DBM;
138+
return AS923_REGION_TX_EIRP_MAX_DBM;
134139
else
135140
return TABLE_GET_S1(
136141
TXMAXEIRP,
@@ -199,7 +204,7 @@ void LMICas923_initDefaultChannels(bit_t join) {
199204
}
200205

201206
LMIC.bands[BAND_CENTI].txcap = AS923_TX_CAP;
202-
LMIC.bands[BAND_CENTI].txpow = AS923_TX_EIRP_MAX_DBM;
207+
LMIC.bands[BAND_CENTI].txpow = AS923_REGION_TX_EIRP_MAX_DBM;
203208
LMIC.bands[BAND_CENTI].lastchnl = os_getRndU1() % MAX_CHANNELS;
204209
LMIC.bands[BAND_CENTI].avail = os_getTime();
205210
}
@@ -457,7 +462,7 @@ ostime_t LMICas923_nextJoinState(void) {
457462
void
458463
LMICas923_initJoinLoop(void) {
459464
// LMIC.txParam is set to 0xFF by the central code at init time.
460-
LMICeulike_initJoinLoop(NUM_DEFAULT_CHANNELS, /* adr dBm */ AS923_TX_EIRP_MAX_DBM);
465+
LMICeulike_initJoinLoop(NUM_DEFAULT_CHANNELS, /* adr dBm */ AS923_REGION_TX_EIRP_MAX_DBM);
461466
}
462467

463468
void

src/lmic/lorabase_as923.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,8 @@ enum {
6868
AS923_FREQ_MAX = 928000000
6969
};
7070
enum {
71-
#if defined(CFG_as923jp)
72-
AS923_TX_EIRP_MAX_DBM = 13 // 13 dBm = 19.95mW < 20mW
73-
#else
71+
AS923_JP_TX_EIRP_MAX_DBM = 13, // 13 dBm = 19.95mW < 20mW
7472
AS923_TX_EIRP_MAX_DBM = 16 // 16 dBm
75-
#endif
7673
};
7774
enum { DR_PAGE_AS923 = 0x10 * (LMIC_REGION_as923 - 1) };
7875

0 commit comments

Comments
 (0)