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
36// return maximum frame length (including PHY header) for this data rate (as923); 0 --> not valid dr.
37uint8_t LMICas923_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) LMICas923_maxFrameLen(dr)
40
41int8_t LMICas923_pow2dBm(uint8_t mcmd_ladr_p1);
42#define pow2dBm(mcmd_ladr_p1) LMICas923_pow2dBm(mcmd_ladr_p1)
43
44// Times for half symbol per DR
45// Per DR table to minimize rounding errors
46ostime_t LMICas923_dr2hsym(uint8_t dr);
47#define dr2hsym(dr) LMICas923_dr2hsym(dr)
48
49static inline int
50LMICas923_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) LMICas923_isValidBeacon1(pFrame)
56
57// override default for LMICbandplan_resetDefaultChannels
58void
59LMICas923_resetDefaultChannels(void);
60
61#undef LMICbandplan_resetDefaultChannels
62#define LMICbandplan_resetDefaultChannels() \
63 LMICas923_resetDefaultChannels()
64
65// override default for LMICbandplan_init
66void LMICas923_init(void);
67
68#undef LMICbandplan_init
69#define LMICbandplan_init() \
70 LMICas923_init()
71
72
73// override default for LMICbandplan_isFSK()
74#undef LMICbandplan_isFSK
75#define LMICbandplan_isFSK() (/* RX datarate */LMIC.dndr == AS923_DR_FSK)
76
77#define LMICbandplan_getInitialDrJoin() (AS923_DR_SF10)
78
79void LMICas923_setBcnRxParams(void);
80#define LMICbandplan_setBcnRxParams() LMICas923_setBcnRxParams()
81
82u4_t LMICas923_convFreq(xref2cu1_t ptr);
83#define LMICbandplan_convFreq(ptr) LMICas923_convFreq(ptr)
84
85static inline u1_t
86LMICas923_queryMaxRx1DrOffset(void) {
87 return 7;
88}
89#define LMICbandplan_queryMaxRx1DrOffset() LMICas923_queryMaxRx1DrOffset()
90
91void LMICas923_initJoinLoop(void);
92#define LMICbandplan_initJoinLoop() LMICas923_initJoinLoop()
93
94// for as923, depending on dwell, we may need to do something else
95#undef LMICbandplan_setRx1Params
96void LMICas923_setRx1Params(void);
97#define LMICbandplan_setRx1Params() LMICas923_setRx1Params()
98
99ostime_t LMICas923_nextTx(ostime_t now);
100#define LMICbandplan_nextTx(now) LMICas923_nextTx(now)
101
102ostime_t LMICas923_nextJoinState(void);
103#define LMICbandplan_nextJoinState() LMICas923_nextJoinState()
104
105void LMICas923_initDefaultChannels(bit_t join);
106#define LMICbandplan_initDefaultChannels(join) LMICas923_initDefaultChannels(join)
107
108// override default for LMICbandplan_updateTX
109#undef LMICbandplan_updateTx
110void LMICas923_updateTx(ostime_t txbeg);
111#define LMICbandplan_updateTx(txbeg) LMICas923_updateTx(txbeg)
112
113#undef LMICbandplan_nextJoinTime
114ostime_t LMICas923_nextJoinTime(ostime_t now);
115#define LMICbandplan_nextJoinTime(now) LMICas923_nextJoinTime(now)
116
117#undef LMICbandplan_validDR
118bit_t LMICas923_validDR(dr_t dr);
119#define LMICbandplan_validDR(dr) LMICas923_validDR(dr)
120
121#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