Arduino LMIC
6.0.1
Arduino LoRaWAN(r) MAC in C
Loading...
Searching...
No Matches
config.h
1
#ifndef _lmic_config_h_
2
#define _lmic_config_h_
3
4
// In the original LMIC code, these config values were defined on the
5
// gcc commandline. Since Arduino does not allow easily modifying the
6
// compiler commandline unless you modify the BSP, you have two choices:
7
//
8
// - edit {libraries}/arduino-lmic/project_config/lmic_project_config.h;
9
// - use a BSP like the MCCI Arduino BSPs, which get the configuration
10
// from the boards.txt file through a menu option.
11
//
12
// You definitely should not edit this file.
13
14
// set up preconditions, and load configuration if needed.
15
#ifndef _LMIC_CONFIG_PRECONDITIONS_H_
16
# include "lmic_config_preconditions.h"
17
#endif
18
19
// check post-conditions.
20
21
// make sure that we have exactly one target region defined.
22
#if CFG_LMIC_REGION_MASK == 0
23
# define CFG_eu868 1
24
#elif (CFG_LMIC_REGION_MASK & (-CFG_LMIC_REGION_MASK)) != CFG_LMIC_REGION_MASK
25
# error You can define at most one of CFG_... variables
26
#elif (CFG_LMIC_REGION_MASK & LMIC_REGIONS_SUPPORTED) == 0
27
# error The selected CFG_... region is not supported yet.
28
#endif
29
30
// make sure that LMIC_COUNTRY_CODE is defined.
31
#ifndef LMIC_COUNTRY_CODE
32
# define LMIC_COUNTRY_CODE LMIC_COUNTRY_CODE_NONE
33
#endif
34
35
// if the country code is Japan, then the region must be AS923
36
#if LMIC_COUNTRY_CODE == LMIC_COUNTRY_CODE_JP && CFG_region != LMIC_REGION_as923
37
# error "If country code is JP, then region must be AS923"
38
#endif
39
40
// check for internal consistency
41
#if !(CFG_LMIC_EU_like || CFG_LMIC_US_like)
42
# error "Internal error: Neither EU-like nor US-like!"
43
#endif
44
45
// This is the SX1272/SX1273 radio, which is also used on the HopeRF
46
// RFM92 boards.
47
//#define CFG_sx1272_radio 1
48
// This is the SX1276/SX1277/SX1278/SX1279 radio, which is also used on
49
// the HopeRF RFM95 boards.
50
//#define CFG_sx1276_radio 1
51
52
// ensure that a radio is defined.
53
#if !(defined(CFG_sx1272_radio) || defined(CFG_sx1276_radio) || defined(CFG_sx1261_radio) || defined(CFG_sx1262_radio))
54
# warning Target radio not defined, assuming CFG_sx1276_radio
55
#define CFG_sx1276_radio 1
56
#elif defined(CFG_sx1272_radio) && (defined(CFG_sx1276_radio) || defined(CFG_sx1261_radio) || defined(CFG_sx1262_radio))
57
# error You can define at most one target radio
58
#elif defined(CFG_sx1276_radio) && (defined(CFG_sx1261_radio) || defined(CFG_sx1262_radio))
59
# error You can define at most one target radio
60
#elif defined(CFG_sx1261_radio) && (defined(CFG_sx1261_radio))
61
# error You can define at most one target radio
62
#endif
63
64
// LMIC requires ticks to be 15.5μs - 100 μs long
65
#ifndef OSTICKS_PER_SEC
66
// 16 μs per tick
67
# ifndef US_PER_OSTICK_EXPONENT
68
# define US_PER_OSTICK_EXPONENT 4
69
# endif
70
# define US_PER_OSTICK (1 << US_PER_OSTICK_EXPONENT)
71
# define OSTICKS_PER_SEC (1000000 / US_PER_OSTICK)
72
#endif
/* OSTICKS_PER_SEC */
73
74
#if ! (10000 <= OSTICKS_PER_SEC && OSTICKS_PER_SEC < 64516)
75
# error LMIC requires ticks to be 15.5 us to 100 us long
76
#endif
77
78
// Change the SPI clock speed if you encounter errors
79
// communicating with the radio.
80
// The standard range is 125kHz-8MHz, but some boards can go faster.
81
#ifndef LMIC_SPI_FREQ
82
#define LMIC_SPI_FREQ 1E6
83
#endif
84
85
// Set this to 1 to enable some basic debug output (using printf) about
86
// RF settings used during transmission and reception. Set to 2 to
87
// enable more verbose output. Make sure that printf is actually
88
// configured (e.g. on AVR it is not by default), otherwise using it can
89
// cause crashing.
90
#ifndef LMIC_DEBUG_LEVEL
91
#define LMIC_DEBUG_LEVEL 0
92
#endif
93
94
// Enable this to allow using printf() to print to the given serial port
95
// (or any other Print object). This can be easy for debugging. The
96
// current implementation only works on AVR, though.
97
//#define LMIC_PRINTF_TO Serial
98
99
// Enable this to use interrupt handler routines listening for RISING signals.
100
// Otherwise, the library polls digital input lines for changes.
101
//#define LMIC_USE_INTERRUPTS
102
103
// If DISABLE_LMIC_FAILURE_TO is defined, runtime assertion failures
104
// silently halt execution. Otherwise, LMIC_FAILURE_TO should be defined
105
// as the name of an object derived from Print, which will be used for
106
// displaying runtime assertion failures. If you say nothing in your
107
// lmic_project_config.h, runtime assertion failures are displayed
108
// using the Serial object.
109
#if ! defined(DISABLE_LMIC_FAILURE_TO) && ! defined(LMIC_FAILURE_TO)
110
#define LMIC_FAILURE_TO Serial
111
#endif
112
113
// define this in lmic_project_config.h to disable all code related to joining
114
//#define DISABLE_JOIN
115
// define this in lmic_project_config.h to disable all code related to ping
116
//#define DISABLE_PING
117
// define this in lmic_project_config.h to disable all code related to beacon tracking.
118
// Requires ping to be disabled too
119
//#define DISABLE_BEACONS
120
121
// define these in lmic_project_config.h to disable the corresponding MAC commands.
122
// Class A
123
//#define DISABLE_MCMD_DutyCycleReq // duty cycle cap
124
//#define DISABLE_MCMD_RXParamSetupReq // 2nd DN window param
125
//#define DISABLE_MCMD_NewChannelReq // set new channel
126
//#define DISABLE_MCMD_DlChannelReq // set downlink channel for RX1 for given uplink channel.
127
//#define DISABLE_MCMD_RXTimingSetupReq // delay between TX and RX
128
// Class B
129
//#define DISABLE_MCMD_PingSlotChannelReq // set ping freq, automatically disabled by DISABLE_PING
130
//#define ENABLE_MCMD_BeaconTimingAns // next beacon start, DEPRECATED, normally disabled by DISABLE_BEACON
131
132
// DEPRECATED(tmm@mcci.com); replaced by LMIC.noRXIQinversion (dynamic). Don't define this.
133
//#define DISABLE_INVERT_IQ_ON_RX
134
135
// This allows choosing between multiple included AES implementations.
136
// Make sure exactly one of these is uncommented.
137
//
138
// This selects the original AES implementation included LMIC. This
139
// implementation is optimized for speed on 32-bit processors using
140
// fairly big lookup tables, but it takes up big amounts of flash on the
141
// AVR architecture.
142
// #define USE_ORIGINAL_AES
143
//
144
// This selects the AES implementation written by Ideetroon for their
145
// own LoRaWAN library. It also uses lookup tables, but smaller
146
// byte-oriented ones, making it use a lot less flash space (but it is
147
// also about twice as slow as the original).
148
// #define USE_IDEETRON_AES
149
150
#if ! (defined(USE_ORIGINAL_AES) || defined(USE_IDEETRON_AES))
151
# define USE_IDEETRON_AES
152
#endif
153
154
#if defined(USE_ORIGINAL_AES) && defined(USE_IDEETRON_AES)
155
# error "You may define at most one of USE_ORIGINAL_AES and USE_IDEETRON_AES"
156
#endif
157
158
// LMIC_DISABLE_DR_LEGACY
159
// turn off legacy DR_* symbols that vary by bandplan.
160
// Older code uses these for configuration. EU868_DR_*, US915_DR_*
161
// etc symbols are prefered, but breaking older code is inconvenient for
162
// everybody. We don't want to use DR_* in the LMIC itself, so we provide
163
// this #define to allow them to be removed.
164
#if !defined(LMIC_DR_LEGACY)
165
# if !defined(LMIC_DISABLE_DR_LEGACY)
166
# define LMIC_DR_LEGACY 1
167
# else
// defined(LMIC_DISABLE_DR_LEGACY)
168
# define LMIC_DR_LEGACY 0
169
# endif
// defined(LMIC_DISABLE_DR_LEGACY)
170
#endif
// LMIC_DR_LEGACY
171
172
// LMIC_ENABLE_DeviceTimeReq
173
// enable support for MCMD_DeviceTimeReq and MCMD_DeviceTimeAns
174
// this is always defined, and non-zero to enable it.
175
#if !defined(LMIC_ENABLE_DeviceTimeReq)
176
# define LMIC_ENABLE_DeviceTimeReq 1
177
#endif
178
179
// LMIC_ENABLE_user_events
180
// Enable/disable support for programmable callbacks for events, rx, and tx.
181
// This is always defined, and non-zero to enable. Default is enabled.
182
#if !defined(LMIC_ENABLE_user_events)
183
# define LMIC_ENABLE_user_events 1
184
#endif
185
186
// LMIC_ENABLE_onEvent
187
// Enable/disable support for out-call to user-supplied `onEvent()` function.
188
// This is always defined, and non-zero to enable. Default is enabled.
189
#if !defined(LMIC_ENABLE_onEvent)
190
# define LMIC_ENABLE_onEvent 1
191
#endif
192
193
// LMIC_ENABLE_long_messages
194
// LMIC certification requires full-length 255 frames, but to save RAM,
195
// a shorter maximum can be set. This controls both RX and TX buffers,
196
// so reducing this by 1 saves 2 bytes of RAM.
197
#if defined(LMIC_ENABLE_long_messages) && defined(LMIC_MAX_FRAME_LENGTH)
198
#error "Use only one of LMIC_ENABLE_long_messages or LMIC_MAX_FRAME_LENGTH"
199
#elif defined(LMIC_ENABLE_long_messages) && LMIC_ENABLE_long_messages == 0
200
# define LMIC_MAX_FRAME_LENGTH 64
201
#elif !defined(LMIC_MAX_FRAME_LENGTH)
202
# define LMIC_MAX_FRAME_LENGTH 255
203
#elif LMIC_MAX_FRAME_LENGTH > 255
204
#error "LMIC_MAX_FRAME_LENGTH cannot be larger than 255"
205
#endif
206
207
// LMIC_ENABLE_event_logging
208
// LMIC debugging for certification tests requires this, because debug prints affect
209
// timing too dramatically. But normal operation doesn't need this.
210
#if !defined(LMIC_ENABLE_event_logging)
211
# define LMIC_ENABLE_event_logging 0
/* PARAM */
212
#endif
213
214
// LMIC_LORAWAN_SPEC_VERSION
215
#if !defined(LMIC_LORAWAN_SPEC_VERSION)
216
# define LMIC_LORAWAN_SPEC_VERSION LMIC_LORAWAN_SPEC_VERSION_1_0_3
217
#endif
218
219
// LMIC_ENABLE_arbitrary_clock_error
220
// We normally don't want to allow users to set wide clock errors, because
221
// we assume reasonably-disciplined os_getTime() values. But... there might
222
// be platforms that require wider errors.
223
#if !defined(LMIC_ENABLE_arbitrary_clock_error)
224
# define LMIC_ENABLE_arbitrary_clock_error 0
/* PARAM */
225
#endif
226
227
// LMIC_ENABLE_class_c
228
// Define this non-zero to include Class C support in the code.
229
#if !defined(LMIC_ENABLE_class_c)
230
# define LMIC_ENABLE_class_c 0
/* PARAM */
231
#endif
232
233
#endif
// _lmic_config_h_
src
lmic
config.h
Generated on
for Arduino LMIC by
1.16.1