diff --git a/README.md b/README.md index 47cc97cd..9f88f771 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ For more info, see https://www.arduino.cc/en/Guide/Libraries Features -------- The LMIC library provides a fairly complete LoRaWAN Class A and Class B -implementation, supporting the EU-868 and US-915 bands. Only a limited +implementation, supporting the EU-868, US-915 and AU-915 bands. Only a limited number of features was tested using this port on Arduino hardware, so be careful when using any of the untested features. @@ -236,6 +236,36 @@ This board uses the following pin mapping: .dio = {4, 5, 7}, }; +#### Adafruit Feather + +##### Feather 32u4 RFM95W LoRa Radio 900MHz +This board uses the following pin mapping: + + const lmic_pinmap lmic_pins = { + .nss = 8, + .rxtx = LMIC_UNUSED_PIN, + .rst = 4, + .dio = {7, 6, LMIC_UNUSED_PIN}, + }; + +##### Feather M0 RFM95W loRa Radio 900MHz +This board uses the following pin mapping: + + const lmic_pinmap lmic_pins = { + .nss = 8, + .rxtx = LMIC_UNUSED_PIN, + .rst = 4, + .dio = {3, 6, LMIC_UNUSED_PIN}, + }; + +**PIN6** and **IO1** from the Adafruit board need to be connected before uploading the code. + +A suitable length [antenna](https://learn.adafruit.com/adafruit-feather-32u4-radio-with-lora-radio-module/antenna-options) is also required to ensure good connection qualities. + +- 433 MHz - 6.5 inches, or 16.5 cm +- 868 MHz - 3.25 inches or 8.2 cm +- 915 MHz - 3 inches or 7.8 cm + Examples -------- This library currently provides three examples: diff --git a/src/lmic/config.h b/src/lmic/config.h index 23e705bc..66f1fb6a 100644 --- a/src/lmic/config.h +++ b/src/lmic/config.h @@ -7,6 +7,11 @@ #define CFG_eu868 1 //#define CFG_us915 1 +//#define CFG_au915 1 + +#if defined(CFG_au915) + #define CFG_us915 1 +#endif // This is the SX1272/SX1273 radio, which is also used on the HopeRF // RFM92 boards. //#define CFG_sx1272_radio 1 diff --git a/src/lmic/lmic.c b/src/lmic/lmic.c index 38020288..a3806615 100644 --- a/src/lmic/lmic.c +++ b/src/lmic/lmic.c @@ -758,7 +758,11 @@ static void initDefaultChannels (void) { static u4_t convFreq (xref2u1_t ptr) { u4_t freq = (os_rlsbf4(ptr-1) >> 8) * 100; + #if defined(CFG_au915) + if( freq < AU915_FREQ_MIN || freq > AU915_FREQ_MAX ) + #else if( freq < US915_FREQ_MIN || freq > US915_FREQ_MAX ) + #endif freq = 0; return freq; } @@ -821,6 +825,29 @@ static u1_t mapChannels (u1_t chpage, u2_t chmap) { return 1; } +#if defined(CFG_au915) +static void updateTx (ostime_t txbeg) { + u1_t chnl = LMIC.txChnl; + if( chnl < 64 ) { + LMIC.freq = AU915_125kHz_UPFBASE + (chnl % 8) * AU915_125kHz_UPFSTEP; + LMIC.txpow = 30; + return; + } + LMIC.txpow = 26; + if( chnl < 64+8 ) { + LMIC.freq = AU915_500kHz_UPFBASE; + } else { + ASSERT(chnl < 64+8+MAX_XCHANNELS); + LMIC.freq = LMIC.xchFreq[chnl-72]; + } + + // Update global duty cycle stats + if( LMIC.globalDutyRate != 0 ) { + ostime_t airtime = calcAirTime(LMIC.rps, LMIC.dataLen); + LMIC.globalDutyAvail = txbeg + (airtime<