@@ -117,30 +117,6 @@ Revision history:
117
117
(1 << LMIC_REGION_in866 ) | \
118
118
0 )
119
119
120
- //
121
- // Our input is a -D of one of CFG_eu868, CFG_us915, CFG_as923, CFG_au915, CFG_in866
122
- // More will be added in the the future. So at this point we create CFG_region with
123
- // following values. These are in order of the sections in the manual. Not all of the
124
- // below are supported yet.
125
- //
126
- // CFG_as923jp is treated as a special case of CFG_as923, so it's not included in
127
- // the below.
128
- //
129
- // TODO([email protected] ) consider moving this block to a central file as it's not
130
- // user-editable.
131
- //
132
- # define CFG_LMIC_REGION_MASK \
133
- ((defined(CFG_eu868) << LMIC_REGION_eu868) | \
134
- (defined(CFG_us915) << LMIC_REGION_us915) | \
135
- (defined(CFG_cn783) << LMIC_REGION_cn783) | \
136
- (defined(CFG_eu433) << LMIC_REGION_eu433) | \
137
- (defined(CFG_au915) << LMIC_REGION_au915) | \
138
- (defined(CFG_cn490) << LMIC_REGION_cn490) | \
139
- (defined(CFG_as923) << LMIC_REGION_as923) | \
140
- (defined(CFG_kr920) << LMIC_REGION_kr920) | \
141
- (defined(CFG_in866) << LMIC_REGION_in866) | \
142
- 0)
143
-
144
120
// the selected region.
145
121
// TODO([email protected] ) consider moving this block to a central file as it's not
146
122
// user-editable.
@@ -170,11 +146,94 @@ Revision history:
170
146
# define CFG_region 0
171
147
#endif
172
148
173
- // a bitmask of EU-like regions -- these are regions which have up to 16
174
- // channels indidually programmable via downloink.
175
- //
176
- // TODO([email protected] ) consider moving this block to a central file as it's not
177
- // user-editable.
149
+ // LMIC_CFG_*_ENA -- either 1 or 0 based on whether that region
150
+ // is enabled. Note: these must be after the code that special-cases
151
+ // CFG_as923jp.
152
+ #if defined(CFG_eu868 )
153
+ # define LMIC_CFG_eu868_ENA 1
154
+ #else
155
+ # define LMIC_CFG_eu868_ENA 0
156
+ #endif
157
+
158
+ #if defined(CFG_us915 )
159
+ # define LMIC_CFG_us915_ENA 1
160
+ #else
161
+ # define LMIC_CFG_us915_ENA 0
162
+ #endif
163
+
164
+ #if defined(CFG_cn783 )
165
+ # define LMIC_CFG_cn783_ENA 1
166
+ #else
167
+ # define LMIC_CFG_cn783_ENA 0
168
+ #endif
169
+
170
+ #if defined(CFG_eu433 )
171
+ # define LMIC_CFG_eu433_ENA 1
172
+ #else
173
+ # define LMIC_CFG_eu433_ENA 0
174
+ #endif
175
+
176
+ #if defined(CFG_au915 )
177
+ # define LMIC_CFG_au915_ENA 1
178
+ #else
179
+ # define LMIC_CFG_au915_ENA 0
180
+ #endif
181
+
182
+ #if defined(CFG_cn490 )
183
+ # define LMIC_CFG_cn490_ENA 1
184
+ #else
185
+ # define LMIC_CFG_cn490_ENA 0
186
+ #endif
187
+
188
+ #if defined(CFG_as923 )
189
+ # define LMIC_CFG_as923_ENA 1
190
+ #else
191
+ # define LMIC_CFG_as923_ENA 0
192
+ #endif
193
+
194
+ #if defined(CFG_kr920 )
195
+ # define LMIC_CFG_kr920_ENA 1
196
+ #else
197
+ # define LMIC_CFG_kr920_ENA 0
198
+ #endif
199
+
200
+ #if defined(CFG_in866 )
201
+ # define LMIC_CFG_in866_ENA 1
202
+ #else
203
+ # define LMIC_CFG_in866_ENA 0
204
+ #endif
205
+
206
+ /// \brief Bitmask of configured regions
207
+ ///
208
+ /// Our input is a -D of one of CFG_eu868, CFG_us915, CFG_as923, CFG_au915, CFG_in866
209
+ /// More will be added in the the future. So at this point we create CFG_region with
210
+ /// following values. These are in order of the sections in the manual. Not all of the
211
+ /// below are supported yet.
212
+ ///
213
+ /// CFG_as923jp is treated as a special case of CFG_as923, so it's not included in
214
+ /// the below.
215
+ ///
216
+ /// TODO([email protected] ) consider moving this block to a central file as it's not
217
+ /// user-editable.
218
+ ///
219
+ # define CFG_LMIC_REGION_MASK \
220
+ ((LMIC_CFG_eu868_ENA << LMIC_REGION_eu868) | \
221
+ (LMIC_CFG_us915_ENA << LMIC_REGION_us915) | \
222
+ (LMIC_CFG_cn783_ENA << LMIC_REGION_cn783) | \
223
+ (LMIC_CFG_eu433_ENA << LMIC_REGION_eu433) | \
224
+ (LMIC_CFG_au915_ENA << LMIC_REGION_au915) | \
225
+ (LMIC_CFG_cn490_ENA << LMIC_REGION_cn490) | \
226
+ (LMIC_CFG_as923_ENA << LMIC_REGION_as923) | \
227
+ (LMIC_CFG_kr920_ENA << LMIC_REGION_kr920) | \
228
+ (LMIC_CFG_in866_ENA << LMIC_REGION_in866) | \
229
+ 0)
230
+
231
+ /// \brief a bitmask of EU-like regions
232
+ ///
233
+ /// EU-like regions have up to 16 channels individually programmable via downlink.
234
+ ///
235
+ /// TODO([email protected] ) consider moving this block to a central file as it's not
236
+ /// user-editable.
178
237
#define CFG_LMIC_EU_like_MASK ( \
179
238
(1 << LMIC_REGION_eu868) | \
180
239
/* (1 << LMIC_REGION_us915) | */ \
@@ -187,12 +246,14 @@ Revision history:
187
246
(1 << LMIC_REGION_in866 ) | \
188
247
0 )
189
248
190
- // a bitmask of` US-like regions -- these are regions with 64 fixed 125 kHz channels
191
- // overlaid by 8 500 kHz channels. The channel frequencies can't be changed, but
192
- // subsets of channels can be selected via masks.
193
- //
194
- // TODO([email protected] ) consider moving this block to a central file as it's not
195
- // user-editable.
249
+ /// \brief bitmask of` US-like regions
250
+ ///
251
+ /// US-like regions have 64 fixed 125-kHz channels overlaid by 8 500-kHz
252
+ /// channels. The channel frequencies can't be changed, but
253
+ /// subsets of channels can be selected via masks.
254
+ ///
255
+ /// TODO([email protected] ) consider moving this block to a central file as it's not
256
+ /// user-editable.
196
257
#define CFG_LMIC_US_like_MASK ( \
197
258
/* (1 << LMIC_REGION_eu868) | */ \
198
259
(1 << LMIC_REGION_us915 ) | \
@@ -210,16 +271,19 @@ Revision history:
210
271
// TODO([email protected] ) consider moving this block to a central file as it's not
211
272
// user-editable.
212
273
//
274
+
275
+ /// \brief true if configured region is EU-like, false otherwise.
213
276
#define CFG_LMIC_EU_like (!!(CFG_LMIC_REGION_MASK & CFG_LMIC_EU_like_MASK))
277
+ /// \brief true if configured region is US-like, false otherwise.
214
278
#define CFG_LMIC_US_like (!!(CFG_LMIC_REGION_MASK & CFG_LMIC_US_like_MASK))
215
279
216
280
//
217
- // The supported LMIC LoRaWAAN spec versions. These need to be numerically ordered,
281
+ // The supported LMIC LoRaWAN spec versions. These need to be numerically ordered,
218
282
// so that we can (for example) compare
219
283
//
220
284
// LMIC_LORAWAN_SPEC_VERSION < LMIC_LORAWAN_SPEC_VERSION_1_0_3.
221
285
//
222
- #define LMIC_LORAWAN_SPEC_VERSION_1_0_2 0x01000200u
223
- #define LMIC_LORAWAN_SPEC_VERSION_1_0_3 0x01000300u
286
+ #define LMIC_LORAWAN_SPEC_VERSION_1_0_2 0x01000200u /// Refers to LoRaWAN spec 1.0.2
287
+ #define LMIC_LORAWAN_SPEC_VERSION_1_0_3 0x01000300u /// Refers to LoRaWAN spec 1.0.3
224
288
225
289
#endif /* _LMIC_CONFIG_PRECONDITIONS_H_ */
0 commit comments