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
36// make sure we want US-like code
37#if !CFG_LMIC_EU_like
38# error "lmic not configured for EU-like bandplan"
39#endif
40
41// TODO(tmm@mcci.com): this should come from the lmic.h or lorabase.h file; and
42// it's probably affected by the fix to this issue:
43// https://github.com/mcci-catena/arduino-lmic/issues/2
44#define DNW2_SAFETY_ZONE ms2osticks(3000)
45
46// provide a default for LMICbandplan_isValidBeacon1()
47static inline int
48LMICeulike_isValidBeacon1(const uint8_t *d) {
49 return os_rlsbf2(&d[OFF_BCN_CRC1]) != os_crc16(d, OFF_BCN_CRC1);
50}
51
52#define LMICbandplan_isValidBeacon1(pFrame) LMICeulike_isValidBeacon1(pFrame)
53
54
55// provide a default for LMICbandplan_isFSK()
56#define LMICbandplan_isFSK() (0)
57
58// provide a default LMICbandplan_txDoneDoFSK()
59void LMICeulike_txDoneFSK(ostime_t delay, osjobcb_t func);
60#define LMICbandplan_txDoneFSK(delay, func) LMICeulike_txDoneFSK(delay, func)
61
62#define LMICbandplan_joinAcceptChannelClear() LMICbandplan_initDefaultChannels(/* normal, not join */ 0)
63
64enum { BAND_MILLI = 0, BAND_CENTI = 1, BAND_DECI = 2, BAND_AUX = 3 };
65
66// there's a CFList on joins for EU-like plans
67#define LMICbandplan_hasJoinCFlist() (1)
68
70void LMICeulike_processJoinAcceptCFList(void);
72#define LMICbandplan_processJoinAcceptCFList LMICeulike_processJoinAcceptCFList
73
74#define LMICbandplan_advanceBeaconChannel() \
75 do { /* nothing */ } while (0)
76
77#define LMICbandplan_resetDefaultChannels() \
78 do { /* nothing */ } while (0)
79
80#define LMICbandplan_setSessionInitDefaultChannels() \
81 do { LMICbandplan_initDefaultChannels(/* normal, not join */ 0); } while (0)
82
83bit_t LMICeulike_canMapChannels(u1_t chpage, u2_t chmap);
84#define LMICbandplan_canMapChannels(c, m) LMICeulike_canMapChannels(c, m)
85
86bit_t LMICeulike_mapChannels(u1_t chpage, u2_t chmap);
87#define LMICbandplan_mapChannels(c, m) LMICeulike_mapChannels(c, m)
88
89void LMICeulike_initJoinLoop(u1_t nDefaultChannels, s1_t adrTxPow);
90
91void LMICeulike_updateTx(ostime_t txbeg);
92#define LMICbandplan_updateTx(t) LMICeulike_updateTx(t)
93
94ostime_t LMICeulike_nextJoinState(uint8_t nDefaultChannels);
95
96static inline ostime_t LMICeulike_nextJoinTime(ostime_t now) {
97 return now;
98}
99#define LMICbandplan_nextJoinTime(now) LMICeulike_nextJoinTime(now)
100
101#define LMICbandplan_init() \
102 do { /* nothing */ } while (0)
103
104void LMICeulike_saveAdrState(lmic_saved_adr_state_t *pStateBuffer);
105#define LMICbandplan_saveAdrState(pState) LMICeulike_saveAdrState(pState)
106
107bit_t LMICeulike_compareAdrState(const lmic_saved_adr_state_t *pStateBuffer);
108#define LMICbandplan_compareAdrState(pState) LMICeulike_compareAdrState(pState)
109
110void LMICeulike_restoreAdrState(const lmic_saved_adr_state_t *pStateBuffer);
111#define LMICbandplan_restoreAdrState(pState) LMICeulike_restoreAdrState(pState)
112
113// set Rx1 frequency (might be different than uplink).
114void LMICeulike_setRx1Freq(void);
115
116bit_t LMICeulike_isDataRateFeasible(dr_t dr);
117#define LMICbandplan_isDataRateFeasible(dr) LMICeulike_isDataRateFeasible(dr)
118
119
120#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