| SX126x-Arduino 2.0.1

Data Structures | Macros | Typedefs | Enumerations | Functions
Region implementation

This is the common API to access the specific regional implementations. More...

## Data Structures
union | uPhyParam
struct | sGetPhyParams
struct | sSetBandTxDoneParams
union | uVerifyParams
struct | sApplyCFListParams
struct | sChanMaskSetParams
struct | sAdrNextParams
struct | sRxConfigParams
struct | sTxConfigParams
struct | sLinkAdrReqParams
struct | sRxParamSetupReqParams
struct | sNewChannelReqParams
struct | sTxParamSetupReqParams
struct | sDlChannelReqParams
struct | sAlternateDrParams
struct | sCalcBackOffParams
struct | sNextChanParams
struct | sChannelAddParams
struct | sChannelRemoveParams
struct | sContinuousWaveParams

## Macros
#define | channel_mask_size 12
#define | LC(channelIndex) (uint16_t)(1 << (channelIndex - 1))
#define | DR_0 0
#define | DR_1 1
#define | DR_2 2
#define | DR_3 3
#define | DR_4 4
#define | DR_5 5
#define | DR_6 6
#define | DR_7 7
#define | DR_8 8
#define | DR_9 9
#define | DR_10 10
#define | DR_11 11
#define | DR_12 12
#define | DR_13 13
#define | DR_14 14
#define | DR_15 15
#define | TX_POWER_0 0
#define | TX_POWER_1 1
#define | TX_POWER_2 2
#define | TX_POWER_3 3
#define | TX_POWER_4 4
#define | TX_POWER_5 5
#define | TX_POWER_6 6
#define | TX_POWER_7 7
#define | TX_POWER_8 8
#define | TX_POWER_9 9
#define | TX_POWER_10 10
#define | TX_POWER_11 11
#define | TX_POWER_12 12
#define | TX_POWER_13 13
#define | TX_POWER_14 14
#define | TX_POWER_15 15

## Typedefs
typedef enum ePhyAttribute | PhyAttribute_t
typedef enum eInitType | InitType_t
typedef enum eChannelsMask | ChannelsMask_t
typedef union uPhyParam | PhyParam_t
typedef struct sGetPhyParams | GetPhyParams_t
typedef struct sSetBandTxDoneParams | SetBandTxDoneParams_t
typedef union uVerifyParams | VerifyParams_t
typedef struct sApplyCFListParams | ApplyCFListParams_t
typedef struct sChanMaskSetParams | ChanMaskSetParams_t
typedef struct sAdrNextParams | AdrNextParams_t
typedef struct sRxConfigParams | RxConfigParams_t
typedef struct sTxConfigParams | TxConfigParams_t
typedef struct sLinkAdrReqParams | LinkAdrReqParams_t
typedef struct sRxParamSetupReqParams | RxParamSetupReqParams_t
typedef struct sNewChannelReqParams | NewChannelReqParams_t
typedef struct sTxParamSetupReqParams | TxParamSetupReqParams_t
typedef struct sDlChannelReqParams | DlChannelReqParams_t
typedef struct sAlternateDrParams | AlternateDrParams_t
typedef struct sCalcBackOffParams | CalcBackOffParams_t
typedef struct sNextChanParams | NextChanParams_t
typedef struct sChannelAddParams | ChannelAddParams_t
typedef struct sChannelRemoveParams | ChannelRemoveParams_t
typedef struct sContinuousWaveParams | ContinuousWaveParams_t

## Enumerations
enum | ePhyAttribute { PHY_MIN_RX_DR, PHY_MIN_TX_DR, PHY_MAX_RX_DR, PHY_MAX_TX_DR, PHY_TX_DR, PHY_DEF_TX_DR, PHY_RX_DR, PHY_TX_POWER, PHY_DEF_TX_POWER, PHY_MAX_PAYLOAD, PHY_MAX_PAYLOAD_REPEATER, PHY_DUTY_CYCLE, PHY_MAX_RX_WINDOW, PHY_RECEIVE_DELAY1, PHY_RECEIVE_DELAY2, PHY_JOIN_ACCEPT_DELAY1, PHY_JOIN_ACCEPT_DELAY2, PHY_MAX_FCNT_GAP, PHY_ACK_TIMEOUT, PHY_DEF_DR1_OFFSET, PHY_DEF_RX2_FREQUENCY, PHY_DEF_RX2_DR, PHY_CHANNELS_MASK, PHY_CHANNELS_DEFAULT_MASK, PHY_MAX_NB_CHANNELS, PHY_CHANNELS, PHY_DEF_UPLINK_DWELL_TIME, PHY_DEF_DOWNLINK_DWELL_TIME, PHY_DEF_MAX_EIRP, PHY_DEF_ANTENNA_GAIN, PHY_NB_JOIN_TRIALS, PHY_DEF_NB_JOIN_TRIALS, PHY_NEXT_LOWER_TX_DR }
enum | eInitType { INIT_TYPE_INIT, INIT_TYPE_RESTORE, INIT_TYPE_APP_DEFAULTS }
enum | eChannelsMask { CHANNELS_MASK, CHANNELS_DEFAULT_MASK }

## Functions
bool | RegionIsActive (LoRaMacRegion_t region)
| The function verifies if a region is active or not. If a region is not active, it cannot be used. More...
PhyParam_t | RegionGetPhyParam (LoRaMacRegion_t region, GetPhyParams_t *getPhy)
| The function gets a value of a specific phy attribute. More...
void | RegionSetBandTxDone (LoRaMacRegion_t region, SetBandTxDoneParams_t *txDone)
| Updates the last TX done parameters of the current channel. More...
void | RegionInitDefaults (LoRaMacRegion_t region, InitType_t type)
| Initializes the channels masks and the channels. More...
bool | RegionVerify (LoRaMacRegion_t region, VerifyParams_t *verify, PhyAttribute_t phyAttribute)
| Verifies a parameter. More...
void | RegionApplyCFList (LoRaMacRegion_t region, ApplyCFListParams_t *applyCFList)
| The function parses the input buffer and sets up the channels of the CF list. More...
bool | RegionChanMaskSet (LoRaMacRegion_t region, ChanMaskSetParams_t *chanMaskSet)
| Sets a channels mask. More...
bool | RegionAdrNext (LoRaMacRegion_t region, AdrNextParams_t *adrNext, int8_t *drOut, int8_t *txPowOut, uint32_t *adrAckCounter)
| Calculates the next datarate to set, when ADR is on or off. More...
bool | RegionRxConfig (LoRaMacRegion_t region, RxConfigParams_t *rxConfig, int8_t *datarate)
| Configuration of the RX windows. More...
void | RegionComputeRxWindowParameters (LoRaMacRegion_t region, int8_t datarate, uint8_t minRxSymbols, uint32_t rxError, RxConfigParams_t *rxConfigParams)
bool | RegionTxConfig (LoRaMacRegion_t region, TxConfigParams_t *txConfig, int8_t *txPower, TimerTime_t *txTimeOnAir)
| TX configuration. More...
uint8_t | RegionLinkAdrReq (LoRaMacRegion_t region, LinkAdrReqParams_t *linkAdrReq, int8_t *drOut, int8_t *txPowOut, uint8_t *nbRepOut, uint8_t *nbBytesParsed)
| The function processes a Link ADR Request. More...
uint8_t | RegionRxParamSetupReq (LoRaMacRegion_t region, RxParamSetupReqParams_t *rxParamSetupReq)
| The function processes a RX Parameter Setup Request. More...
uint8_t | RegionNewChannelReq (LoRaMacRegion_t region, NewChannelReqParams_t *newChannelReq)
| The function processes a New Channel Request. More...
int8_t | RegionTxParamSetupReq (LoRaMacRegion_t region, TxParamSetupReqParams_t *txParamSetupReq)
| The function processes a TX ParamSetup Request. More...
uint8_t | RegionDlChannelReq (LoRaMacRegion_t region, DlChannelReqParams_t *dlChannelReq)
| The function processes a DlChannel Request. More...
int8_t | RegionAlternateDr (LoRaMacRegion_t region, AlternateDrParams_t *alternateDr)
| Alternates the datarate of the channel for the join request. More...
void | RegionCalcBackOff (LoRaMacRegion_t region, CalcBackOffParams_t *calcBackOff)
| Calculates the back-off time. More...
bool | RegionNextChannel (LoRaMacRegion_t region, NextChanParams_t *nextChanParams, uint8_t *channel, TimerTime_t *time, TimerTime_t *aggregatedTimeOff)
| Searches and set the next random available channel. More...
LoRaMacStatus_t | RegionChannelAdd (LoRaMacRegion_t region, ChannelAddParams_t *channelAdd)
| Adds a channel. More...
bool | RegionChannelsRemove (LoRaMacRegion_t region, ChannelRemoveParams_t *channelRemove)
| Removes a channel. More...
void | RegionSetContinuousWave (LoRaMacRegion_t region, ContinuousWaveParams_t *continuousWave)
| Sets the radio into continuous wave mode. More...
uint8_t | RegionApplyDrOffset (LoRaMacRegion_t region, uint8_t downlinkDwellTime, int8_t dr, int8_t drOffset)
| Computes new datarate according to the given offset. More...

## Detailed Description

This is the common API to access the specific regional implementations.

Preprocessor options:

- LoRaWAN regions can be activated by defining the related preprocessor definition. It is possible to define more than one region. The following regions are supported:
  - # REGION_AS923
  - # REGION_AU915
  - # REGION_CN470
  - # REGION_CN779
  - # REGION_EU433
  - # REGION_EU868
  - # REGION_KR920
  - # REGION_IN865
  - # REGION_US915
  - # REGION_US915_HYBRID

## Macro Definition Documentation

## ◆ channel_mask_size

#define channel_mask_size 12

## ◆ LC

#define LC | ( |  | channelIndex | ) | (uint16_t)(1 << (channelIndex - 1))

Macro to compute bit of a channel index.

## ◆ DR_0

#define DR_0 0

Region | SF
--- | ---
AS923 | SF12 - BW125
AU915 | SF10 - BW125
CN470 | SF12 - BW125
CN779 | SF12 - BW125
EU433 | SF12 - BW125
EU868 | SF12 - BW125
IN865 | SF12 - BW125
KR920 | SF12 - BW125
US915 | SF10 - BW125
US923-2 | SF12 - BW125
US923-3 | SF12 - BW125
US923-4 | SF12 - BW125
RU864 | SF12 - BW125

## ◆ DR_1

#define DR_1 1

Region | SF
--- | ---
AS923 | SF11 - BW125
AU915 | SF9 - BW125
CN470 | SF11 - BW125
CN779 | SF11 - BW125
EU433 | SF11 - BW125
EU868 | SF11 - BW125
IN865 | SF11 - BW125
KR920 | SF11 - BW125
US915 | SF9 - BW125
AS923-2 | SF11 - BW125
AS923-3 | SF11 - BW125
AS923-4 | SF11 - BW125
RU864 | SF11 - BW125

## ◆ DR_2

#define DR_2 2

Region | SF
--- | ---
AS923 | SF10 - BW125
AU915 | SF8 - BW125
CN470 | SF10 - BW125
CN779 | SF10 - BW125
EU433 | SF10 - BW125
EU868 | SF10 - BW125
IN865 | SF10 - BW125
KR920 | SF10 - BW125
US915 | SF8 - BW125
AS923-2 | SF10 - BW125
AS923-3 | SF10 - BW125
AS923-4 | SF10 - BW125
RU864 | SF10 - BW125

## ◆ DR_3

#define DR_3 3

Region | SF
--- | ---
AS923 | SF9 - BW125
AU915 | SF7 - BW125
CN470 | SF9 - BW125
CN779 | SF9 - BW125
EU433 | SF9 - BW125
EU868 | SF9 - BW125
IN865 | SF9 - BW125
KR920 | SF9 - BW125
US915 | SF7 - BW125
AS923-2 | SF9 - BW125
AS923-3 | SF9 - BW125
AS923-4 | SF9 - BW125
RU864 | SF9 - BW125

## ◆ DR_4

#define DR_4 4

Region | SF
--- | ---
AS923 | SF8 - BW125
AU915 | SF8 - BW500
CN470 | SF8 - BW125
CN779 | SF8 - BW125
EU433 | SF8 - BW125
EU868 | SF8 - BW125
IN865 | SF8 - BW125
KR920 | SF8 - BW125
US915 | SF8 - BW500
AS923-2 | SF8 - BW125
AS923-3 | SF8 - BW125
AS923-4 | SF8 - BW125
RU864 | SF8 - BW125

## ◆ DR_5

#define DR_5 5

Region | SF
--- | ---
AS923 | SF7 - BW125
AU915 | RFU
CN470 | SF7 - BW125
CN779 | SF7 - BW125
EU433 | SF7 - BW125
EU868 | SF7 - BW125
IN865 | SF7 - BW125
KR920 | SF7 - BW125
US915 | RFU
AS923-2 | SF7 - BW125
AS923-3 | SF7 - BW125
AS923-4 | SF7 - BW125
RU864 | SF7 - BW125

## ◆ DR_6

#define DR_6 6

Region | SF
--- | ---
AS923 | SF7 - BW250
AU915 | RFU
CN470 | SF12 - BW125
CN779 | SF7 - BW250
EU433 | SF7 - BW250
EU868 | SF7 - BW250
IN865 | SF7 - BW250
KR920 | RFU
US915 | RFU
AS923-2 | SF7 - BW250
AS923-3 | SF7 - BW250
AS923-4 | SF7 - BW250
RU864 | SF7 - BW250

## ◆ DR_7

#define DR_7 7

Region | SF
--- | ---
AS923 | FSK
AU915 | RFU
CN470 | SF12 - BW125
CN779 | FSK
EU433 | FSK
EU868 | FSK
IN865 | FSK
KR920 | RFU
US915 | RFU
AS923-2 | FSK
AS923-3 | FSK
AS923-4 | FSK
RU864 | FSK

## ◆ DR_8

#define DR_8 8

Region | SF
--- | ---
AS923 | RFU
AU915 | SF12 - BW500
CN470 | RFU
CN779 | RFU
EU433 | RFU
EU868 | RFU
IN865 | RFU
KR920 | RFU
US915 | SF12 - BW500
AS923-2 | RFU
AS923-3 | RFU
AS923-4 | RFU
RU864 | RFU

## ◆ DR_9

#define DR_9 9

Region | SF
--- | ---
AS923 | RFU
AU915 | SF11 - BW500
CN470 | RFU
CN779 | RFU
EU433 | RFU
EU868 | RFU
IN865 | RFU
KR920 | RFU
US915 | SF11 - BW500
AS923-2 | RFU
AS923-3 | RFU
AS923-4 | RFU
RU864 | RFU

## ◆ DR_10

#define DR_10 10

Region | SF
--- | ---
AS923 | RFU
AU915 | SF10 - BW500
CN470 | RFU
CN779 | RFU
EU433 | RFU
EU868 | RFU
IN865 | RFU
KR920 | RFU
US915 | SF10 - BW500
AS923-2 | RFU
AS923-3 | RFU
AS923-4 | RFU
RU864 | RFU

## ◆ DR_11

#define DR_11 11

Region | SF
--- | ---
AS923 | RFU
AU915 | SF9 - BW500
CN470 | RFU
CN779 | RFU
EU433 | RFU
EU868 | RFU
IN865 | RFU
KR920 | RFU
US915 | SF9 - BW500
AS923-2 | RFU
AS923-3 | RFU
AS923-4 | RFU
RU864 | RFU

## ◆ DR_12

#define DR_12 12

Region | SF
--- | ---
AS923 | RFU
AU915 | SF8 - BW500
CN470 | RFU
CN779 | RFU
EU433 | RFU
EU868 | RFU
IN865 | RFU
KR920 | RFU
US915 | SF8 - BW500
AS923-2 | RFU
AS923-3 | RFU
AS923-4 | RFU
RU864 | RFU

## ◆ DR_13

#define DR_13 13

Region | SF
--- | ---
AS923 | RFU
AU915 | SF7 - BW500
CN470 | RFU
CN779 | RFU
EU433 | RFU
EU868 | RFU
IN865 | RFU
KR920 | RFU
US915 | SF7 - BW500
AS923-2 | RFU
AS923-3 | RFU
AS923-4 | RFU
RU864 | RFU

## ◆ DR_14

#define DR_14 14

Region | SF
--- | ---
AS923 | RFU
AU915 | RFU
CN470 | RFU
CN779 | RFU
EU433 | RFU
EU868 | RFU
IN865 | RFU
KR920 | RFU
US915 | RFU
AS923-2 | RFU
AS923-3 | RFU
AS923-4 | RFU
RU864 | RFU

## ◆ DR_15

#define DR_15 15

Region | SF
--- | ---
AS923 | RFU
AU915 | RFU
CN470 | RFU
CN779 | RFU
EU433 | RFU
EU868 | RFU
IN865 | RFU
KR920 | RFU
US915 | RFU
AS923-2 | RFU
AS923-3 | RFU
AS923-4 | RFU
RU864 | RFU

## ◆ TX_POWER_0

#define TX_POWER_0 0

Region | dBM
--- | ---
AS923 | Max EIRP
AU915 | Max EIRP
CN470 | Max EIRP
CN779 | Max EIRP
EU433 | Max EIRP
EU868 | Max EIRP
IN865 | Max EIRP
KR920 | Max EIRP
US915 | Max EIRP
AS923-2 | Max EIRP
AS923-3 | Max EIRP
AS923-4 | Max EIRP
RU864 | Max EIRP

## ◆ TX_POWER_1

#define TX_POWER_1 1

Region | dBM
--- | ---
AS923 | Max EIRP - 2
AU915 | Max EIRP - 2
CN470 | Max EIRP - 2
CN779 | Max EIRP - 2
EU433 | Max EIRP - 2
EU868 | Max EIRP - 2
IN865 | Max EIRP - 2
KR920 | Max EIRP - 2
US915 | Max EIRP - 2
AS923-2 | Max EIRP - 2
AS923-3 | Max EIRP - 2
AS923-4 | Max EIRP - 2
RU864 | Max EIRP - 2

## ◆ TX_POWER_2

#define TX_POWER_2 2

Region | dBM
--- | ---
AS923 | Max EIRP - 4
AU915 | Max EIRP - 4
CN470 | Max EIRP - 4
CN779 | Max EIRP - 4
EU433 | Max EIRP - 4
EU868 | Max EIRP - 4
IN865 | Max EIRP - 4
KR920 | Max EIRP - 4
US915 | Max EIRP - 4
AS923-2 | Max EIRP - 4
AS923-3 | Max EIRP - 4
AS923-4 | Max EIRP - 4
RU864 | Max EIRP - 4

## ◆ TX_POWER_3

#define TX_POWER_3 3

Region | dBM
--- | ---
AS923 | Max EIRP - 6
AU915 | Max EIRP - 6
CN470 | Max EIRP - 6
CN779 | Max EIRP - 6
EU433 | Max EIRP - 6
EU868 | Max EIRP - 6
IN865 | Max EIRP - 6
KR920 | Max EIRP - 6
US915 | Max EIRP - 6
AS923-2 | Max EIRP - 6
AS923-3 | Max EIRP - 6
AS923-4 | Max EIRP - 6
RU864 | Max EIRP - 6

## ◆ TX_POWER_4

#define TX_POWER_4 4

Region | dBM
--- | ---
AS923 | Max EIRP - 8
AU915 | Max EIRP - 8
CN470 | Max EIRP - 8
CN779 | Max EIRP - 8
EU433 | Max EIRP - 8
EU868 | Max EIRP - 8
IN865 | Max EIRP - 8
KR920 | Max EIRP - 8
US915 | Max EIRP - 8
AS923-2 | Max EIRP - 8
AS923-3 | Max EIRP - 8
AS923-4 | Max EIRP - 8
RU864 | Max EIRP - 8

## ◆ TX_POWER_5

#define TX_POWER_5 5

Region | dBM
--- | ---
AS923 | Max EIRP - 10
AU915 | Max EIRP - 10
CN470 | Max EIRP - 10
CN779 | Max EIRP - 10
EU433 | Max EIRP - 10
EU868 | Max EIRP - 10
IN865 | Max EIRP - 10
KR920 | Max EIRP - 10
US915 | Max EIRP - 10
AS923-2 | Max EIRP - 10
AS923-3 | Max EIRP - 10
AS923-4 | Max EIRP - 10
RU864 | Max EIRP - 10

## ◆ TX_POWER_6

#define TX_POWER_6 6

Region | dBM
--- | ---
AS923 | Max EIRP - 12
AU915 | Max EIRP - 12
CN470 | Max EIRP - 12
CN779 | -
EU433 | -
EU868 | Max EIRP - 12
IN865 | Max EIRP - 12
KR920 | Max EIRP - 12
US915 | Max EIRP - 12
AS923-2 | Max EIRP - 12
AS923-3 | Max EIRP - 12
AS923-4 | Max EIRP - 12
RU864 | Max EIRP - 12

## ◆ TX_POWER_7

#define TX_POWER_7 7

Region | dBM
--- | ---
AS923 | Max EIRP - 14
AU915 | Max EIRP - 14
CN470 | Max EIRP - 14
CN779 | -
EU433 | -
EU868 | Max EIRP - 14
IN865 | Max EIRP - 14
KR920 | Max EIRP - 14
US915 | Max EIRP - 14
AS923-2 | Max EIRP - 14
AS923-3 | Max EIRP - 14
AS923-4 | Max EIRP - 14
RU864 | Max EIRP - 14

## ◆ TX_POWER_8

#define TX_POWER_8 8

Region | dBM
--- | ---
AS923 | -
AU915 | Max EIRP - 16
CN470 | -
CN779 | -
EU433 | -
EU868 | -
IN865 | Max EIRP - 16
KR920 | -
US915 | Max EIRP - 16
AS923-2 | -
AS923-3 | -
AS923-4 | -
RU864 | -

## ◆ TX_POWER_9

#define TX_POWER_9 9

Region | dBM
--- | ---
AS923 | -
AU915 | Max EIRP - 18
CN470 | -
CN779 | -
EU433 | -
EU868 | -
IN865 | Max EIRP - 18
KR920 | -
US915 | Max EIRP - 16
AS923-2 | -
AS923-3 | -
AS923-4 | -
RU864 | -

## ◆ TX_POWER_10

#define TX_POWER_10 10

Region | dBM
--- | ---
AS923 | -
AU915 | Max EIRP - 20
CN470 | -
CN779 | -
EU433 | -
EU868 | -
IN865 | Max EIRP - 20
KR920 | -
US915 | Max EIRP - 10
AS923-2 | -
AS923-3 | -
AS923-4 | -
RU864 | -

## ◆ TX_POWER_11

#define TX_POWER_11 11

RFU

## ◆ TX_POWER_12

#define TX_POWER_12 12

RFU

## ◆ TX_POWER_13

#define TX_POWER_13 13

RFU

## ◆ TX_POWER_14

#define TX_POWER_14 14

RFU

## ◆ TX_POWER_15

#define TX_POWER_15 15

RFU

## Typedef Documentation

## ◆ PhyAttribute_t

typedef enum ePhyAttribute PhyAttribute_t

Enumeration of phy attributes.

## ◆ InitType_t

typedef enum eInitType InitType_t

Enumeration of initialization types.

## ◆ ChannelsMask_t

typedef enum eChannelsMask ChannelsMask_t

## ◆ PhyParam_t

typedef union uPhyParam PhyParam_t

Union for the structure uGetPhyParams

## ◆ GetPhyParams_t

typedef struct sGetPhyParams GetPhyParams_t

Parameter structure for the function RegionGetPhyParam.

## ◆ SetBandTxDoneParams_t

typedef struct sSetBandTxDoneParams SetBandTxDoneParams_t

Parameter structure for the function RegionSetBandTxDone.

## ◆ VerifyParams_t

typedef union uVerifyParams VerifyParams_t

Parameter structure for the function RegionVerify.

## ◆ ApplyCFListParams_t

typedef struct sApplyCFListParams ApplyCFListParams_t

Parameter structure for the function RegionApplyCFList.

## ◆ ChanMaskSetParams_t

typedef struct sChanMaskSetParams ChanMaskSetParams_t

Parameter structure for the function RegionChanMaskSet.

## ◆ AdrNextParams_t

typedef struct sAdrNextParams AdrNextParams_t

Parameter structure for the function RegionAdrNext.

## ◆ RxConfigParams_t

typedef struct sRxConfigParams RxConfigParams_t

Parameter structure for the function RegionRxConfig.

## ◆ TxConfigParams_t

typedef struct sTxConfigParams TxConfigParams_t

Parameter structure for the function RegionTxConfig.

## ◆ LinkAdrReqParams_t

typedef struct sLinkAdrReqParams LinkAdrReqParams_t

Parameter structure for the function RegionLinkAdrReq.

## ◆ RxParamSetupReqParams_t

typedef struct sRxParamSetupReqParams RxParamSetupReqParams_t

Parameter structure for the function RegionRxParamSetupReq.

## ◆ NewChannelReqParams_t

typedef struct sNewChannelReqParams NewChannelReqParams_t

Parameter structure for the function RegionNewChannelReq.

## ◆ TxParamSetupReqParams_t

typedef struct sTxParamSetupReqParams TxParamSetupReqParams_t

Parameter structure for the function RegionTxParamSetupReq.

## ◆ DlChannelReqParams_t

typedef struct sDlChannelReqParams DlChannelReqParams_t

Parameter structure for the function RegionDlChannelReq.

## ◆ AlternateDrParams_t

typedef struct sAlternateDrParams AlternateDrParams_t

Parameter structure for the function RegionAlternateDr.

## ◆ CalcBackOffParams_t

typedef struct sCalcBackOffParams CalcBackOffParams_t

Parameter structure for the function RegionCalcBackOff.

## ◆ NextChanParams_t

typedef struct sNextChanParams NextChanParams_t

Parameter structure for the function RegionNextChannel.

## ◆ ChannelAddParams_t

typedef struct sChannelAddParams ChannelAddParams_t

Parameter structure for the function RegionChannelsAdd.

## ◆ ChannelRemoveParams_t

typedef struct sChannelRemoveParams ChannelRemoveParams_t

Parameter structure for the function RegionChannelsRemove.

## ◆ ContinuousWaveParams_t

typedef struct sContinuousWaveParams ContinuousWaveParams_t

Parameter structure for the function RegionContinuousWave.

## Enumeration Type Documentation

## ◆ ePhyAttribute

enum ePhyAttribute

Enumeration of phy attributes.

Enumerator
PHY_MIN_RX_DR | Minimum RX datarate.
PHY_MIN_TX_DR | Minimum TX datarate.
PHY_MAX_RX_DR | Maximum RX datarate.
PHY_MAX_TX_DR | Maximum TX datarate.
PHY_TX_DR | TX datarate.
PHY_DEF_TX_DR | Default TX datarate.
PHY_RX_DR | RX datarate.
PHY_TX_POWER | TX power.
PHY_DEF_TX_POWER | Default TX power.
PHY_MAX_PAYLOAD | Maximum payload possible.
PHY_MAX_PAYLOAD_REPEATER | Maximum payload possible when repeater support is enabled.
PHY_DUTY_CYCLE | Duty cycle.
PHY_MAX_RX_WINDOW | Maximum receive window duration.
PHY_RECEIVE_DELAY1 | Receive delay for window 1.
PHY_RECEIVE_DELAY2 | Receive delay for window 2.
PHY_JOIN_ACCEPT_DELAY1 | Join accept delay for window 1.
PHY_JOIN_ACCEPT_DELAY2 | Join accept delay for window 2.
PHY_MAX_FCNT_GAP | Maximum frame counter gap.
PHY_ACK_TIMEOUT | Acknowledgement time out.
PHY_DEF_DR1_OFFSET | Default datarate offset for window 1.
PHY_DEF_RX2_FREQUENCY | Default receive window 2 frequency.
PHY_DEF_RX2_DR | Default receive window 2 datarate.
PHY_CHANNELS_MASK | Channels mask.
PHY_CHANNELS_DEFAULT_MASK | Channels default mask.
PHY_MAX_NB_CHANNELS | Maximum number of supported channels
PHY_CHANNELS | Channels.
PHY_DEF_UPLINK_DWELL_TIME | Default value of the uplink dwell time.
PHY_DEF_DOWNLINK_DWELL_TIME | Default value of the downlink dwell time.
PHY_DEF_MAX_EIRP | Default value of the MaxEIRP.
PHY_DEF_ANTENNA_GAIN | Default value of the antenna gain.
PHY_NB_JOIN_TRIALS | Value for the number of join trials.
PHY_DEF_NB_JOIN_TRIALS | Default value for the number of join trials.
PHY_NEXT_LOWER_TX_DR | Next lower datarate.

## ◆ eInitType

enum eInitType

Enumeration of initialization types.

Enumerator
INIT_TYPE_INIT | Initializes the region specific data to defaults, according to the LoRaWAN specification.
INIT_TYPE_RESTORE | Restores default channels defined by the LoRaWAN specification only.
INIT_TYPE_APP_DEFAULTS | Initializes the region specific data to the defaults which were set by the application.

## ◆ eChannelsMask

enum eChannelsMask

Enumerator
CHANNELS_MASK | The channels mask.
CHANNELS_DEFAULT_MASK | The channels default mask.

## Function Documentation

## ◆ RegionIsActive()

bool RegionIsActive | ( | LoRaMacRegion_t | region | ) |

The function verifies if a region is active or not. If a region is not active, it cannot be used.

Parameters

  region | LoRaWAN region.

Return values

  Return | true, if the region is supported.

## ◆ RegionGetPhyParam()

PhyParam_t RegionGetPhyParam | ( | LoRaMacRegion_t | region,
|  | GetPhyParams_t * | getPhy
| ) |  |

The function gets a value of a specific phy attribute.

Parameters

  region | LoRaWAN region.
  getPhy | Pointer to the function parameters.

Return values

  Returns | a structure containing the PHY parameter.

## ◆ RegionSetBandTxDone()

void RegionSetBandTxDone | ( | LoRaMacRegion_t | region,
|  | SetBandTxDoneParams_t * | txDone
| ) |  |

Updates the last TX done parameters of the current channel.

Parameters

  region | LoRaWAN region.
  txDone | Pointer to the function parameters.

## ◆ RegionInitDefaults()

void RegionInitDefaults | ( | LoRaMacRegion_t | region,
|  | InitType_t | type
| ) |  |

Initializes the channels masks and the channels.

Parameters

  region | LoRaWAN region.
  type | Sets the initialization type.

## ◆ RegionVerify()

bool RegionVerify | ( | LoRaMacRegion_t | region,
|  | VerifyParams_t * | verify,
|  | PhyAttribute_t | phyAttribute
| ) |  |

Verifies a parameter.

Parameters

  region | LoRaWAN region.
  verify | Pointer to the function parameters.
  phyAttribute | Sets the initialization type.

Return values

  Returns | true, if the parameter is valid.

## ◆ RegionApplyCFList()

void RegionApplyCFList | ( | LoRaMacRegion_t | region,
|  | ApplyCFListParams_t * | applyCFList
| ) |  |

The function parses the input buffer and sets up the channels of the CF list.

Parameters

  region | LoRaWAN region.
  applyCFList | Pointer to the function parameters.

## ◆ RegionChanMaskSet()

bool RegionChanMaskSet | ( | LoRaMacRegion_t | region,
|  | ChanMaskSetParams_t * | chanMaskSet
| ) |  |

Sets a channels mask.

Parameters

  region | LoRaWAN region.
  chanMaskSet | Pointer to the function parameters.

Return values

  Returns | true, if the channels mask could be set.

## ◆ RegionAdrNext()

bool RegionAdrNext | ( | LoRaMacRegion_t | region,
|  | AdrNextParams_t * | adrNext,
|  | int8_t * | drOut,
|  | int8_t * | txPowOut,
|  | uint32_t * | adrAckCounter
| ) |  |

Calculates the next datarate to set, when ADR is on or off.

Parameters

  region | LoRaWAN region.
  adrNext | Pointer to the function parameters.
  drOut | The calculated datarate for the next TX.
  txPowOut | The TX power for the next TX.
  adrAckCounter | The calculated ADR acknowledgement counter.

Return values

  Returns | true, if an ADR request should be performed.

## ◆ RegionRxConfig()

bool RegionRxConfig | ( | LoRaMacRegion_t | region,
|  | RxConfigParams_t * | rxConfig,
|  | int8_t * | datarate
| ) |  |

Configuration of the RX windows.

Parameters

  region | LoRaWAN region.
  rxConfig | Pointer to the function parameters.
  datarate | The datarate index which was set.

Return values

  Returns | true, if the configuration was applied successfully.

## ◆ RegionComputeRxWindowParameters()

void RegionComputeRxWindowParameters | ( | LoRaMacRegion_t | region,
|  | int8_t | datarate,
|  | uint8_t | minRxSymbols,
|  | uint32_t | rxError,
|  | RxConfigParams_t * | rxConfigParams
| ) |  |

Computes the Rx window timeout and offset.

Parameters

  region | LoRaWAN region.
  datarate | Rx window datarate index to be used
  minRxSymbols | Minimum required number of symbols to detect an Rx frame.
  rxError | System maximum timing error of the receiver. In milliseconds The receiver will turn on in a [-rxError : +rxError] ms interval around RxOffset
  rxConfigParams | Returns updated WindowTimeout and WindowOffset fields.

## ◆ RegionTxConfig()

bool RegionTxConfig | ( | LoRaMacRegion_t | region,
|  | TxConfigParams_t * | txConfig,
|  | int8_t * | txPower,
|  | TimerTime_t * | txTimeOnAir
| ) |  |

TX configuration.

Parameters

  region | LoRaWAN region.
  txConfig | Pointer to the function parameters.
  txPower | The tx power index which was set.
  txTimeOnAir | The time-on-air of the frame.

Return values

  Returns | true, if the configuration was applied successfully.

## ◆ RegionLinkAdrReq()

uint8_t RegionLinkAdrReq | ( | LoRaMacRegion_t | region,
|  | LinkAdrReqParams_t * | linkAdrReq,
|  | int8_t * | drOut,
|  | int8_t * | txPowOut,
|  | uint8_t * | nbRepOut,
|  | uint8_t * | nbBytesParsed
| ) |  |

The function processes a Link ADR Request.

Parameters

  region | LoRaWAN region.
  linkAdrReq | Pointer to the function parameters.
  drOut | The datarate which was applied.
  txPowOut | The TX power which was applied.
  nbRepOut | The number of repetitions to apply.
  nbBytesParsed | The number bytes which were parsed.

Return values

  Returns | the status of the operation, according to the LoRaMAC specification.

## ◆ RegionRxParamSetupReq()

uint8_t RegionRxParamSetupReq | ( | LoRaMacRegion_t | region,
|  | RxParamSetupReqParams_t * | rxParamSetupReq
| ) |  |

The function processes a RX Parameter Setup Request.

Parameters

  region | LoRaWAN region.
  rxParamSetupReq | Pointer to the function parameters.

Return values

  Returns | the status of the operation, according to the LoRaMAC specification.

## ◆ RegionNewChannelReq()

uint8_t RegionNewChannelReq | ( | LoRaMacRegion_t | region,
|  | NewChannelReqParams_t * | newChannelReq
| ) |  |

The function processes a New Channel Request.

Parameters

  region | LoRaWAN region.
  newChannelReq | Pointer to the function parameters.

Return values

  Returns | the status of the operation, according to the LoRaMAC specification.

## ◆ RegionTxParamSetupReq()

int8_t RegionTxParamSetupReq | ( | LoRaMacRegion_t | region,
|  | TxParamSetupReqParams_t * | txParamSetupReq
| ) |  |

The function processes a TX ParamSetup Request.

Parameters

  region | LoRaWAN region.
  txParamSetupReq | Pointer to the function parameters.

Return values

  Returns | the status of the operation, according to the LoRaMAC specification. Returns -1, if the functionality is not implemented. In this case, the end node shall ignore the command.

## ◆ RegionDlChannelReq()

uint8_t RegionDlChannelReq | ( | LoRaMacRegion_t | region,
|  | DlChannelReqParams_t * | dlChannelReq
| ) |  |

The function processes a DlChannel Request.

Parameters

  region | LoRaWAN region.
  dlChannelReq | Pointer to the function parameters.

Return values

  Returns | the status of the operation, according to the LoRaMAC specification.

## ◆ RegionAlternateDr()

int8_t RegionAlternateDr | ( | LoRaMacRegion_t | region,
|  | AlternateDrParams_t * | alternateDr
| ) |  |

Alternates the datarate of the channel for the join request.

Parameters

  region | LoRaWAN region.
  alternateDr | Pointer to the function parameters.

Return values

  Datarate | to apply.

## ◆ RegionCalcBackOff()

void RegionCalcBackOff | ( | LoRaMacRegion_t | region,
|  | CalcBackOffParams_t * | calcBackOff
| ) |  |

Calculates the back-off time.

Parameters

  region | LoRaWAN region.
  calcBackOff | Pointer to the function parameters.

## ◆ RegionNextChannel()

bool RegionNextChannel | ( | LoRaMacRegion_t | region,
|  | NextChanParams_t * | nextChanParams,
|  | uint8_t * | channel,
|  | TimerTime_t * | time,
|  | TimerTime_t * | aggregatedTimeOff
| ) |  |

Searches and set the next random available channel.

Parameters

  region | LoRaWAN region.
  nextChanParams | parameter for next channel to use for TX.
  channel | Next channel to use for TX.
  time | Time to wait for the next transmission according to the duty cycle.
  aggregatedTimeOff | Updates the aggregated time off.

Return values

  Function | status [1: OK, 0: Unable to find a channel on the current datarate].

## ◆ RegionChannelAdd()

LoRaMacStatus_t RegionChannelAdd | ( | LoRaMacRegion_t | region,
|  | ChannelAddParams_t * | channelAdd
| ) |  |

Adds a channel.

Parameters

  region | LoRaWAN region.
  channelAdd | Pointer to the function parameters.

Return values

  Status | of the operation.

## ◆ RegionChannelsRemove()

bool RegionChannelsRemove | ( | LoRaMacRegion_t | region,
|  | ChannelRemoveParams_t * | channelRemove
| ) |  |

Removes a channel.

Parameters

  region | LoRaWAN region.
  channelRemove | Pointer to the function parameters.

Return values

  Returns | true, if the channel was removed successfully.

## ◆ RegionSetContinuousWave()

void RegionSetContinuousWave | ( | LoRaMacRegion_t | region,
|  | ContinuousWaveParams_t * | continuousWave
| ) |  |

Sets the radio into continuous wave mode.

Parameters

  region | LoRaWAN region.
  continuousWave | Pointer to the function parameters.

## ◆ RegionApplyDrOffset()

uint8_t RegionApplyDrOffset | ( | LoRaMacRegion_t | region,
|  | uint8_t | downlinkDwellTime,
|  | int8_t | dr,
|  | int8_t | drOffset
| ) |  |

Computes new datarate according to the given offset.

Parameters

  region | LoRaWAN region.
  downlinkDwellTime | Downlink dwell time configuration. 0: No limit, 1: 400ms
  dr | Current datarate
  drOffset | Offset to be applied

Return values

  newDr | Computed datarate.