Arduino LMIC 6.0.1
Arduino LoRaWAN(r) MAC in C
Loading...
Searching...
No Matches
lmic_eu_like.h
1/*
2* Copyright (c) 2014-2016 IBM Corporation.
3* Copyright (c) 2017, 2019 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_eu_like_h_
30# define _lmic_eu_like_h_
31
32#ifndef _lmic_h_
33# include "lmic.h"
34#endif
35
36LMIC_BEGIN_DECLS
37
38// make sure we want EU-like code
39#if !CFG_LMIC_EU_like
40# error "lmic not configured for EU-like bandplan"
41#endif
42
43// TODO(tmm@mcci.com): this should come from the lmic.h or lorabase.h file; and
44// it's probably affected by the fix to this issue:
45// https://github.com/mcci-catena/arduino-lmic/issues/2
46#define DNW2_SAFETY_ZONE ms2osticks(3000)
47
48// provide a default for LMICbandplan_isValidBeacon1()
49static inline int
50LMICeulike_isValidBeacon1(const uint8_t *d) {
51 return os_rlsbf2(&d[OFF_BCN_CRC1]) != os_crc16(d, OFF_BCN_CRC1);
52}
53
54#define LMICbandplan_isValidBeacon1(pFrame) LMICeulike_isValidBeacon1(pFrame)
55
56
57// provide a default for LMICbandplan_isFSK()
58#define LMICbandplan_isFSK() (0)
59
60// provide a default LMICbandplan_txDoneDoFSK()
61void LMICeulike_txDoneFSK(ostime_t delay, osjobcb_t func);
62#define LMICbandplan_txDoneFSK(delay, func) LMICeulike_txDoneFSK(delay, func)
63
64#define LMICbandplan_joinAcceptChannelClear() LMICbandplan_initDefaultChannels(/* normal, not join */ 0)
65
66enum { BAND_MILLI = 0, BAND_CENTI = 1, BAND_DECI = 2, BAND_AUX = 3 };
67
68// there's a CFList on joins for EU-like plans
69#define LMICbandplan_hasJoinCFlist() (1)
70
72void LMICeulike_processJoinAcceptCFList(void);
74#define LMICbandplan_processJoinAcceptCFList LMICeulike_processJoinAcceptCFList
75
76#define LMICbandplan_advanceBeaconChannel() \
77 do { /* nothing */ } while (0)
78
79#define LMICbandplan_resetDefaultChannels() \
80 do { /* nothing */ } while (0)
81
82#define LMICbandplan_setSessionInitDefaultChannels() \
83 do { LMICbandplan_initDefaultChannels(/* normal, not join */ 0); } while (0)
84
85bit_t LMICeulike_canMapChannels(u1_t chpage, u2_t chmap);
86#define LMICbandplan_canMapChannels(c, m) LMICeulike_canMapChannels(c, m)
87
88bit_t LMICeulike_mapChannels(u1_t chpage, u2_t chmap);
89#define LMICbandplan_mapChannels(c, m) LMICeulike_mapChannels(c, m)
90
91void LMICeulike_initJoinLoop(u1_t nDefaultChannels, s1_t adrTxPow);
92
93void LMICeulike_updateTx(ostime_t txbeg);
94#define LMICbandplan_updateTx(t) LMICeulike_updateTx(t)
95
96ostime_t LMICeulike_nextJoinState(uint8_t nDefaultChannels);
97
98static inline ostime_t LMICeulike_nextJoinTime(ostime_t now) {
99 return now;
100}
101#define LMICbandplan_nextJoinTime(now) LMICeulike_nextJoinTime(now)
102
103#define LMICbandplan_init() \
104 do { /* nothing */ } while (0)
105
106void LMICeulike_saveAdrState(lmic_saved_adr_state_t *pStateBuffer);
107#define LMICbandplan_saveAdrState(pState) LMICeulike_saveAdrState(pState)
108
109bit_t LMICeulike_compareAdrState(const lmic_saved_adr_state_t *pStateBuffer);
110#define LMICbandplan_compareAdrState(pState) LMICeulike_compareAdrState(pState)
111
112void LMICeulike_restoreAdrState(const lmic_saved_adr_state_t *pStateBuffer);
113#define LMICbandplan_restoreAdrState(pState) LMICeulike_restoreAdrState(pState)
114
115// set Rx1 frequency (might be different than uplink).
116void LMICeulike_setRx1Freq(void);
117
118bit_t LMICeulike_isDataRateFeasible(dr_t dr);
119#define LMICbandplan_isDataRateFeasible(dr) LMICeulike_isDataRateFeasible(dr)
120
125void LMICeulike_saveChannelState(u1_t *pVariant, ostime_t now);
126#define LMICbandplan_saveChannelState(p, now) LMICeulike_saveChannelState(p, now)
127
135bit_t LMICeulike_restoreChannelState(const u1_t *pVariant, ostime_t now, u1_t version);
136#define LMICbandplan_restoreChannelState(p, now, v) LMICeulike_restoreChannelState(p, now, v)
137
138LMIC_END_DECLS
139
140#endif // _lmic_eu_like_h_
u2_t os_rlsbf2(xref2cu1_t buf)
Read 16-bit quantity from given pointer in little endian byte order.
Definition lmic.c:80
LMIC API.
osjobcbfn_t * osjobcb_t
the pointer-to-function for osjob_t callbacks
Definition oslmic.h:168