Loading...
Searching...
No Matches
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 "modules.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
38#ifndef LORA_FREQUENCY_RESOLUTION_NANOHERTZ_DEFAULT
44#define LORA_FREQUENCY_RESOLUTION_NANOHERTZ_DEFAULT 61035156250
45#endif
46
58#ifndef CONFIG_LORA_PREAMBLE_LENGTH_DEFAULT
59#define CONFIG_LORA_PREAMBLE_LENGTH_DEFAULT (8U)
60#endif
61
67#ifndef CONFIG_LORA_SYMBOL_TIMEOUT_DEFAULT
68#define CONFIG_LORA_SYMBOL_TIMEOUT_DEFAULT (10U)
69#endif
70
76#if IS_ACTIVE(CONFIG_LORA_BW_DEFAULT_125)
77#define CONFIG_LORA_BW_DEFAULT (LORA_BW_125_KHZ)
78#elif IS_ACTIVE(CONFIG_LORA_BW_DEFAULT_250)
79#define CONFIG_LORA_BW_DEFAULT (LORA_BW_250_KHZ)
80#elif IS_ACTIVE(CONFIG_LORA_BW_DEFAULT_500)
81#define CONFIG_LORA_BW_DEFAULT (LORA_BW_500_KHZ)
82#elif IS_ACTIVE(CONFIG_LORA_BW_DEFAULT_200)
83#define CONFIG_LORA_BW_DEFAULT (LORA_BW_200_KHZ)
84#elif IS_ACTIVE(CONFIG_LORA_BW_DEFAULT_400)
85#define CONFIG_LORA_BW_DEFAULT (LORA_BW_400_KHZ)
86#elif IS_ACTIVE(CONFIG_LORA_BW_DEFAULT_800)
87#define CONFIG_LORA_BW_DEFAULT (LORA_BW_800_KHZ)
88#elif IS_ACTIVE(CONFIG_LORA_BW_DEFAULT_1600)
89#define CONFIG_LORA_BW_DEFAULT (LORA_BW_1600_KHZ)
90#endif
91
92#ifndef CONFIG_LORA_BW_DEFAULT
93#define CONFIG_LORA_BW_DEFAULT (LORA_BW_125_KHZ)
94#endif
95
106#if IS_ACTIVE(CONFIG_LORA_SF_DEFAULT_SF6)
107#define CONFIG_LORA_SF_DEFAULT (LORA_SF6)
108#elif IS_ACTIVE(CONFIG_LORA_SF_DEFAULT_SF7)
109#define CONFIG_LORA_SF_DEFAULT (LORA_SF7)
110#elif IS_ACTIVE(CONFIG_LORA_SF_DEFAULT_SF8)
111#define CONFIG_LORA_SF_DEFAULT (LORA_SF8)
112#elif IS_ACTIVE(CONFIG_LORA_SF_DEFAULT_SF9)
113#define CONFIG_LORA_SF_DEFAULT (LORA_SF9)
114#elif IS_ACTIVE(CONFIG_LORA_SF_DEFAULT_SF10)
115#define CONFIG_LORA_SF_DEFAULT (LORA_SF10)
116#elif IS_ACTIVE(CONFIG_LORA_SF_DEFAULT_SF11)
117#define CONFIG_LORA_SF_DEFAULT (LORA_SF11)
118#elif IS_ACTIVE(CONFIG_LORA_SF_DEFAULT_SF12)
119#define CONFIG_LORA_SF_DEFAULT (LORA_SF12)
120#endif
121
122#ifndef CONFIG_LORA_SF_DEFAULT
123#define CONFIG_LORA_SF_DEFAULT (LORA_SF7)
124#endif
125
138#if IS_ACTIVE(CONFIG_LORA_CR_DEFAULT_CR_4_5)
139#define CONFIG_LORA_CR_DEFAULT (LORA_CR_4_5)
140#elif IS_ACTIVE(CONFIG_LORA_CR_DEFAULT_CR_4_6)
141#define CONFIG_LORA_CR_DEFAULT (LORA_CR_4_6)
142#elif IS_ACTIVE(CONFIG_LORA_CR_DEFAULT_CR_4_7)
143#define CONFIG_LORA_CR_DEFAULT (LORA_CR_4_7)
144#elif IS_ACTIVE(CONFIG_LORA_CR_DEFAULT_CR_4_8)
145#define CONFIG_LORA_CR_DEFAULT (LORA_CR_4_8)
146#elif IS_ACTIVE(CONFIG_LORA_CR_DEFAULT_CR_LI_4_5)
147#define CONFIG_LORA_CR_DEFAULT (LORA_CR_LI_4_5)
148#elif IS_ACTIVE(CONFIG_LORA_CR_DEFAULT_CR_LI_4_6)
149#define CONFIG_LORA_CR_DEFAULT (LORA_CR_LI_4_6)
150#elif IS_ACTIVE(CONFIG_LORA_CR_DEFAULT_CR_LI_4_8)
151#define CONFIG_LORA_CR_DEFAULT (LORA_CR_LI_4_8)
152#endif
153
154#ifndef CONFIG_LORA_CR_DEFAULT
155#define CONFIG_LORA_CR_DEFAULT (LORA_CR_4_5)
156#endif
157
163#ifdef DOXYGEN
164#define CONFIG_LORA_IQ_INVERTED_DEFAULT
165#endif
166
173#ifdef DOXYGEN
174#define CONFIG_LORA_FREQUENCY_HOPPING_DEFAULT
175#endif
176
183#ifndef CONFIG_LORA_FREQUENCY_HOPPING_PERIOD_DEFAULT
184#define CONFIG_LORA_FREQUENCY_HOPPING_PERIOD_DEFAULT (0U)
185#endif
186
194#ifdef DOXYGEN
195#define CONFIG_LORA_FIXED_HEADER_LEN_MODE_DEFAULT
196#endif
197
201#ifdef DOXYGEN
202#define CONFIG_LORA_PAYLOAD_CRC_OFF_DEFAULT
203#endif
204
211#ifndef CONFIG_LORA_PAYLOAD_LENGTH_DEFAULT
212#define CONFIG_LORA_PAYLOAD_LENGTH_DEFAULT (0U)
213#endif
220#define LORA_SYNCWORD_PUBLIC (0x34)
221#define LORA_SYNCWORD_PRIVATE (0x12)
222/* see https://lora-developers.semtech.com/documentation/tech-papers-and-guides/physical-layer-proposal-2.4ghz */
223#define LORA_SYNCWORD_ISM2400_PUBLIC (0x21)
232#define LORA_ISM2400_FREQUENCY_LOW 2400000000
233#define LORA_ISM2400_FREQUENCY_HIGH 2500000000
243enum {
251};
252
256enum {
264 LORA_SF12
266
270enum {
281#ifdef __cplusplus
282}
283#endif
284
285#endif /* NET_LORA_H */
@ LORA_SF7
spreading factor 7
Definition lora.h:259
@ LORA_SF6
spreading factor 6
Definition lora.h:258
@ LORA_SF10
spreading factor 10
Definition lora.h:262
@ LORA_SF12
spreading factor 12
Definition lora.h:264
@ LORA_SF11
spreading factor 11
Definition lora.h:263
@ LORA_SF8
spreading factor 8
Definition lora.h:260
@ LORA_SF5
spreading factor 5, sx126x and sx1280
Definition lora.h:257
@ LORA_SF9
spreading factor 9
Definition lora.h:261
@ LORA_BW_125_KHZ
125 kHz bandwidth
Definition lora.h:244
@ LORA_BW_400_KHZ
400 kHz bandwidth, only 2.4Ghz
Definition lora.h:248
@ LORA_BW_200_KHZ
200 kHz bandwidth, only 2.4Ghz
Definition lora.h:247
@ LORA_BW_1600_KHZ
1600 kHz bandwidth, only 2.4Ghz
Definition lora.h:250
@ LORA_BW_800_KHZ
800 kHz bandwidth, only 2.4Ghz
Definition lora.h:249
@ LORA_BW_250_KHZ
250 kHz bandwidth
Definition lora.h:245
@ LORA_BW_500_KHZ
500 kHz bandwidth
Definition lora.h:246
@ LORA_CR_LI_4_6
coding rate long interleaving 4/6
Definition lora.h:276
@ LORA_CR_4_6
coding rate 4/6
Definition lora.h:272
@ LORA_CR_4_7
coding rate 4/7
Definition lora.h:273
@ LORA_CR_4_5
coding rate 4/5
Definition lora.h:271
@ LORA_CR_LI_4_8
coding rate long interleaving 4/8
Definition lora.h:277
@ LORA_CR_4_8
coding rate 4/8
Definition lora.h:274
@ LORA_CR_LI_4_5
coding rate long interleaving 4/5
Definition lora.h:275
Common macros and compiler attributes/pragmas configuration.