Arduino LMIC 6.0.1
Arduino LoRaWAN(r) MAC in C
Loading...
Searching...
No Matches
lmic_bandplan_kr920.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_kr920_h_
30# define _lmic_kr920_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 (kr920); 0 --> not valid dr.
37uint8_t LMICkr920_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) LMICkr920_maxFrameLen(dr)
40
41int8_t LMICkr920_pow2dBm(uint8_t mcmd_ladr_p1);
42#define pow2dBm(mcmd_ladr_p1) LMICkr920_pow2dBm(mcmd_ladr_p1)
43
44// Times for half symbol per DR
45// Per DR table to minimize rounding errors
46ostime_t LMICkr920_dr2hsym(uint8_t dr);
47#define dr2hsym(dr) LMICkr920_dr2hsym(dr)
48
49
50// TODO(tmm@mcci.com) this looks bogus compared to current 1.02 regional
51// spec. https://github.com/mcci-catena/arduino-lmic/issues/18
52static inline int
53LMICkr920_isValidBeacon1(const uint8_t *d) {
54 return d[OFF_BCN_CRC1] != (u1_t)os_crc16(d, OFF_BCN_CRC1);
55}
56
57#undef LMICbandplan_isValidBeacon1
58#define LMICbandplan_isValidBeacon1(pFrame) LMICkr920_isValidBeacon1(pFrame)
59
60// override default for LMICbandplan_isFSK()
61#undef LMICbandplan_isFSK
62#define LMICbandplan_isFSK() (/* always false */ 0)
63
64#define LMICbandplan_getInitialDrJoin() (KR920_DR_SF7)
65
66void LMICkr920_setBcnRxParams(void);
67#define LMICbandplan_setBcnRxParams() LMICkr920_setBcnRxParams()
68
69u4_t LMICkr920_convFreq(xref2cu1_t ptr);
70#define LMICbandplan_convFreq(ptr) LMICkr920_convFreq(ptr)
71
72static inline u1_t
73LMICkr920_queryMaxRx1DrOffset(void) {
74 return 5;
75}
76#define LMICbandplan_queryMaxRx1DrOffset() LMICkr920_queryMaxRx1DrOffset()
77
78void LMICkr920_initJoinLoop(void);
79#define LMICbandplan_initJoinLoop() LMICkr920_initJoinLoop()
80
81ostime_t LMICkr920_nextTx(ostime_t now);
82#define LMICbandplan_nextTx(now) LMICkr920_nextTx(now)
83
84ostime_t LMICkr920_nextJoinState(void);
85#define LMICbandplan_nextJoinState() LMICkr920_nextJoinState()
86
87void LMICkr920_initDefaultChannels(bit_t join);
88#define LMICbandplan_initDefaultChannels(join) LMICkr920_initDefaultChannels(join)
89
90void LMICkr920_setRx1Params(void);
91#define LMICbandplan_setRx1Params() LMICkr920_setRx1Params()
92
93#undef LMICbandplan_updateTx
94void LMICkr920_updateTx(ostime_t txbeg);
95#define LMICbandplan_updateTx(t) LMICkr920_updateTx(t)
96
97#undef LMICbandplan_validDR
98bit_t LMICkr920_validDR(dr_t dr);
99#define LMICbandplan_validDR(dr) LMICkr920_validDR(dr)
100
101#endif // _lmic_kr920_h_