Arduino LMIC 6.0.1
Arduino LoRaWAN(r) MAC in C
Loading...
Searching...
No Matches
lmic_bandplan_in866.h
1/*
2* Copyright (c) 2014-2016 IBM Corporation.
3* Copyright (c) 2017, 2019-2021 MCCI Corporation.
4* All rights reserved.
5*
6* Redistribution and use in source and binary forms, with or without
7* modification, are permitted provided that the following conditions are met:
8* * Redistributions of source code must retain the above copyright
9* notice, this list of conditions and the following disclaimer.
10* * Redistributions in binary form must reproduce the above copyright
11* notice, this list of conditions and the following disclaimer in the
12* documentation and/or other materials provided with the distribution.
13* * Neither the name of the <organization> nor the
14* names of its contributors may be used to endorse or promote products
15* derived from this software without specific prior written permission.
16*
17* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20* DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
21* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
28
29#ifndef _lmic_bandplan_in866_h_
30# define _lmic_bandplan_in866_h_
31
32#ifndef _lmic_eu_like_h_
33# include "lmic_eu_like.h"
34#endif
35
36LMIC_BEGIN_DECLS
37
38// return maximum frame length (including PHY header) for this data rate (in866); 0 --> not valid dr.
39uint8_t LMICin866_maxFrameLen(uint8_t dr);
40// return maximum frame length (including PHY header) for this data rate; 0 --> not valid dr.
41#define LMICbandplan_maxFrameLen(dr) LMICin866_maxFrameLen(dr)
42
43int8_t LMICin866_pow2dBm(uint8_t mcmd_ladr_p1);
44#define pow2dBm(mcmd_ladr_p1) LMICin866_pow2dBm(mcmd_ladr_p1)
45
46// Times for half symbol per DR
47// Per DR table to minimize rounding errors
48ostime_t LMICin866_dr2hsym(uint8_t dr);
49#define dr2hsym(dr) LMICin866_dr2hsym(dr)
50
51static inline int
52LMICin866_isValidBeacon1(const uint8_t *d) {
53 return os_rlsbf2(&d[OFF_BCN_CRC1]) != os_crc16(d, OFF_BCN_CRC1);
54}
55
56#undef LMICbandplan_isValidBeacon1
57#define LMICbandplan_isValidBeacon1(pFrame) LMICin866_isValidBeacon1(pFrame)
58
59// override default for LMICbandplan_isFSK()
60#undef LMICbandplan_isFSK
61#define LMICbandplan_isFSK() (/* TX datarate */LMIC.dndr == IN866_DR_FSK)
62
63#define LMICbandplan_getInitialDrJoin() (IN866_DR_SF7)
64
65void LMICin866_setBcnRxParams(void);
66#define LMICbandplan_setBcnRxParams() LMICin866_setBcnRxParams()
67
68u4_t LMICin866_convFreq(xref2cu1_t ptr);
69#define LMICbandplan_convFreq(ptr) LMICin866_convFreq(ptr)
70
71static inline u1_t
72LMICin866_queryMaxRx1DrOffset(void) {
73 return 7;
74}
75#define LMICbandplan_queryMaxRx1DrOffset() LMICin866_queryMaxRx1DrOffset()
76
77void LMICin866_initJoinLoop(void);
78#define LMICbandplan_initJoinLoop() LMICin866_initJoinLoop()
79
80ostime_t LMICin866_nextTx(ostime_t now);
81#define LMICbandplan_nextTx(now) LMICin866_nextTx(now)
82
83ostime_t LMICin866_nextJoinState(void);
84#define LMICbandplan_nextJoinState() LMICin866_nextJoinState()
85
86void LMICin866_initDefaultChannels(bit_t join);
87#define LMICbandplan_initDefaultChannels(join) LMICin866_initDefaultChannels(join)
88
89void LMICin866_setRx1Params(void);
90#define LMICbandplan_setRx1Params() LMICin866_setRx1Params()
91
92#undef LMICbandplan_validDR
93bit_t LMICin866_validDR(dr_t dr);
94#define LMICbandplan_validDR(dr) LMICin866_validDR(dr)
95
96LMIC_END_DECLS
97
98#endif // _lmic_bandplan_in866_h_
u2_t os_rlsbf2(xref2cu1_t buf)
Read 16-bit quantity from given pointer in little endian byte order.
Definition lmic.c:80