SX126x-Arduino  1.2.1
Macros | Functions
RegionCommon.cpp File Reference
#include <stdbool.h>
#include <string.h>
#include <stdint.h>
#include <math.h>
#include "boards/mcu/timer.h"
#include "system/utilities.h"
#include "mac/LoRaMac.h"
#include "RegionCommon.h"

Macros

#define BACKOFF_DC_1_HOUR   100
 
#define BACKOFF_DC_10_HOURS   1000
 
#define BACKOFF_DC_24_HOURS   10000
 

Functions

static uint8_t CountChannels (uint16_t mask, uint8_t nbBits)
 
uint16_t RegionCommonGetJoinDc (TimerTime_t elapsedTime)
 Calculates the join duty cycle. This is a generic function and valid for all regions. More...
 
bool RegionCommonChanVerifyDr (uint8_t nbChannels, uint16_t *channelsMask, int8_t dr, int8_t minDr, int8_t maxDr, ChannelParams_t *channels)
 Verifies, if a datarate is available on an active channel. This is a generic function and valid for all regions. More...
 
uint8_t RegionCommonValueInRange (int8_t value, int8_t min, int8_t max)
 Verifies, if a value is in a given range. This is a generic function and valid for all regions. More...
 
bool RegionCommonChanDisable (uint16_t *channelsMask, uint8_t id, uint8_t maxChannels)
 Disables a channel in a given channels mask. This is a generic function and valid for all regions. More...
 
uint8_t RegionCommonCountChannels (uint16_t *channelsMask, uint8_t startIdx, uint8_t stopIdx)
 Counts the number of active channels in a given channels mask. This is a generic function and valid for all regions. More...
 
void RegionCommonChanMaskCopy (uint16_t *channelsMaskDest, uint16_t *channelsMaskSrc, uint8_t len)
 Copy a channels mask. This is a generic function and valid for all regions. More...
 
void RegionCommonSetBandTxDone (bool joined, Band_t *band, TimerTime_t lastTxDone)
 Sets the last tx done property. This is a generic function and valid for all regions. More...
 
TimerTime_t RegionCommonUpdateBandTimeOff (bool joined, bool dutyCycle, Band_t *bands, uint8_t nbBands)
 Updates the time-offs of the bands. This is a generic function and valid for all regions. More...
 
uint8_t RegionCommonParseLinkAdrReq (uint8_t *payload, RegionCommonLinkAdrParams_t *linkAdrParams)
 Parses the parameter of an LinkAdrRequest. This is a generic function and valid for all regions. More...
 
uint8_t RegionCommonLinkAdrReqVerifyParams (RegionCommonLinkAdrReqVerifyParams_t *verifyParams, int8_t *dr, int8_t *txPow, uint8_t *nbRep)
 Verifies and updates the datarate, the TX power and the number of repetitions of a LinkAdrRequest. This depends on the configuration of ADR also. More...
 
double RegionCommonComputeSymbolTimeLoRa (uint8_t phyDr, uint32_t bandwidth)
 Computes the symbol time for LoRa modulation. More...
 
double RegionCommonComputeSymbolTimeFsk (uint8_t phyDr)
 Computes the symbol time for FSK modulation. More...
 
void RegionCommonComputeRxWindowParameters (double tSymbol, uint8_t minRxSymbols, uint32_t rxError, uint32_t wakeUpTime, uint32_t *windowTimeout, int32_t *windowOffset)
 Computes the RX window timeout and the RX window offset. More...
 
int8_t RegionCommonComputeTxPower (int8_t txPowerIndex, float maxEirp, float antennaGain)
 Computes the txPower, based on the max EIRP and the antenna gain. More...
 
void RegionCommonCalcBackOff (RegionCommonCalcBackOffParams_t *calcBackOffParams)
 Calculates the duty cycle for the current band. More...
 

Macro Definition Documentation

◆ BACKOFF_DC_1_HOUR

#define BACKOFF_DC_1_HOUR   100

◆ BACKOFF_DC_10_HOURS

#define BACKOFF_DC_10_HOURS   1000

◆ BACKOFF_DC_24_HOURS

#define BACKOFF_DC_24_HOURS   10000

Function Documentation

◆ CountChannels()

static uint8_t CountChannels ( uint16_t  mask,
uint8_t  nbBits 
)
static