loramac.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2017 Inria
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
21 #include <assert.h>
22 #include <stdint.h>
23 #include <stdlib.h>
24 
25 #include "modules.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
41 #ifndef CONFIG_LORAMAC_DEV_EUI_DEFAULT
42 #define CONFIG_LORAMAC_DEV_EUI_DEFAULT "0000000000000000"
43 #endif
44 
50 #ifndef CONFIG_LORAMAC_JOIN_EUI_DEFAULT
51 #define CONFIG_LORAMAC_JOIN_EUI_DEFAULT "0000000000000000"
52 #endif
53 
59 #ifndef CONFIG_LORAMAC_APP_EUI_DEFAULT
60 #define CONFIG_LORAMAC_APP_EUI_DEFAULT "0000000000000000"
61 #endif
62 
68 #ifndef CONFIG_LORAMAC_APP_KEY_DEFAULT
69 #define CONFIG_LORAMAC_APP_KEY_DEFAULT "00000000000000000000000000000000"
70 #endif
71 
77 #ifndef CONFIG_LORAMAC_NWK_KEY_DEFAULT
78 #define CONFIG_LORAMAC_NWK_KEY_DEFAULT "00000000000000000000000000000000"
79 #endif
80 
86 #ifndef CONFIG_LORAMAC_APP_SKEY_DEFAULT
87 #define CONFIG_LORAMAC_APP_SKEY_DEFAULT "00000000000000000000000000000000"
88 #endif
89 
95 #ifndef CONFIG_LORAMAC_NWK_SKEY_DEFAULT
96 #define CONFIG_LORAMAC_NWK_SKEY_DEFAULT "00000000000000000000000000000000"
97 #endif
98 
104 #ifndef CONFIG_LORAMAC_FNWKSINT_KEY_DEFAULT
105 #define CONFIG_LORAMAC_FNWKSINT_KEY_DEFAULT "00000000000000000000000000000000"
106 #endif
107 
113 #ifndef CONFIG_LORAMAC_SNWKSINT_KEY_DEFAULT
114 #define CONFIG_LORAMAC_SNWKSINT_KEY_DEFAULT "00000000000000000000000000000000"
115 #endif
116 
122 #ifndef CONFIG_LORAMAC_NWKSENC_KEY_DEFAULT
123 #define CONFIG_LORAMAC_NWKSENC_KEY_DEFAULT "00000000000000000000000000000000"
124 #endif
125 
129 #ifndef CONFIG_LORAMAC_DEV_ADDR_DEFAULT
130 #define CONFIG_LORAMAC_DEV_ADDR_DEFAULT "00000000"
131 #endif
132 
136 #if !IS_ACTIVE(CONFIG_LORAMAC_REGION_EU_868) \
137  && !IS_ACTIVE(CONFIG_LORAMAC_REGION_IN_865)
138 #define CONFIG_LORAMAC_REGION_EU_868 1
139 #endif
140 
153 #if IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DEVICE_CLASS_A)
154 #define CONFIG_LORAMAC_DEFAULT_DEVICE_CLASS (LORAMAC_CLASS_A)
155 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DEVICE_CLASS_B)
156 #define CONFIG_LORAMAC_DEFAULT_DEVICE_CLASS (LORAMAC_CLASS_B)
157 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DEVICE_CLASS_C)
158 #define CONFIG_LORAMAC_DEFAULT_DEVICE_CLASS (LORAMAC_CLASS_C)
159 #endif
160 
161 #ifndef CONFIG_LORAMAC_DEFAULT_DEVICE_CLASS
162 #define CONFIG_LORAMAC_DEFAULT_DEVICE_CLASS (LORAMAC_CLASS_A)
163 #endif
164 
173 #ifndef CONFIG_LORAMAC_DEFAULT_NETID
174 #define CONFIG_LORAMAC_DEFAULT_NETID (1U)
175 #endif
176 
185 #ifdef DOXYGEN
186 #define CONFIG_LORAMAC_DEFAULT_PRIVATE_NETWORK
187 #endif
188 
198 #if IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_0)
199 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_0)
200 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_1)
201 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_1)
202 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_2)
203 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_2)
204 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_3)
205 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_3)
206 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_4)
207 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_4)
208 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_5)
209 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_5)
210 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_6)
211 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_6)
212 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_7)
213 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_7)
214 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_8)
215 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_8)
216 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_9)
217 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_9)
218 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_10)
219 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_10)
220 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_11)
221 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_11)
222 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_12)
223 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_12)
224 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_13)
225 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_13)
226 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_14)
227 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_14)
228 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_DR_15)
229 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_15)
230 #endif
231 
232 #ifndef CONFIG_LORAMAC_DEFAULT_DR
233 #define CONFIG_LORAMAC_DEFAULT_DR (LORAMAC_DR_0)
234 #endif
235 
242 #if IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_0)
243 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_0)
244 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_1)
245 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_1)
246 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_2)
247 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_2)
248 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_3)
249 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_3)
250 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_4)
251 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_4)
252 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_5)
253 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_5)
254 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_6)
255 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_6)
256 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_7)
257 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_7)
258 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_8)
259 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_8)
260 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_9)
261 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_9)
262 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_10)
263 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_10)
264 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_11)
265 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_11)
266 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_12)
267 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_12)
268 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_13)
269 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_13)
270 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_14)
271 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_14)
272 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_POWER_15)
273 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_15)
274 #endif
275 
276 #ifndef CONFIG_LORAMAC_DEFAULT_TX_POWER
277 #define CONFIG_LORAMAC_DEFAULT_TX_POWER (LORAMAC_TX_PWR_1)
278 #endif
279 
289 #ifndef CONFIG_LORAMAC_DEFAULT_TX_PORT
290 #define CONFIG_LORAMAC_DEFAULT_TX_PORT (2U)
291 #endif
292 
301 #if IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_MODE_CNF)
302 #define CONFIG_LORAMAC_DEFAULT_TX_MODE (LORAMAC_TX_CNF)
303 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_TX_MODE_UNCNF)
304 #define CONFIG_LORAMAC_DEFAULT_TX_MODE (LORAMAC_TX_UNCNF)
305 #endif
306 
307 #ifndef CONFIG_LORAMAC_DEFAULT_TX_MODE
308 #define CONFIG_LORAMAC_DEFAULT_TX_MODE (LORAMAC_TX_CNF)
309 #endif
310 
322 #ifndef CONFIG_LORAMAC_DEFAULT_REDUNDANCY
323 #define CONFIG_LORAMAC_DEFAULT_REDUNDANCY (0U)
324 #endif
325 
334 #ifdef DOXYGEN
335 #define CONFIG_LORAMAC_DEFAULT_ADR
336 #endif
337 
344 #ifndef CONFIG_LORAMAC_DEFAULT_RETX
345 #define CONFIG_LORAMAC_DEFAULT_RETX (5U)
346 #endif
347 
356 #ifndef CONFIG_LORAMAC_DEFAULT_LINKCHK
357 #define CONFIG_LORAMAC_DEFAULT_LINKCHK (0U)
358 #endif
359 
366 #ifndef CONFIG_LORAMAC_DEFAULT_RX1_DELAY
367 #define CONFIG_LORAMAC_DEFAULT_RX1_DELAY (1000U)
368 #endif
369 
376 #if IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_0)
377 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_0)
378 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_1)
379 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_1)
380 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_2)
381 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_2)
382 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_3)
383 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_3)
384 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_4)
385 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_4)
386 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_5)
387 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_5)
388 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_6)
389 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_6)
390 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_7)
391 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_7)
392 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_8)
393 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_8)
394 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_9)
395 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_9)
396 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_10)
397 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_10)
398 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_11)
399 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_11)
400 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_12)
401 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_12)
402 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_13)
403 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_13)
404 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_14)
405 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_14)
406 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_RX2_DR_15)
407 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_15)
408 #endif
409 
410 #ifndef CONFIG_LORAMAC_DEFAULT_RX2_DR
411 #if IS_ACTIVE(CONFIG_LORAMAC_REGION_EU_868)
412 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_0)
413 #elif IS_ACTIVE(CONFIG_LORAMAC_REGION_IN_865)
414 #define CONFIG_LORAMAC_DEFAULT_RX2_DR (LORAMAC_DR_2)
415 #endif
416 #endif
417 
421 #ifndef CONFIG_LORAMAC_DEFAULT_RX2_FREQ
422 #if IS_ACTIVE(CONFIG_LORAMAC_REGION_EU_868)
423 #define CONFIG_LORAMAC_DEFAULT_RX2_FREQ (869525000UL)
424 #elif IS_ACTIVE(CONFIG_LORAMAC_REGION_IN_865)
425 #define CONFIG_LORAMAC_DEFAULT_RX2_FREQ (866550000UL)
426 #endif
427 #endif
428 
439 #if IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_JOIN_PROCEDURE_OTAA)
440 #define CONFIG_LORAMAC_DEFAULT_JOIN_PROCEDURE (LORAMAC_JOIN_OTAA)
441 #elif IS_ACTIVE(CONFIG_LORAMAC_DEFAULT_JOIN_PROCEDURE_ABP)
442 #define CONFIG_LORAMAC_DEFAULT_JOIN_PROCEDURE (LORAMAC_JOIN_ABP)
443 #endif
444 
445 #ifndef CONFIG_LORAMAC_DEFAULT_JOIN_PROCEDURE
446 #define CONFIG_LORAMAC_DEFAULT_JOIN_PROCEDURE (LORAMAC_JOIN_OTAA)
447 #endif
448 
456 #ifndef CONFIG_LORAMAC_DEFAULT_JOIN_DELAY1
457 #define CONFIG_LORAMAC_DEFAULT_JOIN_DELAY1 (5U)
458 #endif
459 
467 #ifndef CONFIG_LORAMAC_DEFAULT_JOIN_DELAY2
468 #define CONFIG_LORAMAC_DEFAULT_JOIN_DELAY2 (6U)
469 #endif
470 
477 #ifndef CONFIG_LORAMAC_DEFAULT_MAX_FCNT_GAP
478 #define CONFIG_LORAMAC_DEFAULT_MAX_FCNT_GAP (16384U)
479 #endif
480 
488 #ifndef CONFIG_LORAMAC_DEFAULT_SYSTEM_MAX_RX_ERROR
489 #define CONFIG_LORAMAC_DEFAULT_SYSTEM_MAX_RX_ERROR (50)
490 #endif
491 
500 #ifndef CONFIG_LORAMAC_DEFAULT_MIN_RX_SYMBOLS
501 #define CONFIG_LORAMAC_DEFAULT_MIN_RX_SYMBOLS (12)
502 #endif
512 #ifndef LORAMAC_DEFAULT_ADR_ACK_LIMIT
513 #define LORAMAC_DEFAULT_ADR_ACK_LIMIT (64U)
514 #endif
515 
521 #ifndef LORAMAC_DEFAULT_ADR_ACK_DELAY
522 #define LORAMAC_DEFAULT_ADR_ACK_DELAY (32U)
523 #endif
524 
530 #ifndef LORAMAC_DEFAULT_ADR_TIMEOUT
531 #define LORAMAC_DEFAULT_ADR_TIMEOUT (3U)
532 #endif
533 
537 #define LORAMAC_DEFAULT_RX2_DELAY (1000U + CONFIG_LORAMAC_DEFAULT_RX1_DELAY)
538 
546 #define LORAMAC_DEVEUI_LEN (8U)
547 
551 #define LORAMAC_DEVADDR_LEN (4U)
552 
556 #define LORAMAC_APPEUI_LEN (8U)
557 
561 #define LORAMAC_JOINEUI_LEN (8U)
562 
566 #define LORAMAC_APPKEY_LEN (16U)
567 
571 #define LORAMAC_NWKKEY_LEN (16U)
572 
576 #define LORAMAC_APPSKEY_LEN (16U)
577 
581 #define LORAMAC_NWKSKEY_LEN (16U)
582 
586 #define LORAMAC_FNWKSINTKEY_LEN (16U)
587 
591 #define LORAMAC_SNWKSINTKEY_LEN (16U)
592 
596 #define LORAMAC_NWKSENCKEY_LEN (16U)
597 
601 #define LORAMAC_JSINTKEY_LEN (16U)
602 
606 #define LORAMAC_JSENCKEY_LEN (16U)
607 
611 #define LORAMAC_JSINTKEY_LEN (16U)
612 
616 #define LORAMAC_PORT_MIN (1U)
617 
621 #define LORAMAC_PORT_MAX (223U)
622 
626 #define LORAMAC_APP_NONCE_LEN (3U)
627 
631 #define LORAMAC_JOIN_NONCE_LEN (3U)
632 
636 #define LORAMAC_NETWORK_ID_LEN (3U)
637 
643 #if defined(REGION_AU915) || defined(REGION_CN470) || defined(REGION_US915) || defined(REGION_US915_HYBRID) || defined(REGION_AS923)
644 #define LORAMAC_CHANNELS_MASK_LEN (6U)
645 #else
646 #define LORAMAC_CHANNELS_MASK_LEN (1U)
647 #endif
648 
659 typedef enum {
664 
668 typedef enum {
672 
676 typedef enum {
680 
687 typedef enum {
867 
874 typedef enum {
1058  typedef struct {
1059  uint32_t freq;
1060  uint8_t index;
1061  uint8_t bw;
1062  uint8_t dr_min;
1063  uint8_t dr_max;
1064  uint8_t dcycle;
1066 
1078 static inline uint32_t lora_time_on_air(size_t pkt_len, loramac_dr_idx_t dr, uint8_t cr)
1079 {
1080  assert(dr <= LORAMAC_DR_6);
1081  const uint8_t _K[6][4] = {
1082  { 0, 1, 5, 5 }, /* DR0 */
1083  { 0, 1, 4, 5 }, /* DR1 */
1084  { 1, 5, 5, 5 }, /* DR2 */
1085  { 1, 4, 5, 4 }, /* DR3 */
1086  { 1, 3, 4, 4 }, /* DR4 */
1087  { 1, 2, 4, 3 } /* DR5 */
1088  };
1089 
1090  uint32_t t_sym = 1 << (15 - dr);
1091  uint32_t t_preamble = (t_sym << 3) + (t_sym << 2) + (t_sym >> 2);
1092 
1093  uint8_t index = (dr < LORAMAC_DR_6) ? dr : LORAMAC_DR_5;
1094  uint8_t n0 = _K[index][0];
1095  uint32_t nb_symbols;
1096 
1097  uint8_t offset = _K[index][1];
1098 
1099  if (pkt_len < offset) {
1100  nb_symbols = 8 + n0 * (cr + 4);
1101  }
1102  else {
1103  uint8_t c1 = _K[index][2];
1104  uint8_t c2 = _K[index][3];
1105  uint8_t pos = (pkt_len - offset) % (c1 + c2);
1106  uint8_t cycle = (pkt_len - offset) / (c1 + c2);
1107  nb_symbols = 8 + (n0 + 2 * cycle + 1 + (pos > (c1 - 1))) * (cr + 4);
1108  }
1109 
1110  uint32_t t_payload = t_sym * nb_symbols;
1111 
1112  return t_preamble + t_payload;
1113 }
1114 
1115 #ifdef __cplusplus
1116 }
1117 #endif
1118 
POSIX.1-2008 compliant version of the assert macro.
#define assert(cond)
abort the program if assertion is false
Definition: assert.h:143
loramac_join_mode_t
LoRaMAC network join procedure type.
Definition: loramac.h:668
loramac_tx_mode_t
LoRaMAC transmission mode.
Definition: loramac.h:676
loramac_dr_idx_t
LoRaMAC datarate indexes.
Definition: loramac.h:687
static uint32_t lora_time_on_air(size_t pkt_len, loramac_dr_idx_t dr, uint8_t cr)
Compute the time on air of a LoRa packet.
Definition: loramac.h:1078
loramac_class_t
Device class.
Definition: loramac.h:659
loramac_tx_pwr_idx_t
LoRaMAC transmission power indexes.
Definition: loramac.h:874
@ LORAMAC_JOIN_ABP
Activation by personnalization.
Definition: loramac.h:670
@ LORAMAC_JOIN_OTAA
Other-the-air activation.
Definition: loramac.h:669
@ LORAMAC_TX_CNF
Confirmable transmission mode.
Definition: loramac.h:677
@ LORAMAC_TX_UNCNF
Unconfirmable transmission mode.
Definition: loramac.h:678
@ LORAMAC_DR_14
Definition: loramac.h:854
@ LORAMAC_DR_3
Definition: loramac.h:733
@ LORAMAC_DR_8
Definition: loramac.h:788
@ LORAMAC_DR_2
Definition: loramac.h:722
@ LORAMAC_DR_1
Definition: loramac.h:711
@ LORAMAC_DR_9
Definition: loramac.h:799
@ LORAMAC_DR_11
Definition: loramac.h:821
@ LORAMAC_DR_6
Definition: loramac.h:766
@ LORAMAC_DR_15
Definition: loramac.h:865
@ LORAMAC_DR_4
Definition: loramac.h:744
@ LORAMAC_DR_12
Definition: loramac.h:832
@ LORAMAC_DR_13
Definition: loramac.h:843
@ LORAMAC_DR_7
Definition: loramac.h:777
@ LORAMAC_DR_10
Definition: loramac.h:810
@ LORAMAC_DR_5
Definition: loramac.h:755
@ LORAMAC_DR_0
Definition: loramac.h:700
@ LORAMAC_CLASS_C
Class C device.
Definition: loramac.h:662
@ LORAMAC_CLASS_B
Class B device.
Definition: loramac.h:661
@ LORAMAC_CLASS_A
Class A device.
Definition: loramac.h:660
@ LORAMAC_TX_PWR_6
Definition: loramac.h:953
@ LORAMAC_TX_PWR_15
Definition: loramac.h:1052
@ LORAMAC_TX_PWR_7
Definition: loramac.h:964
@ LORAMAC_TX_PWR_13
Definition: loramac.h:1030
@ LORAMAC_TX_PWR_2
Definition: loramac.h:909
@ LORAMAC_TX_PWR_1
Definition: loramac.h:898
@ LORAMAC_TX_PWR_11
Definition: loramac.h:1008
@ LORAMAC_TX_PWR_14
Definition: loramac.h:1041
@ LORAMAC_TX_PWR_3
Definition: loramac.h:920
@ LORAMAC_TX_PWR_9
Definition: loramac.h:986
@ LORAMAC_TX_PWR_0
Definition: loramac.h:885
@ LORAMAC_TX_PWR_10
Definition: loramac.h:997
@ LORAMAC_TX_PWR_5
Definition: loramac.h:942
@ LORAMAC_TX_PWR_8
Definition: loramac.h:975
@ LORAMAC_TX_PWR_12
Definition: loramac.h:1019
@ LORAMAC_TX_PWR_4
Definition: loramac.h:931
Common macros and compiler attributes/pragmas configuration.
A LoRaMAC network channel.
Definition: loramac.h:1058
uint8_t dr_max
Maximum datarate index.
Definition: loramac.h:1063
uint8_t index
Channel index in defined list.
Definition: loramac.h:1060
uint8_t bw
Bandwidth index.
Definition: loramac.h:1061
uint8_t dcycle
Duty cycle to use on this channel (1 to 100)
Definition: loramac.h:1064
uint32_t freq
Center frequency in Hz.
Definition: loramac.h:1059
uint8_t dr_min
Minimum datarate index.
Definition: loramac.h:1062