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
36// return maximum frame length (including PHY header) for this data rate (in866); 0 --> not valid dr.
37uint8_t LMICin866_maxFrameLen(uint8_t dr);
38// return maximum frame length (including PHY header) for this data rate; 0 --> not valid dr.
39#define LMICbandplan_maxFrameLen(dr) LMICin866_maxFrameLen(dr)
40
41int8_t LMICin866_pow2dBm(uint8_t mcmd_ladr_p1);
42#define pow2dBm(mcmd_ladr_p1) LMICin866_pow2dBm(mcmd_ladr_p1)
43
44// Times for half symbol per DR
45// Per DR table to minimize rounding errors
46ostime_t LMICin866_dr2hsym(uint8_t dr);
47#define dr2hsym(dr) LMICin866_dr2hsym(dr)
48
49static inline int
50LMICin866_isValidBeacon1(const uint8_t *d) {
51 return os_rlsbf2(&d[OFF_BCN_CRC1]) != os_crc16(d, OFF_BCN_CRC1);
52}
53
54#undef LMICbandplan_isValidBeacon1
55#define LMICbandplan_isValidBeacon1(pFrame) LMICin866_isValidBeacon1(pFrame)
56
57// override default for LMICbandplan_isFSK()
58#undef LMICbandplan_isFSK
59#define LMICbandplan_isFSK() (/* TX datarate */LMIC.dndr == IN866_DR_FSK)
60
61#define LMICbandplan_getInitialDrJoin() (IN866_DR_SF7)
62
63void LMICin866_setBcnRxParams(void);
64#define LMICbandplan_setBcnRxParams() LMICin866_setBcnRxParams()
65
66u4_t LMICin866_convFreq(xref2cu1_t ptr);
67#define LMICbandplan_convFreq(ptr) LMICin866_convFreq(ptr)
68
69static inline u1_t
70LMICin866_queryMaxRx1DrOffset(void) {
71 return 7;
72}
73#define LMICbandplan_queryMaxRx1DrOffset() LMICin866_queryMaxRx1DrOffset()
74
75void LMICin866_initJoinLoop(void);
76#define LMICbandplan_initJoinLoop() LMICin866_initJoinLoop()
77
78ostime_t LMICin866_nextTx(ostime_t now);
79#define LMICbandplan_nextTx(now) LMICin866_nextTx(now)
80
81ostime_t LMICin866_nextJoinState(void);
82#define LMICbandplan_nextJoinState() LMICin866_nextJoinState()
83
84void LMICin866_initDefaultChannels(bit_t join);
85#define LMICbandplan_initDefaultChannels(join) LMICin866_initDefaultChannels(join)
86
87void LMICin866_setRx1Params(void);
88#define LMICbandplan_setRx1Params() LMICin866_setRx1Params()
89
90#undef LMICbandplan_validDR
91bit_t LMICin866_validDR(dr_t dr);
92#define LMICbandplan_validDR(dr) LMICin866_validDR(dr)
93
94#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