lora.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Inria
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #ifndef NET_LORA_H
22 #define NET_LORA_H
23 
24 #include <stdint.h>
25 #include <stdlib.h>
26 
27 #include "kernel_defines.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
39 #ifndef LORA_FREQUENCY_RESOLUTION_DEFAULT
40 #define LORA_FREQUENCY_RESOLUTION_DEFAULT (61.03515625)
41 #endif
42 
54 #ifndef CONFIG_LORA_PREAMBLE_LENGTH_DEFAULT
55 #define CONFIG_LORA_PREAMBLE_LENGTH_DEFAULT (8U)
56 #endif
57 
63 #ifndef CONFIG_LORA_SYMBOL_TIMEOUT_DEFAULT
64 #define CONFIG_LORA_SYMBOL_TIMEOUT_DEFAULT (10U)
65 #endif
66 
72 #if IS_ACTIVE(CONFIG_LORA_BW_DEFAULT_125)
73 #define CONFIG_LORA_BW_DEFAULT (LORA_BW_125_KHZ)
74 #elif IS_ACTIVE(CONFIG_LORA_BW_DEFAULT_250)
75 #define CONFIG_LORA_BW_DEFAULT (LORA_BW_250_KHZ)
76 #elif IS_ACTIVE(CONFIG_LORA_BW_DEFAULT_500)
77 #define CONFIG_LORA_BW_DEFAULT (LORA_BW_500_KHZ)
78 #endif
79 
80 #ifndef CONFIG_LORA_BW_DEFAULT
81 #define CONFIG_LORA_BW_DEFAULT (LORA_BW_125_KHZ)
82 #endif
83 
94 #if IS_ACTIVE(CONFIG_LORA_SF_DEFAULT_SF6)
95 #define CONFIG_LORA_SF_DEFAULT (LORA_SF6)
96 #elif IS_ACTIVE(CONFIG_LORA_SF_DEFAULT_SF7)
97 #define CONFIG_LORA_SF_DEFAULT (LORA_SF7)
98 #elif IS_ACTIVE(CONFIG_LORA_SF_DEFAULT_SF8)
99 #define CONFIG_LORA_SF_DEFAULT (LORA_SF8)
100 #elif IS_ACTIVE(CONFIG_LORA_SF_DEFAULT_SF9)
101 #define CONFIG_LORA_SF_DEFAULT (LORA_SF9)
102 #elif IS_ACTIVE(CONFIG_LORA_SF_DEFAULT_SF10)
103 #define CONFIG_LORA_SF_DEFAULT (LORA_SF10)
104 #elif IS_ACTIVE(CONFIG_LORA_SF_DEFAULT_SF11)
105 #define CONFIG_LORA_SF_DEFAULT (LORA_SF11)
106 #elif IS_ACTIVE(CONFIG_LORA_SF_DEFAULT_SF12)
107 #define CONFIG_LORA_SF_DEFAULT (LORA_SF12)
108 #endif
109 
110 #ifndef CONFIG_LORA_SF_DEFAULT
111 #define CONFIG_LORA_SF_DEFAULT (LORA_SF7)
112 #endif
113 
126 #if IS_ACTIVE(CONFIG_LORA_CR_DEFAULT_CR_4_5)
127 #define CONFIG_LORA_CR_DEFAULT (LORA_CR_4_5)
128 #elif IS_ACTIVE(CONFIG_LORA_CR_DEFAULT_CR_4_6)
129 #define CONFIG_LORA_CR_DEFAULT (LORA_CR_4_6)
130 #elif IS_ACTIVE(CONFIG_LORA_CR_DEFAULT_CR_4_7)
131 #define CONFIG_LORA_CR_DEFAULT (LORA_CR_4_7)
132 #elif IS_ACTIVE(CONFIG_LORA_CR_DEFAULT_CR_4_8)
133 #define CONFIG_LORA_CR_DEFAULT (LORA_CR_4_8)
134 #endif
135 
136 #ifndef CONFIG_LORA_CR_DEFAULT
137 #define CONFIG_LORA_CR_DEFAULT (LORA_CR_4_5)
138 #endif
139 
145 #ifdef DOXYGEN
146 #define CONFIG_LORA_IQ_INVERTED_DEFAULT
147 #endif
148 
155 #ifdef DOXYGEN
156 #define CONFIG_LORA_FREQUENCY_HOPPING_DEFAULT
157 #endif
158 
165 #ifndef CONFIG_LORA_FREQUENCY_HOPPING_PERIOD_DEFAULT
166 #define CONFIG_LORA_FREQUENCY_HOPPING_PERIOD_DEFAULT (0U)
167 #endif
168 
176 #ifdef DOXYGEN
177 #define CONFIG_LORA_FIXED_HEADER_LEN_MODE_DEFAULT
178 #endif
179 
185 #ifndef LORA_PAYLOAD_CRC_ON_DEFAULT
186 #if IS_ACTIVE(CONFIG_LORA_PAYLOAD_CRC_OFF_DEFAULT)
187 #define LORA_PAYLOAD_CRC_ON_DEFAULT (false)
188 #else
189 #define LORA_PAYLOAD_CRC_ON_DEFAULT (true)
190 #endif
191 #endif
192 
199 #ifndef CONFIG_LORA_PAYLOAD_LENGTH_DEFAULT
200 #define CONFIG_LORA_PAYLOAD_LENGTH_DEFAULT (0U)
201 #endif
202 
208 #define LORA_SYNCWORD_PUBLIC (0x34)
209 #define LORA_SYNCWORD_PRIVATE (0x12)
219 enum {
223 };
224 
228 enum {
229  LORA_SF6 = 6,
236 };
237 
241 enum {
246 };
249 #ifdef __cplusplus
250 }
251 #endif
252 
253 #endif /* NET_LORA_H */
254 
LORA_SF10
@ LORA_SF10
spreading factor 10
Definition: lora.h:233
kernel_defines.h
Common macros and compiler attributes/pragmas configuration.
LORA_CR_4_5
@ LORA_CR_4_5
coding rate 4/5
Definition: lora.h:242
LORA_SF11
@ LORA_SF11
spreading factor 11
Definition: lora.h:234
LORA_CR_4_8
@ LORA_CR_4_8
coding rate 4/8
Definition: lora.h:245
LORA_BW_250_KHZ
@ LORA_BW_250_KHZ
250 kHz bandwidth
Definition: lora.h:221
LORA_BW_125_KHZ
@ LORA_BW_125_KHZ
125 kHz bandwidth
Definition: lora.h:220
LORA_SF7
@ LORA_SF7
spreading factor 7
Definition: lora.h:230
LORA_SF8
@ LORA_SF8
spreading factor 8
Definition: lora.h:231
LORA_CR_4_6
@ LORA_CR_4_6
coding rate 4/6
Definition: lora.h:243
LORA_CR_4_7
@ LORA_CR_4_7
coding rate 4/7
Definition: lora.h:244
LORA_SF6
@ LORA_SF6
spreading factor 6
Definition: lora.h:229
LORA_SF12
@ LORA_SF12
spreading factor 12
Definition: lora.h:235
LORA_BW_500_KHZ
@ LORA_BW_500_KHZ
500 kHz bandwidth
Definition: lora.h:222
LORA_SF9
@ LORA_SF9
spreading factor 9
Definition: lora.h:232