SX126x-Arduino  2.0.1
RegionAS923.h
Go to the documentation of this file.
1 
35 #ifndef __REGION_AS923_H__
36 #define __REGION_AS923_H__
37 
38 extern "C"
39 {
40 
44 #define AS923_MAX_NB_CHANNELS 16
45 
49 #define AS923_NUMB_DEFAULT_CHANNELS 8
50 
54 #define AS923_NUMB_CHANNELS_CF_LIST 5
56 
60 #define AS923_TX_MIN_DATARATE DR_0
61 
65 #define AS923_TX_MAX_DATARATE DR_7
66 
70 #define AS923_RX_MIN_DATARATE DR_0
71 
75 #define AS923_RX_MAX_DATARATE DR_7
76 
80 #define AS923_DEFAULT_DATARATE DR_2
81 
86 #define AS923_DWELL_LIMIT_DATARATE DR_2
87 
91 #define AS923_MIN_RX1_DR_OFFSET 0
92 
96 #define AS923_MAX_RX1_DR_OFFSET 7
97 
101 #define AS923_DEFAULT_RX1_DR_OFFSET 0
102 
106 #define AS923_MIN_TX_POWER TX_POWER_7
107 
111 #define AS923_MAX_TX_POWER TX_POWER_0
112 
116 #define AS923_DEFAULT_TX_POWER TX_POWER_0
117 
121 #define AS923_DEFAULT_UPLINK_DWELL_TIME 1
122 
126 #define AS923_DEFAULT_DOWNLINK_DWELL_TIME 1
127 
131 #define AS923_DEFAULT_MAX_EIRP 16.0f
132 
136 #define AS923_DEFAULT_ANTENNA_GAIN 2.15f
137 
141 #define AS923_ADR_ACK_LIMIT 64
142 
146 #define AS923_ADR_ACK_DELAY 32
147 
151 #define AS923_DUTY_CYCLE_ENABLED 0
152 
156 #define AS923_MAX_RX_WINDOW 3000
157 
161 #define AS923_RECEIVE_DELAY1 1000
162 
166 #define AS923_RECEIVE_DELAY2 2000
167 
171 #define AS923_JOIN_ACCEPT_DELAY1 5000
172 
176 #define AS923_JOIN_ACCEPT_DELAY2 6000
177 
181 #define AS923_MAX_FCNT_GAP 16384
182 
186 #define AS923_ACKTIMEOUT 2000
187 
191 #define AS923_ACK_TIMEOUT_RND 1000
192 
193 #if (AS923_DEFAULT_DATARATE > DR_5)
194 #error "A default DR higher than DR_5 may lead to connectivity loss."
195 #endif
196 
200 #define AS923_RX_WND_2_DR DR_2
201 
205 #define AS923_MAX_NB_BANDS 1
206 
211 #define AS923_BAND0 \
212  { \
213  100, AS923_MAX_TX_POWER, 0, 0, 0 \
214  } // 1.0 %
215 
216 #if AS923_DEFAULT_UPLINK_DWELL_TIME
217 
221 #define AS923_LC1 \
222  { \
223  923200000, 0, {((DR_5 << 4) | DR_2)}, 0 \
224  }
225 
230 #define AS923_LC2 \
231  { \
232  923400000, 0, {((DR_5 << 4) | DR_2)}, 0 \
233  }
234 #define AS923_LC3 \
235  { \
236  923600000, 0, {((DR_5 << 4) | DR_2)}, 0 \
237  }
238 #define AS923_LC4 \
239  { \
240  923800000, 0, {((DR_5 << 4) | DR_2)}, 0 \
241  }
242 #define AS923_LC5 \
243  { \
244  924000000, 0, {((DR_5 << 4) | DR_2)}, 0 \
245  }
246 #define AS923_LC6 \
247  { \
248  924200000, 0, {((DR_5 << 4) | DR_2)}, 0 \
249  }
250 #define AS923_LC7 \
251  { \
252  924400000, 0, {((DR_5 << 4) | DR_2)}, 0 \
253  }
254 #define AS923_LC8 \
255  { \
256  924600000, 0, {((DR_5 << 4) | DR_2)}, 0 \
257  }
258 #else
259 
263 #define AS923_LC1 \
264  { \
265  923200000, 0, {((DR_5 << 4) | DR_0)}, 0 \
266  }
267 
272 #define AS923_LC2 \
273  { \
274  923400000, 0, {((DR_5 << 4) | DR_0)}, 0 \
275  }
276 #define AS923_LC3 \
277  { \
278  923600000, 0, {((DR_5 << 4) | DR_0)}, 0 \
279  }
280 #define AS923_LC4 \
281  { \
282  923800000, 0, {((DR_5 << 4) | DR_0)}, 0 \
283  }
284 #define AS923_LC5 \
285  { \
286  924000000, 0, {((DR_5 << 4) | DR_0)}, 0 \
287  }
288 #define AS923_LC6 \
289  { \
290  924200000, 0, {((DR_5 << 4) | DR_0)}, 0 \
291  }
292 #define AS923_LC7 \
293  { \
294  924400000, 0, {((DR_5 << 4) | DR_0)}, 0 \
295  }
296 #define AS923_LC8 \
297  { \
298  924600000, 0, {((DR_5 << 4) | DR_0)}, 0 \
299  }
300 #endif
301 
305 #define AS923_JOIN_CHANNELS (uint16_t)(LC(1) | LC(2))
306 
310 #define AS923_RSSI_FREE_TH -85
311 
315 #define AS923_CARRIER_SENSE_TIME 6
316 
320  static const uint8_t DataratesAS923[] = {12, 11, 10, 9, 8, 7, 7, 50};
321 
325  static const uint32_t BandwidthsAS923[] = {125000, 125000, 125000, 125000, 125000, 125000, 250000, 0};
326 
331  // static const uint8_t MaxPayloadOfDatarateDwell0AS923[] = { 51, 51, 51, 115, 242, 242, 242, 242 };
332  static const uint8_t MaxPayloadOfDatarateDwell0AS923[] = {59, 59, 59, 123, 230, 230, 230, 230};
333 
339  // static const uint8_t MaxPayloadOfDatarateRepeaterDwell0AS923[] = { 51, 51, 51, 115, 222, 222, 222, 222 };
340  static const uint8_t MaxPayloadOfDatarateRepeaterDwell0AS923[] = {59, 59, 59, 123, 250, 250, 250, 250};
341 
346  // static const uint8_t MaxPayloadOfDatarateDwell1UpAS923[] = { 0, 0, 11, 53, 125, 242, 242, 242 };
347  static const uint8_t MaxPayloadOfDatarateDwell1UpAS923[] = {0, 0, 19, 61, 133, 250, 250, 250};
348 
353  // static const uint8_t MaxPayloadOfDatarateDwell1DownAS923[] = { 0, 0, 11, 53, 126, 242, 242, 242 };
354  static const uint8_t MaxPayloadOfDatarateDwell1DownAS923[] = {0, 0, 19, 61, 133, 250, 250, 250};
355 
359  static const int8_t EffectiveRx1DrOffsetAS923[] = {0, 1, 2, 3, 4, 5, -1, -2};
360 
369 
376 
383 
393  bool RegionAS923Verify(VerifyParams_t *verify, PhyAttribute_t phyAttribute);
394 
402 
411 
425  bool RegionAS923AdrNext(AdrNextParams_t *adrNext, int8_t *drOut, int8_t *txPowOut, uint32_t *adrAckCounter);
426 
440  void RegionAS923ComputeRxWindowParameters(int8_t datarate, uint8_t minRxSymbols, uint32_t rxError, RxConfigParams_t *rxConfigParams);
441 
451  bool RegionAS923RxConfig(RxConfigParams_t *rxConfig, int8_t *datarate);
452 
464  bool RegionAS923TxConfig(TxConfigParams_t *txConfig, int8_t *txPower, TimerTime_t *txTimeOnAir);
465 
481  uint8_t RegionAS923LinkAdrReq(LinkAdrReqParams_t *linkAdrReq, int8_t *drOut, int8_t *txPowOut, uint8_t *nbRepOut, uint8_t *nbBytesParsed);
482 
491 
500 
511 
520 
529 
536 
551  bool RegionAS923NextChannel(NextChanParams_t *nextChanParams, uint8_t *channel, TimerTime_t *time, TimerTime_t *aggregatedTimeOff);
552 
561 
570 
577 
589  uint8_t RegionAS923ApplyDrOffset(uint8_t downlinkDwellTime, int8_t dr, int8_t drOffset);
590 
598  bool RegionAS923SetVersion(uint8_t version);
600 };
601 #endif // __REGION_AS923_H__
RegionAS923DlChannelReq
uint8_t RegionAS923DlChannelReq(DlChannelReqParams_t *dlChannelReq)
The function processes a DlChannel Request.
sChannelRemoveParams
Definition: Region.h:1217
RegionAS923RxParamSetupReq
uint8_t RegionAS923RxParamSetupReq(RxParamSetupReqParams_t *rxParamSetupReq)
The function processes a RX Parameter Setup Request.
RegionAS923ChannelAdd
LoRaMacStatus_t RegionAS923ChannelAdd(ChannelAddParams_t *channelAdd)
Adds a channel.
LoRaMacStatus_t
enum eLoRaMacStatus LoRaMacStatus_t
MaxPayloadOfDatarateDwell1UpAS923
static const uint8_t MaxPayloadOfDatarateDwell1UpAS923[]
Definition: RegionAS923.h:347
sTxConfigParams
Definition: Region.h:999
InitType_t
enum eInitType InitType_t
sSetBandTxDoneParams
Definition: Region.h:832
sRxParamSetupReqParams
Definition: Region.h:1065
uVerifyParams
Definition: Region.h:850
sRxConfigParams
Definition: Region.h:948
RegionAS923GetPhyParam
PhyParam_t RegionAS923GetPhyParam(GetPhyParams_t *getPhy)
The function gets a value of a specific phy attribute.
BandwidthsAS923
static const uint32_t BandwidthsAS923[]
Definition: RegionAS923.h:325
RegionAS923NewChannelReq
uint8_t RegionAS923NewChannelReq(NewChannelReqParams_t *newChannelReq)
The function processes a Channel Request.
RegionAS923ApplyCFList
void RegionAS923ApplyCFList(ApplyCFListParams_t *applyCFList)
The function parses the input buffer and sets up the channels of the CF list.
sAlternateDrParams
Definition: Region.h:1133
sNewChannelReqParams
Definition: Region.h:1084
sContinuousWaveParams
Definition: Region.h:1228
RegionAS923NextChannel
bool RegionAS923NextChannel(NextChanParams_t *nextChanParams, uint8_t *channel, TimerTime_t *time, TimerTime_t *aggregatedTimeOff)
Searches and set the next random available channel.
sAdrNextParams
Definition: Region.h:917
RegionAS923SetBandTxDone
void RegionAS923SetBandTxDone(SetBandTxDoneParams_t *txDone)
Updates the last TX done parameters of the current channel.
sCalcBackOffParams
Definition: Region.h:1144
RegionAS923Verify
bool RegionAS923Verify(VerifyParams_t *verify, PhyAttribute_t phyAttribute)
Verifies a parameter.
sApplyCFListParams
Definition: Region.h:887
sTxParamSetupReqParams
Definition: Region.h:1099
sChanMaskSetParams
Definition: Region.h:902
RegionAS923ApplyDrOffset
uint8_t RegionAS923ApplyDrOffset(uint8_t downlinkDwellTime, int8_t dr, int8_t drOffset)
Computes new datarate according to the given offset.
RegionAS923SetContinuousWave
void RegionAS923SetContinuousWave(ContinuousWaveParams_t *continuousWave)
Sets the radio into continuous wave mode.
RegionAS923AlternateDr
int8_t RegionAS923AlternateDr(AlternateDrParams_t *alternateDr)
Alternates the datarate of the channel for the join request.
RegionAS923CalcBackOff
void RegionAS923CalcBackOff(CalcBackOffParams_t *calcBackOff)
Calculates the back-off time.
RegionAS923InitDefaults
void RegionAS923InitDefaults(InitType_t type)
Initializes the channels masks and the channels.
DataratesAS923
static const uint8_t DataratesAS923[]
Definition: RegionAS923.h:320
RegionAS923AdrNext
bool RegionAS923AdrNext(AdrNextParams_t *adrNext, int8_t *drOut, int8_t *txPowOut, uint32_t *adrAckCounter)
Calculates the next datarate to set, when ADR is on or off.
MaxPayloadOfDatarateRepeaterDwell0AS923
static const uint8_t MaxPayloadOfDatarateRepeaterDwell0AS923[]
Definition: RegionAS923.h:340
sNextChanParams
Definition: Region.h:1175
EffectiveRx1DrOffsetAS923
static const int8_t EffectiveRx1DrOffsetAS923[]
Definition: RegionAS923.h:359
uPhyParam
Definition: Region.h:780
MaxPayloadOfDatarateDwell1DownAS923
static const uint8_t MaxPayloadOfDatarateDwell1DownAS923[]
Definition: RegionAS923.h:354
sChannelAddParams
Definition: Region.h:1202
RegionAS923TxParamSetupReq
int8_t RegionAS923TxParamSetupReq(TxParamSetupReqParams_t *txParamSetupReq)
The function processes a TX ParamSetup Request.
RegionAS923ChannelsRemove
bool RegionAS923ChannelsRemove(ChannelRemoveParams_t *channelRemove)
Removes a channel.
sDlChannelReqParams
Definition: Region.h:1118
sGetPhyParams
Definition: Region.h:803
RegionAS923RxConfig
bool RegionAS923RxConfig(RxConfigParams_t *rxConfig, int8_t *datarate)
Configuration of the RX windows.
RegionAS923ComputeRxWindowParameters
void RegionAS923ComputeRxWindowParameters(int8_t datarate, uint8_t minRxSymbols, uint32_t rxError, RxConfigParams_t *rxConfigParams)
RegionAS923SetVersion
bool RegionAS923SetVersion(uint8_t version)
Adjust frequency band to AS923-1, AS923-2, AS923-3.
RegionAS923ChanMaskSet
bool RegionAS923ChanMaskSet(ChanMaskSetParams_t *chanMaskSet)
Sets a channels mask.
RegionAS923TxConfig
bool RegionAS923TxConfig(TxConfigParams_t *txConfig, int8_t *txPower, TimerTime_t *txTimeOnAir)
TX configuration.
MaxPayloadOfDatarateDwell0AS923
static const uint8_t MaxPayloadOfDatarateDwell0AS923[]
Definition: RegionAS923.h:332
RegionAS923LinkAdrReq
uint8_t RegionAS923LinkAdrReq(LinkAdrReqParams_t *linkAdrReq, int8_t *drOut, int8_t *txPowOut, uint8_t *nbRepOut, uint8_t *nbBytesParsed)
The function processes a Link ADR Request.
PhyAttribute_t
enum ePhyAttribute PhyAttribute_t
TimerTime_t
uint32_t TimerTime_t
Timer time variable definition.
Definition: timer.h:69