Arduino LMIC 6.0.1
Arduino LoRaWAN(r) MAC in C
Loading...
Searching...
No Matches
lmic_bandplan_as923.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_as923_h_
30# define _lmic_bandplan_as923_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 (as923); 0 --> not valid dr.
39uint8_t LMICas923_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) LMICas923_maxFrameLen(dr)
42
43int8_t LMICas923_pow2dBm(uint8_t mcmd_ladr_p1);
44#define pow2dBm(mcmd_ladr_p1) LMICas923_pow2dBm(mcmd_ladr_p1)
45
46// Times for half symbol per DR
47// Per DR table to minimize rounding errors
48ostime_t LMICas923_dr2hsym(uint8_t dr);
49#define dr2hsym(dr) LMICas923_dr2hsym(dr)
50
51static inline int
52LMICas923_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) LMICas923_isValidBeacon1(pFrame)
58
59// override default for LMICbandplan_resetDefaultChannels
60void
61LMICas923_resetDefaultChannels(void);
62
63#undef LMICbandplan_resetDefaultChannels
64#define LMICbandplan_resetDefaultChannels() \
65 LMICas923_resetDefaultChannels()
66
67// override default for LMICbandplan_init
68void LMICas923_init(void);
69
70#undef LMICbandplan_init
71#define LMICbandplan_init() \
72 LMICas923_init()
73
74
75// override default for LMICbandplan_isFSK()
76#undef LMICbandplan_isFSK
77#define LMICbandplan_isFSK() (/* RX datarate */LMIC.dndr == AS923_DR_FSK)
78
79#define LMICbandplan_getInitialDrJoin() (AS923_DR_SF10)
80
81void LMICas923_setBcnRxParams(void);
82#define LMICbandplan_setBcnRxParams() LMICas923_setBcnRxParams()
83
84u4_t LMICas923_convFreq(xref2cu1_t ptr);
85#define LMICbandplan_convFreq(ptr) LMICas923_convFreq(ptr)
86
87static inline u1_t
88LMICas923_queryMaxRx1DrOffset(void) {
89 return 7;
90}
91#define LMICbandplan_queryMaxRx1DrOffset() LMICas923_queryMaxRx1DrOffset()
92
93void LMICas923_initJoinLoop(void);
94#define LMICbandplan_initJoinLoop() LMICas923_initJoinLoop()
95
96// for as923, depending on dwell, we may need to do something else
97#undef LMICbandplan_setRx1Params
98void LMICas923_setRx1Params(void);
99#define LMICbandplan_setRx1Params() LMICas923_setRx1Params()
100
101ostime_t LMICas923_nextTx(ostime_t now);
102#define LMICbandplan_nextTx(now) LMICas923_nextTx(now)
103
104ostime_t LMICas923_nextJoinState(void);
105#define LMICbandplan_nextJoinState() LMICas923_nextJoinState()
106
107void LMICas923_initDefaultChannels(bit_t join);
108#define LMICbandplan_initDefaultChannels(join) LMICas923_initDefaultChannels(join)
109
110// override default for LMICbandplan_updateTX
111#undef LMICbandplan_updateTx
112void LMICas923_updateTx(ostime_t txbeg);
113#define LMICbandplan_updateTx(txbeg) LMICas923_updateTx(txbeg)
114
115#undef LMICbandplan_nextJoinTime
116ostime_t LMICas923_nextJoinTime(ostime_t now);
117#define LMICbandplan_nextJoinTime(now) LMICas923_nextJoinTime(now)
118
119#undef LMICbandplan_validDR
120bit_t LMICas923_validDR(dr_t dr);
121#define LMICbandplan_validDR(dr) LMICas923_validDR(dr)
122
123LMIC_END_DECLS
124
125#endif // _lmic_bandplan_as923_h_
u2_t os_rlsbf2(xref2cu1_t buf)
Read 16-bit quantity from given pointer in little endian byte order.
Definition lmic.c:80