1
1
/*
2
2
* Copyright (c) 2014-2016 IBM Corporation.
3
3
* Copyright (c) 2016 Matthijs Kooijman.
4
- * Copyright (c) 2016-2020 MCCI Corporation.
4
+ * Copyright (c) 2016-2021 MCCI Corporation.
5
5
* All rights reserved.
6
6
*
7
7
* Redistribution and use in source and binary forms, with or without
96
96
extern "C" {
97
97
#endif
98
98
99
- // LMIC version -- this is ths IBM LMIC version
99
+ // LMIC version -- this is the IBM LMIC version
100
100
#define LMIC_VERSION_MAJOR 1
101
101
#define LMIC_VERSION_MINOR 6
102
102
#define LMIC_VERSION_BUILD 1468577746
@@ -105,7 +105,8 @@ extern "C"{
105
105
#define ARDUINO_LMIC_VERSION_CALC (major , minor , patch , local ) \
106
106
((((major)*UINT32_C(1)) << 24) | (((minor)*UINT32_C(1)) << 16) | (((patch)*UINT32_C(1)) << 8) | (((local)*UINT32_C(1)) << 0))
107
107
108
- #define ARDUINO_LMIC_VERSION ARDUINO_LMIC_VERSION_CALC(3, 3, 0, 0) /* v3.3.0 */
108
+ #define ARDUINO_LMIC_VERSION ARDUINO_LMIC_VERSION_CALC(3, 99, 0, 2)
109
+ /* 3.99.0-1 */
109
110
110
111
#define ARDUINO_LMIC_VERSION_GET_MAJOR (v ) \
111
112
((((v)*UINT32_C(1)) >> 24u) & 0xFFu)
@@ -119,10 +120,35 @@ extern "C"{
119
120
#define ARDUINO_LMIC_VERSION_GET_LOCAL (v ) \
120
121
((v) & 0xFFu)
121
122
123
+ /// \brief convert a semantic version to an ordinal integer.
124
+ #define ARDUINO_LMIC_VERSION_TO_ORDINAL (v ) \
125
+ (((v) & 0xFFFFFF00u) | (((v) - 1) & 0xFFu))
126
+
127
+ /// \brief compare two semantic versions
128
+ /// \return \c true if \p a is less than \p b (as a semantic version).
129
+ #define ARDUINO_LMIC_VERSION_COMPARE_LT (a , b ) \
130
+ (ARDUINO_LMIC_VERSION_TO_ORDINAL(a) < ARDUINO_LMIC_VERSION_TO_ORDINAL(b))
131
+
132
+ /// \brief compare two semantic versions
133
+ /// \return \c true if \p a is less than or equal to \p b (as a semantic version).
134
+ #define ARDUINO_LMIC_VERSION_COMPARE_LE (a , b ) \
135
+ (ARDUINO_LMIC_VERSION_TO_ORDINAL(a) <= ARDUINO_LMIC_VERSION_TO_ORDINAL(b))
136
+
137
+ /// \brief compare two semantic versions
138
+ /// \return \c true if \p a is greater than \p b (as a semantic version).
139
+ #define ARDUINO_LMIC_VERSION_COMPARE_GT (a , b ) \
140
+ (ARDUINO_LMIC_VERSION_TO_ORDINAL(a) > ARDUINO_LMIC_VERSION_TO_ORDINAL(b))
141
+
142
+ /// \brief compare two semantic versions
143
+ /// \return \c true if \p a is greater than or equal to \p b (as a semantic version).
144
+ #define ARDUINO_LMIC_VERSION_COMPARE_GE (a , b ) \
145
+ (ARDUINO_LMIC_VERSION_TO_ORDINAL(a) >= ARDUINO_LMIC_VERSION_TO_ORDINAL(b))
146
+
147
+
122
148
//! Only For Antenna Tuning Tests !
123
149
//#define CFG_TxContinuousMode 1
124
150
125
- // since this was annouunced as the API variable, we keep it. But it's not used,
151
+ // since this was announced as the API variable, we keep it. But it's not used,
126
152
// MAX_LEN_FRAME is what the code uses.
127
153
enum { MAX_FRAME_LEN = MAX_LEN_FRAME }; //!< Library cap on max frame length
128
154
@@ -131,10 +157,10 @@ enum { MAX_MISSED_BCNS = (2 * 60 * 60 + 127) / 128 }; //!< threshold for d
131
157
// note that we need 100 ppm timing accuracy for
132
158
// this, to keep the timing error to +/- 700ms.
133
159
enum { MAX_RXSYMS = 350 }; // Stop tracking beacon if sync error grows beyond this. A 0.4% clock error
134
- // at SF9.125k means 512 ms; one sybol is 4.096 ms,
160
+ // at SF9.125k means 512 ms; one symbol is 4.096 ms,
135
161
// so this needs to be at least 125 for an STM32L0.
136
162
// And for 100ppm clocks and 2 hours of beacon misses,
137
- // this needs to accomodate 1.4 seconds of error at
163
+ // this needs to accommodate 1.4 seconds of error at
138
164
// 4.096 ms/sym or at least 342 symbols.
139
165
140
166
enum { LINK_CHECK_CONT = 0 , // continue with this after reported dead link
@@ -161,7 +187,7 @@ struct band_t {
161
187
u2_t txcap ; // duty cycle limitation: 1/txcap
162
188
s1_t txpow ; // maximum TX power
163
189
u1_t lastchnl ; // last used channel
164
- ostime_t avail ; // channel is blocked until this time
190
+ ostime_t avail ; // band is blocked until this time
165
191
};
166
192
TYPEDEF_xref2band_t ; //!< \internal
167
193
@@ -172,10 +198,8 @@ struct lmic_saved_adr_state_s {
172
198
173
199
#elif CFG_LMIC_US_like // US915 spectrum =================================================
174
200
175
- enum { MAX_XCHANNELS = 2 }; // extra channels in RAM, channels 0-71 are immutable
176
-
177
201
struct lmic_saved_adr_state_s {
178
- u2_t channelMap [(72 + MAX_XCHANNELS + 15 )/16 ]; // enabled bits
202
+ u2_t channelMap [(72 + 15 )/16 ]; // enabled bits
179
203
u2_t activeChannels125khz ;
180
204
u2_t activeChannels500khz ;
181
205
};
@@ -531,10 +555,10 @@ struct lmic_t {
531
555
// bit map of enabled datarates for each channel
532
556
u2_t channelDrMap [MAX_CHANNELS ];
533
557
u2_t channelMap ;
558
+ u2_t channelShuffleMap ;
534
559
#elif CFG_LMIC_US_like
535
- u4_t xchFreq [MAX_XCHANNELS ]; // extra channel frequencies (if device is behind a repeater)
536
- u2_t xchDrMap [MAX_XCHANNELS ]; // extra channel datarate ranges ---XXX: ditto
537
- u2_t channelMap [(72 + MAX_XCHANNELS + 15 )/16 ]; // enabled bits
560
+ u2_t channelMap [(72 + 15 )/16 ]; // enabled bits
561
+ u2_t channelShuffleMap [(72 + 15 )/16 ]; // enabled bits
538
562
u2_t activeChannels125khz ;
539
563
u2_t activeChannels500khz ;
540
564
#endif
@@ -569,7 +593,10 @@ struct lmic_t {
569
593
570
594
u1_t txChnl ; // channel for next TX
571
595
u1_t globalDutyRate ; // max rate: 1/2^k
572
-
596
+ #if CFG_LMIC_US_like
597
+ u1_t txChnl_125kHz ; ///< during joins on 500 kHz, the 125 kHz channel
598
+ /// that was last used.
599
+ #endif
573
600
u1_t upRepeat ; // configured up repeat
574
601
s1_t adrTxPow ; // ADR adjusted TX power
575
602
u1_t datarate ; // current data rate
@@ -659,6 +686,9 @@ bit_t LMIC_enableChannel(u1_t channel);
659
686
bit_t LMIC_disableSubBand (u1_t band );
660
687
bit_t LMIC_selectSubBand (u1_t band );
661
688
689
+ //! \brief get the number of (fixed) default channels before the progammable channels.
690
+ u1_t LMIC_queryNumDefaultChannels (void );
691
+
662
692
void LMIC_setDrTxpow (dr_t dr , s1_t txpow ); // set default/start DR/txpow
663
693
void LMIC_setAdrMode (bit_t enabled ); // set ADR mode (if mobile turn off)
664
694
@@ -705,6 +735,8 @@ int LMIC_getNetworkTimeReference(lmic_time_reference_t *pReference);
705
735
int LMIC_registerRxMessageCb (lmic_rxmessage_cb_t * pRxMessageCb , void * pUserData );
706
736
int LMIC_registerEventCb (lmic_event_cb_t * pEventCb , void * pUserData );
707
737
738
+ int LMIC_findNextChannel (uint16_t * , const uint16_t * , uint16_t , int );
739
+
708
740
// APIs for client half of compliance.
709
741
typedef u1_t lmic_compliance_rx_action_t ;
710
742
0 commit comments