SX126x-Arduino
RegionEU868.h
Go to the documentation of this file.
1 
35 #ifndef __REGION_EU868_H__
36 #define __REGION_EU868_H__
37 
38 extern "C"
39 {
40 
44 #define EU868_MAX_NB_CHANNELS 16
45 
49 #define EU868_NUMB_DEFAULT_CHANNELS 3
50 
54 #define EU868_NUMB_CHANNELS_CF_LIST 5
55 
59 #define EU868_TX_MIN_DATARATE DR_0
60 
64 #define EU868_TX_MAX_DATARATE DR_7
65 
69 #define EU868_RX_MIN_DATARATE DR_0
70 
74 #define EU868_RX_MAX_DATARATE DR_7
75 
79 #define EU868_DEFAULT_DATARATE DR_0
80 
84 #define EU868_MIN_RX1_DR_OFFSET 0
85 
89 #define EU868_MAX_RX1_DR_OFFSET 5
90 
94 #define EU868_DEFAULT_RX1_DR_OFFSET 0
95 
99 #define EU868_MIN_TX_POWER TX_POWER_7
100 
104 #define EU868_MAX_TX_POWER TX_POWER_0
105 
109 #define EU868_DEFAULT_TX_POWER TX_POWER_0
110 
114 #define EU868_DEFAULT_MAX_EIRP 16.0f
115 
119 #define EU868_DEFAULT_ANTENNA_GAIN 2.15f
120 
124 #define EU868_ADR_ACK_LIMIT 64
125 
129 #define EU868_ADR_ACK_DELAY 32
130 
134 #define EU868_DUTY_CYCLE_ENABLED 1
135 
139 #define EU868_MAX_RX_WINDOW 3000
140 
144 #define EU868_RECEIVE_DELAY1 1000
145 
149 #define EU868_RECEIVE_DELAY2 2000
150 
154 #define EU868_JOIN_ACCEPT_DELAY1 5000
155 
159 #define EU868_JOIN_ACCEPT_DELAY2 6000
160 
164 #define EU868_MAX_FCNT_GAP 16384
165 
169 #define EU868_ACKTIMEOUT 2000
170 
174 #define EU868_ACK_TIMEOUT_RND 1000
175 
176 #if (EU868_DEFAULT_DATARATE > DR_5)
177 #error "A default DR higher than DR_5 may lead to connectivity loss."
178 #endif
179 
183 #define EU868_RX_WND_2_FREQ 869525000
184 
188 #define EU868_RX_WND_2_DR DR_0
189 
193 #define EU868_MAX_NB_BANDS 5
194 
199 #define EU868_BAND0 \
200  { \
201  100, EU868_MAX_TX_POWER, 0, 0 \
202  } // 1.0 %
203 
208 #define EU868_BAND1 \
209  { \
210  100, EU868_MAX_TX_POWER, 0, 0 \
211  } // 1.0 %
212 
217 #define EU868_BAND2 \
218  { \
219  1000, EU868_MAX_TX_POWER, 0, 0 \
220  } // 0.1 %
221 
226 #define EU868_BAND3 \
227  { \
228  10, EU868_MAX_TX_POWER, 0, 0 \
229  } // 10.0 %
230 
235 #define EU868_BAND4 \
236  { \
237  100, EU868_MAX_TX_POWER, 0, 0 \
238  } // 1.0 %
239 
244 #define EU868_LC1 \
245  { \
246  868100000, 0, {((DR_5 << 4) | DR_0)}, 1 \
247  }
248 
253 #define EU868_LC2 \
254  { \
255  868300000, 0, {((DR_5 << 4) | DR_0)}, 1 \
256  }
257 
262 #define EU868_LC3 \
263  { \
264  868500000, 0, {((DR_5 << 4) | DR_0)}, 1 \
265  }
266 
270 #define EU868_JOIN_CHANNELS (uint16_t)(LC(1) | LC(2) | LC(3))
271 
275  static const uint8_t DataratesEU868[] = {12, 11, 10, 9, 8, 7, 7, 50};
276 
280  static const uint32_t BandwidthsEU868[] = {125000, 125000, 125000, 125000, 125000, 125000, 250000, 0};
281 
285  static const uint8_t MaxPayloadOfDatarateEU868[] = {51, 51, 51, 115, 242, 242, 242, 242};
286 
290  static const uint8_t MaxPayloadOfDatarateRepeaterEU868[] = {51, 51, 51, 115, 222, 222, 222, 222};
291 
300 
307 
314 
324  bool RegionEU868Verify(VerifyParams_t *verify, PhyAttribute_t phyAttribute);
325 
333 
342 
356  bool RegionEU868AdrNext(AdrNextParams_t *adrNext, int8_t *drOut, int8_t *txPowOut, uint32_t *adrAckCounter);
357 
371  void RegionEU868ComputeRxWindowParameters(int8_t datarate, uint8_t minRxSymbols, uint32_t rxError, RxConfigParams_t *rxConfigParams);
372 
382  bool RegionEU868RxConfig(RxConfigParams_t *rxConfig, int8_t *datarate);
383 
395  bool RegionEU868TxConfig(TxConfigParams_t *txConfig, int8_t *txPower, TimerTime_t *txTimeOnAir);
396 
404  uint8_t RegionEU868LinkAdrReq(LinkAdrReqParams_t *linkAdrReq, int8_t *drOut, int8_t *txPowOut, uint8_t *nbRepOut, uint8_t *nbBytesParsed);
405 
414 
423 
434 
443 
452 
459 
472  bool RegionEU868NextChannel(NextChanParams_t *nextChanParams, uint8_t *channel, TimerTime_t *time, TimerTime_t *aggregatedTimeOff);
473 
482 
491 
498 
510  uint8_t RegionEU868ApplyDrOffset(uint8_t downlinkDwellTime, int8_t dr, int8_t drOffset);
511 
513 };
514 #endif // __REGION_EU868_H__
sChannelRemoveParams
Definition: Region.h:1134
RegionEU868NextChannel
bool RegionEU868NextChannel(NextChanParams_t *nextChanParams, uint8_t *channel, TimerTime_t *time, TimerTime_t *aggregatedTimeOff)
Searches and set the next random available channel.
LoRaMacStatus_t
enum eLoRaMacStatus LoRaMacStatus_t
RegionEU868GetPhyParam
PhyParam_t RegionEU868GetPhyParam(GetPhyParams_t *getPhy)
The function gets a value of a specific phy attribute.
sTxConfigParams
Definition: Region.h:916
InitType_t
enum eInitType InitType_t
sSetBandTxDoneParams
Definition: Region.h:749
sRxParamSetupReqParams
Definition: Region.h:982
uVerifyParams
Definition: Region.h:767
RegionEU868ChannelsRemove
bool RegionEU868ChannelsRemove(ChannelRemoveParams_t *channelRemove)
Removes a channel.
sRxConfigParams
Definition: Region.h:865
RegionEU868DlChannelReq
uint8_t RegionEU868DlChannelReq(DlChannelReqParams_t *dlChannelReq)
The function processes a DlChannel Request.
RegionEU868ComputeRxWindowParameters
void RegionEU868ComputeRxWindowParameters(int8_t datarate, uint8_t minRxSymbols, uint32_t rxError, RxConfigParams_t *rxConfigParams)
sAlternateDrParams
Definition: Region.h:1050
RegionEU868LinkAdrReq
uint8_t RegionEU868LinkAdrReq(LinkAdrReqParams_t *linkAdrReq, int8_t *drOut, int8_t *txPowOut, uint8_t *nbRepOut, uint8_t *nbBytesParsed)
The function processes a Link ADR Request.
sNewChannelReqParams
Definition: Region.h:1001
RegionEU868ApplyCFList
void RegionEU868ApplyCFList(ApplyCFListParams_t *applyCFList)
The function parses the input buffer and sets up the channels of the CF list.
sContinuousWaveParams
Definition: Region.h:1145
sAdrNextParams
Definition: Region.h:834
MaxPayloadOfDatarateEU868
static const uint8_t MaxPayloadOfDatarateEU868[]
Definition: RegionEU868.h:285
RegionEU868AlternateDr
int8_t RegionEU868AlternateDr(AlternateDrParams_t *alternateDr)
Alternates the datarate of the channel for the join request.
RegionEU868ChannelAdd
LoRaMacStatus_t RegionEU868ChannelAdd(ChannelAddParams_t *channelAdd)
Adds a channel.
sCalcBackOffParams
Definition: Region.h:1061
DataratesEU868
static const uint8_t DataratesEU868[]
Definition: RegionEU868.h:275
RegionEU868SetBandTxDone
void RegionEU868SetBandTxDone(SetBandTxDoneParams_t *txDone)
Updates the last TX done parameters of the current channel.
sApplyCFListParams
Definition: Region.h:804
sTxParamSetupReqParams
Definition: Region.h:1016
RegionEU868InitDefaults
void RegionEU868InitDefaults(InitType_t type)
Initializes the channels masks and the channels.
sChanMaskSetParams
Definition: Region.h:819
RegionEU868RxParamSetupReq
uint8_t RegionEU868RxParamSetupReq(RxParamSetupReqParams_t *rxParamSetupReq)
The function processes a RX Parameter Setup Request.
RegionEU868NewChannelReq
uint8_t RegionEU868NewChannelReq(NewChannelReqParams_t *newChannelReq)
The function processes a Channel Request.
RegionEU868AdrNext
bool RegionEU868AdrNext(AdrNextParams_t *adrNext, int8_t *drOut, int8_t *txPowOut, uint32_t *adrAckCounter)
Calculates the next datarate to set, when ADR is on or off.
RegionEU868ChanMaskSet
bool RegionEU868ChanMaskSet(ChanMaskSetParams_t *chanMaskSet)
Sets a channels mask.
RegionEU868SetContinuousWave
void RegionEU868SetContinuousWave(ContinuousWaveParams_t *continuousWave)
Sets the radio into continuous wave mode.
sNextChanParams
Definition: Region.h:1092
uPhyParam
Definition: Region.h:697
RegionEU868ApplyDrOffset
uint8_t RegionEU868ApplyDrOffset(uint8_t downlinkDwellTime, int8_t dr, int8_t drOffset)
Computes new datarate according to the given offset.
RegionEU868TxConfig
bool RegionEU868TxConfig(TxConfigParams_t *txConfig, int8_t *txPower, TimerTime_t *txTimeOnAir)
TX configuration.
sChannelAddParams
Definition: Region.h:1119
RegionEU868CalcBackOff
void RegionEU868CalcBackOff(CalcBackOffParams_t *calcBackOff)
Calculates the back-off time.
sDlChannelReqParams
Definition: Region.h:1035
sGetPhyParams
Definition: Region.h:720
RegionEU868Verify
bool RegionEU868Verify(VerifyParams_t *verify, PhyAttribute_t phyAttribute)
Verifies a parameter.
RegionEU868RxConfig
bool RegionEU868RxConfig(RxConfigParams_t *rxConfig, int8_t *datarate)
Configuration of the RX windows.
PhyAttribute_t
enum ePhyAttribute PhyAttribute_t
BandwidthsEU868
static const uint32_t BandwidthsEU868[]
Definition: RegionEU868.h:280
TimerTime_t
uint32_t TimerTime_t
Timer time variable definition.
Definition: timer.h:68
RegionEU868TxParamSetupReq
int8_t RegionEU868TxParamSetupReq(TxParamSetupReqParams_t *txParamSetupReq)
The function processes a TX ParamSetup Request.
MaxPayloadOfDatarateRepeaterEU868
static const uint8_t MaxPayloadOfDatarateRepeaterEU868[]
Definition: RegionEU868.h:290