Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of LMiC by
Revision 3:519c71d29a06, committed 2015-11-26
- Comitter:
- mluis
- Date:
- Thu Nov 26 12:46:56 2015 +0000
- Parent:
- 1:d3b7bde3995c
- Child:
- 4:85b2b647cb64
- Commit message:
- Adapted radio.cpp to new version of SX1276Lib radio driver; Small corrections on lmic.c/lmic.h
Changed in this revision
--- a/lmic.cpp Tue Mar 31 13:36:56 2015 +0000
+++ b/lmic.cpp Thu Nov 26 12:46:56 2015 +0000
@@ -689,7 +689,6 @@
LMIC.txend = LMIC.bands[BAND_MILLI].avail + rndDelay(8);
}
-
static ostime_t nextJoinState (void) {
u1_t failed = 0;
@@ -741,11 +740,12 @@
static u4_t convFreq (xref2u1_t ptr) {
u4_t freq = (os_rlsbf4(ptr-1) >> 8) * 100;
- if( freq >= US915_FREQ_MIN && freq <= US915_FREQ_MAX )
+ if( freq < US915_FREQ_MIN || freq > US915_FREQ_MAX )
freq = 0;
return freq;
}
+
bit_t LMIC_setupChannel (u1_t chidx, u4_t freq, u2_t drmap, s1_t band) {
if( chidx < 72 || chidx >= 72+MAX_XCHANNELS )
return 0; // channels 0..71 are hardwired
@@ -1382,7 +1382,7 @@
u1_t chidx=72;
#endif
for( ; chidx<8; chidx++, dlen+=3 )
- LMIC_setupChannel(chidx, os_rlsbf4(&LMIC.frame[dlen-1]) >> 8, 0, -1);
+ LMIC_setupChannel(chidx, convFreq(&LMIC.frame[dlen]), 0, -1);
}
// already incremented when JOIN REQ got sent off
--- a/lmic.h Tue Mar 31 13:36:56 2015 +0000 +++ b/lmic.h Thu Nov 26 12:46:56 2015 +0000 @@ -17,7 +17,7 @@ // MBED compiler options #define CFG_eu868 1 -//#define CFG_us915 0 +//#define CFG_us915 1 #define USE_SMTC_RADIO_DRIVER 1
--- a/radio.cpp Tue Mar 31 13:36:56 2015 +0000
+++ b/radio.cpp Thu Nov 26 12:46:56 2015 +0000
@@ -63,10 +63,15 @@
*/
void OnCadDone( void );
+/*!
+ * Radio events function pointer
+ */
+static RadioEvents_t RadioEvents;
+
/*
* Radio object declraration
*/
-SX1276MB1xAS Radio( OnTxDone, OnTxTimeout, OnRxDone, OnRxTimeout, OnRxError, NULL, NULL );
+SX1276MB1xAS Radio( NULL );
static const u2_t LORA_RXDONE_FIXUP[] = {
[FSK] = us2osticks(0), // ( 0 ticks)
@@ -162,6 +167,14 @@
void radio_init( void )
{
hal_disableIRQs( );
+
+ // Initialize Radio driver
+ RadioEvents.TxDone = OnTxDone;
+ RadioEvents.RxDone = OnRxDone;
+ RadioEvents.RxError = OnRxError;
+ RadioEvents.TxTimeout = OnTxTimeout;
+ RadioEvents.RxTimeout = OnRxTimeout;
+ Radio.Init( &RadioEvents );
// seed 15-byte randomness via noise rssi
// Set LoRa modem ON
