| SX126x-Arduino 2.0.1

Data Structures | Macros | Typedefs | Enumerations | Functions
sx126x.h File Reference

SX126x driver implementation. More...

Go to the source code of this file.

## Data Structures
union | RadioStatus_u
| Structure describing the radio status. More...
struct | ModulationParams_t
| The type describing the modulation parameters for every packet types. More...
struct | PacketParams_t
| The type describing the packet parameters for every packet types. More...
struct | PacketStatus_t
| Represents the packet status for every packet type. More...
struct | RxCounter_t
| Represents the Rx internal counters values when GFSK or LoRa packet type is used. More...
union | CalibrationParams_t
| Represents a calibration configuration. More...
union | SleepParams_t
| Represents a sleep mode configuration. More...
union | RadioError_t
| Represents the possible radio system error states. More...
struct | SX126x_s
struct | SX126xCallbacks_t
| The radio callbacks structure Holds function pointers to be called on radio interrupts. More...

## Macros
#define | SX1261 1
#define | SX1262 2
#define | RADIO_TCXO_SETUP_TIME 50
#define | RADIO_WAKEUP_TIME 3
#define | AUTO_RX_TX_OFFSET 2
| Compensation delay for SetAutoTx/Rx functions in 15.625 microseconds. More...
#define | CRC_IBM_SEED 0xFFFF
| LFSR initial value to compute IBM type CRC. More...
#define | CRC_CCITT_SEED 0x1D0F
| LFSR initial value to compute CCIT type CRC. More...
#define | CRC_POLYNOMIAL_IBM 0x8005
| Polynomial used to compute IBM CRC. More...
#define | CRC_POLYNOMIAL_CCITT 0x1021
| Polynomial used to compute CCIT CRC. More...
#define | REG_LR_CRCSEEDBASEADDR 0x06BC
| The address of the register holding the first byte defining the CRC seed. More...
#define | REG_LR_CRCPOLYBASEADDR 0x06BE
| The address of the register holding the first byte defining the CRC polynomial. More...
#define | REG_LR_WHITSEEDBASEADDR_MSB 0x06B8
| The address of the register holding the first byte defining the whitening seed. More...
#define | REG_LR_WHITSEEDBASEADDR_LSB 0x06B9
#define | REG_LR_PACKETPARAMS 0x0704
| The address of the register holding the packet configuration. More...
#define | REG_LR_PAYLOADLENGTH 0x0702
| The address of the register holding the payload size. More...
#define | REG_LR_SYNCWORDBASEADDRESS 0x06C0
| The addresses of the registers holding SyncWords values. More...
#define | REG_LR_SYNCWORD 0x0740
| The addresses of the register holding LoRa Modem SyncWord value. More...
#define | LORA_MAC_PRIVATE_SYNCWORD 0x1424
#define | LORA_MAC_PUBLIC_SYNCWORD 0x3444
#define | RANDOM_NUMBER_GENERATORBASEADDR 0x0819
#define | REG_RX_GAIN 0x08AC
#define | REG_XTA_TRIM 0x0911
#define | REG_OCP 0x08E7
#define | XTAL_FREQ (double)32000000
| Provides the frequency of the chip running on the radio and the frequency step. More...
#define | FREQ_DIV (double)pow(2.0, 25.0)
#define | FREQ_STEP (double)(XTAL_FREQ / FREQ_DIV)
#define | RX_BUFFER_SIZE 256

## Typedefs
typedef union RadioStatus_u | RadioStatus_t
| Structure describing the radio status. More...
typedef enum RadioCommands_e | RadioCommands_t
| Represents all possible opcode understood by the radio. More...
typedef struct SX126x_s | SX126x_t
typedef void() | DioIrqHandler(void)

## Enumerations
enum | IrqErrorCode_t { IRQ_HEADER_ERROR_CODE = 0x01, IRQ_SYNCWORD_ERROR_CODE = 0x02, IRQ_CRC_ERROR_CODE = 0x04 }
| Structure describing the error codes for callback functions. More...
enum | IrqPblSyncHeaderCode_t { IRQ_PBL_DETECT_CODE = 0x01, IRQ_SYNCWORD_VALID_CODE = 0x02, IRQ_HEADER_VALID_CODE = 0x04 }
enum | RadioOperatingModes_t { MODE_SLEEP = 0x00, MODE_STDBY_RC, MODE_STDBY_XOSC, MODE_FS, MODE_TX, MODE_RX, MODE_RX_DC, MODE_CAD }
| Represents the operating mode the radio is actually running. More...
enum | RadioStandbyModes_t { STDBY_RC = 0x00, STDBY_XOSC = 0x01 }
| Declares the oscillator in use while in standby mode. More...
enum | RadioRegulatorMode_t { USE_LDO = 0x00, USE_DCDC = 0x01 }
| Declares the power regulation used to power the device. More...
enum | RadioPacketTypes_t { PACKET_TYPE_GFSK = 0x00, PACKET_TYPE_LORA = 0x01, PACKET_TYPE_NONE = 0x0F }
| Represents the possible packet type (i.e. modem) used. More...
enum | RadioRampTimes_t { RADIO_RAMP_10_US = 0x00, RADIO_RAMP_20_US = 0x01, RADIO_RAMP_40_US = 0x02, RADIO_RAMP_80_US = 0x03, RADIO_RAMP_200_US = 0x04, RADIO_RAMP_800_US = 0x05, RADIO_RAMP_1700_US = 0x06, RADIO_RAMP_3400_US = 0x07 }
| Represents the ramping time for power amplifier. More...
enum | RadioLoRaCadSymbols_t { LORA_CAD_01_SYMBOL = 0x00, LORA_CAD_02_SYMBOL = 0x01, LORA_CAD_04_SYMBOL = 0x02, LORA_CAD_08_SYMBOL = 0x03, LORA_CAD_16_SYMBOL = 0x04 }
| Represents the number of symbols to be used for channel activity detection operation. More...
enum | RadioCadExitModes_t { LORA_CAD_ONLY = 0x00, LORA_CAD_RX = 0x01, LORA_CAD_LBT = 0x10 }
| Represents the Channel Activity Detection actions after the CAD operation is finished. More...
enum | RadioModShapings_t { MOD_SHAPING_OFF = 0x00, MOD_SHAPING_G_BT_03 = 0x08, MOD_SHAPING_G_BT_05 = 0x09, MOD_SHAPING_G_BT_07 = 0x0A, MOD_SHAPING_G_BT_1 = 0x0B }
| Represents the modulation shaping parameter. More...
enum | RadioRxBandwidth_t { RX_BW_4800 = 0x1F, RX_BW_5800 = 0x17, RX_BW_7300 = 0x0F, RX_BW_9700 = 0x1E, RX_BW_11700 = 0x16, RX_BW_14600 = 0x0E, RX_BW_19500 = 0x1D, RX_BW_23400 = 0x15, RX_BW_29300 = 0x0D, RX_BW_39000 = 0x1C, RX_BW_46900 = 0x14, RX_BW_58600 = 0x0C, RX_BW_78200 = 0x1B, RX_BW_93800 = 0x13, RX_BW_117300 = 0x0B, RX_BW_156200 = 0x1A, RX_BW_187200 = 0x12, RX_BW_234300 = 0x0A, RX_BW_312000 = 0x19, RX_BW_373600 = 0x11, RX_BW_467000 = 0x09 }
| Represents the modulation shaping parameter. More...
enum | RadioLoRaSpreadingFactors_t { LORA_SF5 = 0x05, LORA_SF6 = 0x06, LORA_SF7 = 0x07, LORA_SF8 = 0x08, LORA_SF9 = 0x09, LORA_SF10 = 0x0A, LORA_SF11 = 0x0B, LORA_SF12 = 0x0C }
| Represents the possible spreading factor values in LoRa packet types. More...
enum | RadioLoRaBandwidths_t { LORA_BW_500 = 6, LORA_BW_250 = 5, LORA_BW_125 = 4, LORA_BW_062 = 3, LORA_BW_041 = 10, LORA_BW_031 = 2, LORA_BW_020 = 9, LORA_BW_015 = 1, LORA_BW_010 = 8, LORA_BW_007 = 0 }
| Represents the bandwidth values for LoRa packet type. More...
enum | RadioLoRaCodingRates_t { LORA_CR_4_5 = 0x01, LORA_CR_4_6 = 0x02, LORA_CR_4_7 = 0x03, LORA_CR_4_8 = 0x04 }
| Represents the coding rate values for LoRa packet type. More...
enum | RadioPreambleDetection_t { RADIO_PREAMBLE_DETECTOR_OFF = 0x00, RADIO_PREAMBLE_DETECTOR_08_BITS = 0x04, RADIO_PREAMBLE_DETECTOR_16_BITS = 0x05, RADIO_PREAMBLE_DETECTOR_24_BITS = 0x06, RADIO_PREAMBLE_DETECTOR_32_BITS = 0x07 }
| Represents the preamble length used to detect the packet on Rx side. More...
enum | RadioAddressComp_t { RADIO_ADDRESSCOMP_FILT_OFF = 0x00, RADIO_ADDRESSCOMP_FILT_NODE = 0x01, RADIO_ADDRESSCOMP_FILT_NODE_BROAD = 0x02 }
| Represents the possible combinations of SyncWord correlators activated. More...
enum | RadioPacketLengthModes_t { RADIO_PACKET_FIXED_LENGTH = 0x00, RADIO_PACKET_VARIABLE_LENGTH = 0x01 }
| Radio GFSK packet length mode. More...
enum | RadioCrcTypes_t { RADIO_CRC_OFF = 0x01, RADIO_CRC_1_BYTES = 0x00, RADIO_CRC_2_BYTES = 0x02, RADIO_CRC_1_BYTES_INV = 0x04, RADIO_CRC_2_BYTES_INV = 0x06, RADIO_CRC_2_BYTES_IBM = 0xF1, RADIO_CRC_2_BYTES_CCIT = 0xF2 }
| Represents the CRC length. More...
enum | RadioDcFree_t { RADIO_DC_FREE_OFF = 0x00, RADIO_DC_FREEWHITENING = 0x01 }
| Radio whitening mode activated or deactivated. More...
enum | RadioLoRaPacketLengthsMode_t { LORA_PACKET_VARIABLE_LENGTH = 0x00, LORA_PACKET_FIXED_LENGTH = 0x01, LORA_PACKET_EXPLICIT = LORA_PACKET_VARIABLE_LENGTH, LORA_PACKET_IMPLICIT = LORA_PACKET_FIXED_LENGTH }
| Holds the Radio lengths mode for the LoRa packet type. More...
enum | RadioLoRaCrcModes_t { LORA_CRC_ON = 0x01, LORA_CRC_OFF = 0x00 }
| Represents the CRC mode for LoRa packet type. More...
enum | RadioLoRaIQModes_t { LORA_IQ_NORMAL = 0x00, LORA_IQ_INVERTED = 0x01 }
| Represents the IQ mode for LoRa packet type. More...
enum | RadioTcxoCtrlVoltage_t { TCXO_CTRL_1_6V = 0x00, TCXO_CTRL_1_7V = 0x01, TCXO_CTRL_1_8V = 0x02, TCXO_CTRL_2_2V = 0x03, TCXO_CTRL_2_4V = 0x04, TCXO_CTRL_2_7V = 0x05, TCXO_CTRL_3_0V = 0x06, TCXO_CTRL_3_3V = 0x07 }
| Represents the voltage used to control the TCXO on/off from DIO3. More...
enum | RadioIrqMasks_t { IRQ_RADIO_NONE = 0x0000, IRQ_TX_DONE = 0x0001, IRQ_RX_DONE = 0x0002, IRQ_PREAMBLE_DETECTED = 0x0004, IRQ_SYNCWORD_VALID = 0x0008, IRQ_HEADER_VALID = 0x0010, IRQ_HEADER_ERROR = 0x0020, IRQ_CRC_ERROR = 0x0040, IRQ_CAD_DONE = 0x0080, IRQ_CAD_ACTIVITY_DETECTED = 0x0100, IRQ_RX_TX_TIMEOUT = 0x0200, IRQ_RADIO_ALL = 0xFFFF }
| Represents the interruption masks available for the radio. More...
enum | RadioCommands_e { RADIO_GET_STATUS = 0xC0, RADIO_WRITE_REGISTER = 0x0D, RADIO_READ_REGISTER = 0x1D, RADIO_WRITE_BUFFER = 0x0E, RADIO_READ_BUFFER = 0x1E, RADIO_SET_SLEEP = 0x84, RADIO_SET_STANDBY = 0x80, RADIO_SET_FS = 0xC1, RADIO_SET_TX = 0x83, RADIO_SET_RX = 0x82, RADIO_SET_RXDUTYCYCLE = 0x94, RADIO_SET_CAD = 0xC5, RADIO_SET_TXCONTINUOUSWAVE = 0xD1, RADIO_SET_TXCONTINUOUSPREAMBLE = 0xD2, RADIO_SET_PACKETTYPE = 0x8A, RADIO_GET_PACKETTYPE = 0x11, RADIO_SET_RFFREQUENCY = 0x86, RADIO_SET_TXPARAMS = 0x8E, RADIO_SET_PACONFIG = 0x95, RADIO_SET_CADPARAMS = 0x88, RADIO_SET_BUFFERBASEADDRESS = 0x8F, RADIO_SET_MODULATIONPARAMS = 0x8B, RADIO_SET_PACKETPARAMS = 0x8C, RADIO_GET_RXBUFFERSTATUS = 0x13, RADIO_GET_PACKETSTATUS = 0x14, RADIO_GET_RSSIINST = 0x15, RADIO_GET_STATS = 0x10, RADIO_RESET_STATS = 0x00, RADIO_CFG_DIOIRQ = 0x08, RADIO_GET_IRQSTATUS = 0x12, RADIO_CLR_IRQSTATUS = 0x02, RADIO_CALIBRATE = 0x89, RADIO_CALIBRATEIMAGE = 0x98, RADIO_SET_REGULATORMODE = 0x96, RADIO_GET_ERROR = 0x17, RADIO_CLR_ERROR = 0x07, RADIO_SET_TCXOMODE = 0x97, RADIO_SET_TXFALLBACKMODE = 0x93, RADIO_SET_RFSWITCHMODE = 0x9D, RADIO_SET_STOPRXTIMERONPREAMBLE = 0x9F, RADIO_SET_LORASYMBTIMEOUT = 0xA0 }
| Represents all possible opcode understood by the radio. More...

## Functions
void | SX126xInit (DioIrqHandler dioIrq)
| Initializes the radio driver. More...
void | SX126xReInit (DioIrqHandler dioIrq)
| Re-Initializes the radio driver after CPU wakeup from deep sleep. More...
RadioOperatingModes_t | SX126xGetOperatingMode (void)
| Gets the current Operation Mode of the Radio. More...
void | SX126xSetOperatingMode (RadioOperatingModes_t mode)
| Sets/Updates the current Radio OperationMode variable. More...
void | SX126xCheckDeviceReady (void)
| Wakeup the radio if it is in Sleep mode and check that Busy is low. More...
void | SX126xSetPayload (uint8_t *payload, uint8_t size)
| Saves the payload to be send in the radio buffer. More...
uint8_t | SX126xGetPayload (uint8_t *payload, uint8_t *size, uint8_t maxSize)
| Reads the payload received. If the received payload is longer than maxSize, then the method returns 1 and do not set size and payload. More...
void | SX126xSendPayload (uint8_t *payload, uint8_t size, uint32_t timeout)
| Sends a payload. More...
uint8_t | SX126xSetSyncWord (uint8_t *syncWord)
| Sets the Sync Word given by index used in GFSK. More...
void | SX126xSetCrcSeed (uint16_t seed)
| Sets the seed value for the LFSR used for the CRC calculation. More...
void | SX126xSetCrcPolynomial (uint16_t polynomial)
| Sets the polynomial used for the CRC calculation. More...
void | SX126xSetWhiteningSeed (uint16_t seed)
| Sets the Initial value of the LFSR used for the whitening in GFSK protocols. More...
uint32_t | SX126xGetRandom (void)
| Gets a 32 bits random value generated by the radio. More...
void | SX126xSetSleep (SleepParams_t sleepConfig)
| Sets the radio in sleep mode. More...
void | SX126xSetStandby (RadioStandbyModes_t mode)
| Sets the radio in configuration mode. More...
void | SX126xSetFs (void)
| Sets the radio in FS mode. More...
void | SX126xSetTx (uint32_t timeout)
| Sets the radio in transmission mode. More...
void | SX126xSetRx (uint32_t timeout)
| Sets the radio in reception mode. More...
void | SX126xSetRxBoosted (uint32_t timeout)
| Sets the radio in reception mode with Boosted LNA gain. More...
void | SX126xSetRxDutyCycle (uint32_t rxTime, uint32_t sleepTime)
| Sets the Rx duty cycle management parameters. More...
void | SX126xSetCad (void)
| Sets the radio in CAD mode. More...
void | SX126xSetTxContinuousWave (void)
| Sets the radio in continuous wave transmission mode. More...
void | SX126xSetTxInfinitePreamble (void)
| Sets the radio in continuous preamble transmission mode. More...
void | SX126xSetStopRxTimerOnPreambleDetect (bool enable)
| Decide which interrupt will stop the internal radio rx timer. More...
void | SX126xSetLoRaSymbNumTimeout (uint8_t SymbNum)
| Set the number of symbol the radio will wait to validate a reception. More...
void | SX126xSetRegulatorMode (RadioRegulatorMode_t mode)
| Sets the power regulators operating mode. More...
void | SX126xCalibrate (CalibrationParams_t calibParam)
| Calibrates the given radio block. More...
void | SX126xCalibrateImage (uint32_t freq)
| Calibrates the Image rejection depending of the frequency. More...
void | SX126xSetLongPreamble (uint8_t enable)
| Activate the extention of the timeout when long preamble is used. More...
void | SX126xSetPaConfig (uint8_t paDutyCycle, uint8_t hpMax, uint8_t deviceSel, uint8_t paLut)
| Sets the transmission parameters. More...
void | SX126xSetRxTxFallbackMode (uint8_t fallbackMode)
| Defines into which mode the chip goes after a TX / RX done. More...
void | SX126xWriteRegisters (uint16_t address, uint8_t *buffer, uint16_t size)
| Write data to the radio memory. More...
void | SX126xReadRegisters (uint16_t address, uint8_t *buffer, uint16_t size)
| Read data from the radio memory. More...
void | SX126xWriteBuffer (uint8_t offset, uint8_t *buffer, uint8_t size)
| Write data to the buffer holding the payload in the radio. More...
void | SX126xReadBuffer (uint8_t offset, uint8_t *buffer, uint8_t size)
| Read data from the buffer holding the payload in the radio. More...
void | SX126xSetDioIrqParams (uint16_t irqMask, uint16_t dio1Mask, uint16_t dio2Mask, uint16_t dio3Mask)
| Sets the IRQ mask and DIO masks. More...
uint16_t | SX126xGetIrqStatus (void)
| Returns the current IRQ status. More...
void | SX126xSetDio2AsRfSwitchCtrl (uint8_t enable)
| Indicates if DIO2 is used to control an RF Switch. More...
void | SX126xSetDio3AsTcxoCtrl (RadioTcxoCtrlVoltage_t tcxoVoltage, uint32_t timeout)
| Indicates if the Radio main clock is supplied from a tcxo. More...
void | SX126xSetRfFrequency (uint32_t frequency)
| Sets the RF frequency. More...
void | SX126xSetPacketType (RadioPacketTypes_t packetType)
| Sets the radio for the given protocol. More...
RadioPacketTypes_t | SX126xGetPacketType (void)
| Gets the current radio protocol. More...
void | SX126xSetTxParams (int8_t power, RadioRampTimes_t rampTime)
| Sets the transmission parameters. More...
void | SX126xSetModulationParams (ModulationParams_t *modParams)
| Set the modulation parameters. More...
void | SX126xSetPacketParams (PacketParams_t *packetParams)
| Sets the packet parameters. More...
void | SX126xSetCadParams (RadioLoRaCadSymbols_t cadSymbolNum, uint8_t cadDetPeak, uint8_t cadDetMin, RadioCadExitModes_t cadExitMode, uint32_t cadTimeout)
| Sets the Channel Activity Detection (CAD) parameters. More...
void | SX126xSetBufferBaseAddress (uint8_t txBaseAddress, uint8_t rxBaseAddress)
| Sets the data buffer base address for transmission and reception. More...
RadioStatus_t | SX126xGetStatus (void)
| Gets the current radio status. More...
int8_t | SX126xGetRssiInst (void)
| Returns the instantaneous RSSI value for the last packet received. More...
void | SX126xGetRxBufferStatus (uint8_t *payloadLength, uint8_t *rxStartBuffer)
| Gets the last received packet buffer status. More...
void | SX126xGetPacketStatus (PacketStatus_t *pktStatus)
| Gets the last received packet payload length. More...
RadioError_t | SX126xGetDeviceErrors (void)
| Returns the possible system errors. More...
void | SX126xClearDeviceErrors (void)
| Clear all the errors in the device. More...
void | SX126xClearIrqStatus (uint16_t irq)
| Clears the IRQs. More...

## Detailed Description

SX126x driver implementation.

Copyright
  Revised BSD License, see file LICENSE.

______ _
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013-2017 Semtech

Author
  Miguel Luis ( Semtech )
  Gregory Cristian ( Semtech )

## Macro Definition Documentation

## ◆ SX1261

#define SX1261 1

## ◆ SX1262

#define SX1262 2

## ◆ RADIO_TCXO_SETUP_TIME

#define RADIO_TCXO_SETUP_TIME 50

Radio complete Wake-up Time with TCXO stabilisation time

## ◆ RADIO_WAKEUP_TIME

#define RADIO_WAKEUP_TIME 3

Radio complete Wake-up Time with margin for temperature compensation

## ◆ AUTO_RX_TX_OFFSET

#define AUTO_RX_TX_OFFSET 2

Compensation delay for SetAutoTx/Rx functions in 15.625 microseconds.

## ◆ CRC_IBM_SEED

#define CRC_IBM_SEED 0xFFFF

LFSR initial value to compute IBM type CRC.

## ◆ CRC_CCITT_SEED

#define CRC_CCITT_SEED 0x1D0F

LFSR initial value to compute CCIT type CRC.

## ◆ CRC_POLYNOMIAL_IBM

#define CRC_POLYNOMIAL_IBM 0x8005

Polynomial used to compute IBM CRC.

## ◆ CRC_POLYNOMIAL_CCITT

#define CRC_POLYNOMIAL_CCITT 0x1021

Polynomial used to compute CCIT CRC.

## ◆ REG_LR_CRCSEEDBASEADDR

#define REG_LR_CRCSEEDBASEADDR 0x06BC

The address of the register holding the first byte defining the CRC seed.

## ◆ REG_LR_CRCPOLYBASEADDR

#define REG_LR_CRCPOLYBASEADDR 0x06BE

The address of the register holding the first byte defining the CRC polynomial.

## ◆ REG_LR_WHITSEEDBASEADDR_MSB

#define REG_LR_WHITSEEDBASEADDR_MSB 0x06B8

The address of the register holding the first byte defining the whitening seed.

## ◆ REG_LR_WHITSEEDBASEADDR_LSB

#define REG_LR_WHITSEEDBASEADDR_LSB 0x06B9

## ◆ REG_LR_PACKETPARAMS

#define REG_LR_PACKETPARAMS 0x0704

The address of the register holding the packet configuration.

## ◆ REG_LR_PAYLOADLENGTH

#define REG_LR_PAYLOADLENGTH 0x0702

The address of the register holding the payload size.

## ◆ REG_LR_SYNCWORDBASEADDRESS

#define REG_LR_SYNCWORDBASEADDRESS 0x06C0

The addresses of the registers holding SyncWords values.

## ◆ REG_LR_SYNCWORD

#define REG_LR_SYNCWORD 0x0740

The addresses of the register holding LoRa Modem SyncWord value.

## ◆ LORA_MAC_PRIVATE_SYNCWORD

#define LORA_MAC_PRIVATE_SYNCWORD 0x1424

Syncword for Private LoRa networks

## ◆ LORA_MAC_PUBLIC_SYNCWORD

#define LORA_MAC_PUBLIC_SYNCWORD 0x3444

Syncword for Public LoRa networks

## ◆ RANDOM_NUMBER_GENERATORBASEADDR

#define RANDOM_NUMBER_GENERATORBASEADDR 0x0819

The address of the register giving a 4 bytes random number

## ◆ REG_RX_GAIN

#define REG_RX_GAIN 0x08AC

The address of the register holding RX Gain value (0x94: power saving, 0x96: rx boosted)

## ◆ REG_XTA_TRIM

#define REG_XTA_TRIM 0x0911

Change the value on the device internal trimming capacitor

## ◆ REG_OCP

#define REG_OCP 0x08E7

Set the current max value in the over current protection

## ◆ XTAL_FREQ

#define XTAL_FREQ (double)32000000

Provides the frequency of the chip running on the radio and the frequency step.

SX126x definitions

Remarks
  These defines are used for computing the frequency divider to set the RF frequency

## ◆ FREQ_DIV

#define FREQ_DIV (double)pow(2.0, 25.0)

## ◆ FREQ_STEP

#define FREQ_STEP (double)(XTAL_FREQ / FREQ_DIV)

## ◆ RX_BUFFER_SIZE

#define RX_BUFFER_SIZE 256

## Typedef Documentation

## ◆ RadioStatus_t

typedef union RadioStatus_u RadioStatus_t

Structure describing the radio status.

## ◆ RadioCommands_t

typedef enum RadioCommands_e RadioCommands_t

Represents all possible opcode understood by the radio.

## ◆ SX126x_t

typedef struct SX126x_s SX126x_t

Radio hardware and global parameters

## ◆ DioIrqHandler

typedef void() DioIrqHandler(void)

Hardware IO IRQ callback function definition

## Enumeration Type Documentation

## ◆ IrqErrorCode_t

enum IrqErrorCode_t

Structure describing the error codes for callback functions.

Enumerator
IRQ_HEADER_ERROR_CODE |
IRQ_SYNCWORD_ERROR_CODE |
IRQ_CRC_ERROR_CODE |

## ◆ IrqPblSyncHeaderCode_t

enum IrqPblSyncHeaderCode_t

Enumerator
IRQ_PBL_DETECT_CODE |
IRQ_SYNCWORD_VALID_CODE |
IRQ_HEADER_VALID_CODE |

## ◆ RadioOperatingModes_t

enum RadioOperatingModes_t

Represents the operating mode the radio is actually running.

Enumerator
MODE_SLEEP |
MODE_STDBY_RC | The radio is in sleep mode.
MODE_STDBY_XOSC | The radio is in standby mode with RC oscillator.
MODE_FS | The radio is in standby mode with XOSC oscillator.
MODE_TX | The radio is in frequency synthesis mode.
MODE_RX | The radio is in transmit mode.
MODE_RX_DC | The radio is in receive mode.
MODE_CAD | The radio is in receive duty cycle mode. The radio is in channel activity detection mode

## ◆ RadioStandbyModes_t

enum RadioStandbyModes_t

Declares the oscillator in use while in standby mode.

Using the STDBY_RC standby mode allow to reduce the energy consumption STDBY_XOSC should be used for time critical applications

Enumerator
STDBY_RC |
STDBY_XOSC |

## ◆ RadioRegulatorMode_t

enum RadioRegulatorMode_t

Declares the power regulation used to power the device.

This command allows the user to specify if DC-DC or LDO is used for power regulation. Using only LDO implies that the Rx or Tx current is doubled

Enumerator
USE_LDO |
USE_DCDC |

## ◆ RadioPacketTypes_t

enum RadioPacketTypes_t

Represents the possible packet type (i.e. modem) used.

Enumerator
PACKET_TYPE_GFSK |
PACKET_TYPE_LORA |
PACKET_TYPE_NONE |

## ◆ RadioRampTimes_t

enum RadioRampTimes_t

Represents the ramping time for power amplifier.

Enumerator
RADIO_RAMP_10_US |
RADIO_RAMP_20_US |
RADIO_RAMP_40_US |
RADIO_RAMP_80_US |
RADIO_RAMP_200_US |
RADIO_RAMP_800_US |
RADIO_RAMP_1700_US |
RADIO_RAMP_3400_US |

## ◆ RadioLoRaCadSymbols_t

enum RadioLoRaCadSymbols_t

Represents the number of symbols to be used for channel activity detection operation.

Enumerator
LORA_CAD_01_SYMBOL |
LORA_CAD_02_SYMBOL |
LORA_CAD_04_SYMBOL |
LORA_CAD_08_SYMBOL |
LORA_CAD_16_SYMBOL |

## ◆ RadioCadExitModes_t

enum RadioCadExitModes_t

Represents the Channel Activity Detection actions after the CAD operation is finished.

Enumerator
LORA_CAD_ONLY |
LORA_CAD_RX |
LORA_CAD_LBT |

## ◆ RadioModShapings_t

enum RadioModShapings_t

Represents the modulation shaping parameter.

Enumerator
MOD_SHAPING_OFF |
MOD_SHAPING_G_BT_03 |
MOD_SHAPING_G_BT_05 |
MOD_SHAPING_G_BT_07 |
MOD_SHAPING_G_BT_1 |

## ◆ RadioRxBandwidth_t

enum RadioRxBandwidth_t

Represents the modulation shaping parameter.

Enumerator
RX_BW_4800 |
RX_BW_5800 |
RX_BW_7300 |
RX_BW_9700 |
RX_BW_11700 |
RX_BW_14600 |
RX_BW_19500 |
RX_BW_23400 |
RX_BW_29300 |
RX_BW_39000 |
RX_BW_46900 |
RX_BW_58600 |
RX_BW_78200 |
RX_BW_93800 |
RX_BW_117300 |
RX_BW_156200 |
RX_BW_187200 |
RX_BW_234300 |
RX_BW_312000 |
RX_BW_373600 |
RX_BW_467000 |

## ◆ RadioLoRaSpreadingFactors_t

enum RadioLoRaSpreadingFactors_t

Represents the possible spreading factor values in LoRa packet types.

Enumerator
LORA_SF5 |
LORA_SF6 |
LORA_SF7 |
LORA_SF8 |
LORA_SF9 |
LORA_SF10 |
LORA_SF11 |
LORA_SF12 |

## ◆ RadioLoRaBandwidths_t

enum RadioLoRaBandwidths_t

Represents the bandwidth values for LoRa packet type.

Enumerator
LORA_BW_500 |
LORA_BW_250 |
LORA_BW_125 |
LORA_BW_062 |
LORA_BW_041 |
LORA_BW_031 |
LORA_BW_020 |
LORA_BW_015 |
LORA_BW_010 |
LORA_BW_007 |

## ◆ RadioLoRaCodingRates_t

enum RadioLoRaCodingRates_t

Represents the coding rate values for LoRa packet type.

Enumerator
LORA_CR_4_5 |
LORA_CR_4_6 |
LORA_CR_4_7 |
LORA_CR_4_8 |

## ◆ RadioPreambleDetection_t

enum RadioPreambleDetection_t

Represents the preamble length used to detect the packet on Rx side.

Enumerator
RADIO_PREAMBLE_DETECTOR_OFF | Preamble detection length off.
RADIO_PREAMBLE_DETECTOR_08_BITS | Preamble detection length 8 bits.
RADIO_PREAMBLE_DETECTOR_16_BITS | Preamble detection length 16 bits.
RADIO_PREAMBLE_DETECTOR_24_BITS | Preamble detection length 24 bits.
RADIO_PREAMBLE_DETECTOR_32_BITS | Preamble detection length 32 bit.

## ◆ RadioAddressComp_t

enum RadioAddressComp_t

Represents the possible combinations of SyncWord correlators activated.

Enumerator
RADIO_ADDRESSCOMP_FILT_OFF | No correlator turned on, i.e. do not search for SyncWord.
RADIO_ADDRESSCOMP_FILT_NODE |
RADIO_ADDRESSCOMP_FILT_NODE_BROAD |

## ◆ RadioPacketLengthModes_t

enum RadioPacketLengthModes_t

Radio GFSK packet length mode.

Enumerator
RADIO_PACKET_FIXED_LENGTH | The packet is known on both sides, no header included in the packet.
RADIO_PACKET_VARIABLE_LENGTH | The packet is on variable size, header included.

## ◆ RadioCrcTypes_t

enum RadioCrcTypes_t

Represents the CRC length.

Enumerator
RADIO_CRC_OFF | No CRC in use.
RADIO_CRC_1_BYTES |
RADIO_CRC_2_BYTES |
RADIO_CRC_1_BYTES_INV |
RADIO_CRC_2_BYTES_INV |
RADIO_CRC_2_BYTES_IBM |
RADIO_CRC_2_BYTES_CCIT |

## ◆ RadioDcFree_t

enum RadioDcFree_t

Radio whitening mode activated or deactivated.

Enumerator
RADIO_DC_FREE_OFF |
RADIO_DC_FREEWHITENING |

## ◆ RadioLoRaPacketLengthsMode_t

enum RadioLoRaPacketLengthsMode_t

Holds the Radio lengths mode for the LoRa packet type.

Enumerator
LORA_PACKET_VARIABLE_LENGTH | The packet is on variable size, header included.
LORA_PACKET_FIXED_LENGTH | The packet is known on both sides, no header included in the packet.
LORA_PACKET_EXPLICIT |
LORA_PACKET_IMPLICIT |

## ◆ RadioLoRaCrcModes_t

enum RadioLoRaCrcModes_t

Represents the CRC mode for LoRa packet type.

Enumerator
LORA_CRC_ON | CRC activated.
LORA_CRC_OFF | CRC not used.

## ◆ RadioLoRaIQModes_t

enum RadioLoRaIQModes_t

Represents the IQ mode for LoRa packet type.

Enumerator
LORA_IQ_NORMAL |
LORA_IQ_INVERTED |

## ◆ RadioTcxoCtrlVoltage_t

enum RadioTcxoCtrlVoltage_t

Represents the voltage used to control the TCXO on/off from DIO3.

Enumerator
TCXO_CTRL_1_6V |
TCXO_CTRL_1_7V |
TCXO_CTRL_1_8V |
TCXO_CTRL_2_2V |
TCXO_CTRL_2_4V |
TCXO_CTRL_2_7V |
TCXO_CTRL_3_0V |
TCXO_CTRL_3_3V |

## ◆ RadioIrqMasks_t

enum RadioIrqMasks_t

Represents the interruption masks available for the radio.

Remarks
  Note that not all these interruptions are available for all packet types

Enumerator
IRQ_RADIO_NONE |
IRQ_TX_DONE |
IRQ_RX_DONE |
IRQ_PREAMBLE_DETECTED |
IRQ_SYNCWORD_VALID |
IRQ_HEADER_VALID |
IRQ_HEADER_ERROR |
IRQ_CRC_ERROR |
IRQ_CAD_DONE |
IRQ_CAD_ACTIVITY_DETECTED |
IRQ_RX_TX_TIMEOUT |
IRQ_RADIO_ALL |

## ◆ RadioCommands_e

enum RadioCommands_e

Represents all possible opcode understood by the radio.

Enumerator
RADIO_GET_STATUS |
RADIO_WRITE_REGISTER |
RADIO_READ_REGISTER |
RADIO_WRITE_BUFFER |
RADIO_READ_BUFFER |
RADIO_SET_SLEEP |
RADIO_SET_STANDBY |
RADIO_SET_FS |
RADIO_SET_TX |
RADIO_SET_RX |
RADIO_SET_RXDUTYCYCLE |
RADIO_SET_CAD |
RADIO_SET_TXCONTINUOUSWAVE |
RADIO_SET_TXCONTINUOUSPREAMBLE |
RADIO_SET_PACKETTYPE |
RADIO_GET_PACKETTYPE |
RADIO_SET_RFFREQUENCY |
RADIO_SET_TXPARAMS |
RADIO_SET_PACONFIG |
RADIO_SET_CADPARAMS |
RADIO_SET_BUFFERBASEADDRESS |
RADIO_SET_MODULATIONPARAMS |
RADIO_SET_PACKETPARAMS |
RADIO_GET_RXBUFFERSTATUS |
RADIO_GET_PACKETSTATUS |
RADIO_GET_RSSIINST |
RADIO_GET_STATS |
RADIO_RESET_STATS |
RADIO_CFG_DIOIRQ |
RADIO_GET_IRQSTATUS |
RADIO_CLR_IRQSTATUS |
RADIO_CALIBRATE |
RADIO_CALIBRATEIMAGE |
RADIO_SET_REGULATORMODE |
RADIO_GET_ERROR |
RADIO_CLR_ERROR |
RADIO_SET_TCXOMODE |
RADIO_SET_TXFALLBACKMODE |
RADIO_SET_RFSWITCHMODE |
RADIO_SET_STOPRXTIMERONPREAMBLE |
RADIO_SET_LORASYMBTIMEOUT |

## Function Documentation

## ◆ SX126xInit()

void SX126xInit | ( | DioIrqHandler | dioIrq | ) |

Initializes the radio driver.

# Public functions prototypes

## ◆ SX126xReInit()

void SX126xReInit | ( | DioIrqHandler | dioIrq | ) |

Re-Initializes the radio driver after CPU wakeup from deep sleep.

## ◆ SX126xGetOperatingMode()

RadioOperatingModes_t SX126xGetOperatingMode | ( | void |  | ) |

Gets the current Operation Mode of the Radio.

Return values

  RadioOperatingModes_t | last operating mode

## ◆ SX126xSetOperatingMode()

void SX126xSetOperatingMode | ( | RadioOperatingModes_t | mode | ) |

Sets/Updates the current Radio OperationMode variable.

Remarks
  WARNING: This function is only required to reflect the current radio operating mode when processing interrupts.

Parameters

  mode | New operating mode

## ◆ SX126xCheckDeviceReady()

void SX126xCheckDeviceReady | ( | void |  | ) |

Wakeup the radio if it is in Sleep mode and check that Busy is low.

## ◆ SX126xSetPayload()

void SX126xSetPayload | ( | uint8_t * | payload,
|  | uint8_t | size
| ) |  |

Saves the payload to be send in the radio buffer.

Parameters

  payload | A pointer to the payload
  size | The size of the payload

## ◆ SX126xGetPayload()

uint8_t SX126xGetPayload | ( | uint8_t * | payload,
|  | uint8_t * | size,
|  | uint8_t | maxSize
| ) |  |

Reads the payload received. If the received payload is longer than maxSize, then the method returns 1 and do not set size and payload.

Parameters

  payload | A pointer to a buffer into which the payload will be copied
  size | A pointer to the size of the payload received
  maxSize | The maximal size allowed to copy into the buffer

## ◆ SX126xSendPayload()

void SX126xSendPayload | ( | uint8_t * | payload,
|  | uint8_t | size,
|  | uint32_t | timeout
| ) |  |

Sends a payload.

Parameters

  payload | A pointer to the payload to send
  size | The size of the payload to send
  timeout | The timeout for Tx operation

## ◆ SX126xSetSyncWord()

uint8_t SX126xSetSyncWord | ( | uint8_t * | syncWord | ) |

Sets the Sync Word given by index used in GFSK.

Parameters

  syncWord | SyncWord bytes ( 8 bytes )

Return values

  status | [0: OK, 1: NOK]

## ◆ SX126xSetCrcSeed()

void SX126xSetCrcSeed | ( | uint16_t | seed | ) |

Sets the seed value for the LFSR used for the CRC calculation.

Parameters

  seed | Initial LFSR value ( 2 bytes )

## ◆ SX126xSetCrcPolynomial()

void SX126xSetCrcPolynomial | ( | uint16_t | polynomial | ) |

Sets the polynomial used for the CRC calculation.

Parameters

  polynomial | The seed value

## ◆ SX126xSetWhiteningSeed()

void SX126xSetWhiteningSeed | ( | uint16_t | seed | ) |

Sets the Initial value of the LFSR used for the whitening in GFSK protocols.

Parameters

  seed | Initial LFSR value

## ◆ SX126xGetRandom()

uint32_t SX126xGetRandom | ( | void |  | ) |

Gets a 32 bits random value generated by the radio.

Remarks
  The radio must be in reception mode before executing this function

Return values

  randomValue | 32 bits random value

## ◆ SX126xSetSleep()

void SX126xSetSleep | ( | SleepParams_t | sleepConfig | ) |

Sets the radio in sleep mode.

Parameters

  sleepConfig | The sleep configuration describing data retention and RTC wake-up

## ◆ SX126xSetStandby()

void SX126xSetStandby | ( | RadioStandbyModes_t | mode | ) |

Sets the radio in configuration mode.

Parameters

  mode | The standby mode to put the radio into

## ◆ SX126xSetFs()

void SX126xSetFs | ( | void |  | ) |

Sets the radio in FS mode.

## ◆ SX126xSetTx()

void SX126xSetTx | ( | uint32_t | timeout | ) |

Sets the radio in transmission mode.

Parameters

  timeout | Structure describing the transmission timeout value

## ◆ SX126xSetRx()

void SX126xSetRx | ( | uint32_t | timeout | ) |

Sets the radio in reception mode.

Parameters

  timeout | Structure describing the reception timeout value

## ◆ SX126xSetRxBoosted()

void SX126xSetRxBoosted | ( | uint32_t | timeout | ) |

Sets the radio in reception mode with Boosted LNA gain.

Parameters

  timeout | Structure describing the reception timeout value

## ◆ SX126xSetRxDutyCycle()

void SX126xSetRxDutyCycle | ( | uint32_t | rxTime,
|  | uint32_t | sleepTime
| ) |  |

Sets the Rx duty cycle management parameters.

Parameters

  rxTime | Structure describing reception timeout value
  sleepTime | Structure describing sleep timeout value

## ◆ SX126xSetCad()

void SX126xSetCad | ( | void |  | ) |

Sets the radio in CAD mode.

## ◆ SX126xSetTxContinuousWave()

void SX126xSetTxContinuousWave | ( | void |  | ) |

Sets the radio in continuous wave transmission mode.

## ◆ SX126xSetTxInfinitePreamble()

void SX126xSetTxInfinitePreamble | ( | void |  | ) |

Sets the radio in continuous preamble transmission mode.

## ◆ SX126xSetStopRxTimerOnPreambleDetect()

void SX126xSetStopRxTimerOnPreambleDetect | ( | bool | enable | ) |

Decide which interrupt will stop the internal radio rx timer.

Parameters

  enable | [0: Timer stop after header/syncword detection 1: Timer stop after preamble detection]

## ◆ SX126xSetLoRaSymbNumTimeout()

void SX126xSetLoRaSymbNumTimeout | ( | uint8_t | SymbNum | ) |

Set the number of symbol the radio will wait to validate a reception.

Parameters

  SymbNum | number of LoRa symbols

## ◆ SX126xSetRegulatorMode()

void SX126xSetRegulatorMode | ( | RadioRegulatorMode_t | mode | ) |

Sets the power regulators operating mode.

Parameters

  mode | [0: LDO, 1:DC_DC]

## ◆ SX126xCalibrate()

void SX126xCalibrate | ( | CalibrationParams_t | calibParam | ) |

Calibrates the given radio block.

Parameters

  calibParam | The description of blocks to be calibrated

## ◆ SX126xCalibrateImage()

void SX126xCalibrateImage | ( | uint32_t | freq | ) |

Calibrates the Image rejection depending of the frequency.

Parameters

  freq | The operating frequency

## ◆ SX126xSetLongPreamble()

void SX126xSetLongPreamble | ( | uint8_t | enable | ) |

Activate the extention of the timeout when long preamble is used.

Parameters

  enable | The radio will extend the timeout to cope with long preamble

## ◆ SX126xSetPaConfig()

void SX126xSetPaConfig | ( | uint8_t | paDutyCycle,
|  | uint8_t | hpMax,
|  | uint8_t | deviceSel,
|  | uint8_t | paLut
| ) |  |

Sets the transmission parameters.

Parameters

  paDutyCycle | Duty Cycle for the PA
  hpMax | 0 for sx1261, 7 for sx1262
  deviceSel | 1 for sx1261, 0 for sx1262
  paLut | 0 for 14dBm LUT, 1 for 22dBm LUT

## ◆ SX126xSetRxTxFallbackMode()

void SX126xSetRxTxFallbackMode | ( | uint8_t | fallbackMode | ) |

Defines into which mode the chip goes after a TX / RX done.

Parameters

  fallbackMode | The mode in which the radio goes

## ◆ SX126xWriteRegisters()

void SX126xWriteRegisters | ( | uint16_t | address,
|  | uint8_t * | buffer,
|  | uint16_t | size
| ) |  |

Write data to the radio memory.

Parameters

  address | The address of the first byte to write in the radio
  buffer | The data to be written in radio's memory
  size | The number of bytes to write in radio's memory

## ◆ SX126xReadRegisters()

void SX126xReadRegisters | ( | uint16_t | address,
|  | uint8_t * | buffer,
|  | uint16_t | size
| ) |  |

Read data from the radio memory.

Parameters

  address | The address of the first byte to read from the radio
  buffer | The buffer that holds data read from radio
  size | The number of bytes to read from radio's memory

## ◆ SX126xWriteBuffer()

void SX126xWriteBuffer | ( | uint8_t | offset,
|  | uint8_t * | buffer,
|  | uint8_t | size
| ) |  |

Write data to the buffer holding the payload in the radio.

Parameters

  offset | The offset to start writing the payload
  buffer | The data to be written (the payload)
  size | The number of byte to be written

## ◆ SX126xReadBuffer()

void SX126xReadBuffer | ( | uint8_t | offset,
|  | uint8_t * | buffer,
|  | uint8_t | size
| ) |  |

Read data from the buffer holding the payload in the radio.

Parameters

  offset | The offset to start reading the payload
  buffer | A pointer to a buffer holding the data from the radio
  size | The number of byte to be read

## ◆ SX126xSetDioIrqParams()

void SX126xSetDioIrqParams | ( | uint16_t | irqMask,
|  | uint16_t | dio1Mask,
|  | uint16_t | dio2Mask,
|  | uint16_t | dio3Mask
| ) |  |

Sets the IRQ mask and DIO masks.

Parameters

  irqMask | General IRQ mask
  dio1Mask | DIO1 mask
  dio2Mask | DIO2 mask
  dio3Mask | DIO3 mask

## ◆ SX126xGetIrqStatus()

uint16_t SX126xGetIrqStatus | ( | void |  | ) |

Returns the current IRQ status.

Return values

  irqStatus | IRQ status

## ◆ SX126xSetDio2AsRfSwitchCtrl()

void SX126xSetDio2AsRfSwitchCtrl | ( | uint8_t | enable | ) |

Indicates if DIO2 is used to control an RF Switch.

Parameters

  enable | true of false

## ◆ SX126xSetDio3AsTcxoCtrl()

void SX126xSetDio3AsTcxoCtrl | ( | RadioTcxoCtrlVoltage_t | tcxoVoltage,
|  | uint32_t | timeout
| ) |  |

Indicates if the Radio main clock is supplied from a tcxo.

Parameters

  tcxoVoltage | voltage used to control the TCXO
  timeout | time given to the TCXO to go to 32MHz

## ◆ SX126xSetRfFrequency()

void SX126xSetRfFrequency | ( | uint32_t | frequency | ) |

Sets the RF frequency.

Parameters

  frequency | RF frequency [Hz]

## ◆ SX126xSetPacketType()

void SX126xSetPacketType | ( | RadioPacketTypes_t | packetType | ) |

Sets the radio for the given protocol.

Parameters

  packetType | [PACKET_TYPE_GFSK, PACKET_TYPE_LORA]

Remarks
  This method has to be called before SetRfFrequency, SetModulationParams and SetPacketParams

## ◆ SX126xGetPacketType()

RadioPacketTypes_t SX126xGetPacketType | ( | void |  | ) |

Gets the current radio protocol.

Return values

  packetType | [PACKET_TYPE_GFSK, PACKET_TYPE_LORA]

## ◆ SX126xSetTxParams()

void SX126xSetTxParams | ( | int8_t | power,
|  | RadioRampTimes_t | rampTime
| ) |  |

Sets the transmission parameters.

Parameters

  power | RF output power [-18..13] dBm
  rampTime | Transmission ramp up time

## ◆ SX126xSetModulationParams()

void SX126xSetModulationParams | ( | ModulationParams_t * | modParams | ) |

Set the modulation parameters.

Parameters

  modParams | A structure describing the modulation parameters

## ◆ SX126xSetPacketParams()

void SX126xSetPacketParams | ( | PacketParams_t * | packetParams | ) |

Sets the packet parameters.

Parameters

  packetParams | A structure describing the packet parameters

## ◆ SX126xSetCadParams()

void SX126xSetCadParams | ( | RadioLoRaCadSymbols_t | cadSymbolNum,
|  | uint8_t | cadDetPeak,
|  | uint8_t | cadDetMin,
|  | RadioCadExitModes_t | cadExitMode,
|  | uint32_t | cadTimeout
| ) |  |

Sets the Channel Activity Detection (CAD) parameters.

Parameters

  cadSymbolNum | The number of symbol to use for CAD operations [LORA_CAD_01_SYMBOL, LORA_CAD_02_SYMBOL, LORA_CAD_04_SYMBOL, LORA_CAD_08_SYMBOL, LORA_CAD_16_SYMBOL]
  cadDetPeak | Limit for detection of SNR peak used in the CAD
  cadDetMin | Set the minimum symbol recognition for CAD
  cadExitMode | Operation to be done at the end of CAD action [LORA_CAD_ONLY, LORA_CAD_RX, LORA_CAD_LBT]
  cadTimeout | Defines the timeout value to abort the CAD activity

## ◆ SX126xSetBufferBaseAddress()

void SX126xSetBufferBaseAddress | ( | uint8_t | txBaseAddress,
|  | uint8_t | rxBaseAddress
| ) |  |

Sets the data buffer base address for transmission and reception.

Parameters

  txBaseAddress | Transmission base address
  rxBaseAddress | Reception base address

## ◆ SX126xGetStatus()

RadioStatus_t SX126xGetStatus | ( | void |  | ) |

Gets the current radio status.

Return values

  status | Radio status

## ◆ SX126xGetRssiInst()

int8_t SX126xGetRssiInst | ( | void |  | ) |

Returns the instantaneous RSSI value for the last packet received.

Return values

  rssiInst | Instantaneous RSSI

## ◆ SX126xGetRxBufferStatus()

void SX126xGetRxBufferStatus | ( | uint8_t * | payloadLength,
|  | uint8_t * | rxStartBuffer
| ) |  |

Gets the last received packet buffer status.

Parameters

  payloadLength | Last received packet payload length
  rxStartBuffer | Last received packet buffer address pointer

## ◆ SX126xGetPacketStatus()

void SX126xGetPacketStatus | ( | PacketStatus_t * | pktStatus | ) |

Gets the last received packet payload length.

Parameters

  pktStatus | A structure of packet status

## ◆ SX126xGetDeviceErrors()

RadioError_t SX126xGetDeviceErrors | ( | void |  | ) |

Returns the possible system errors.

Return values

  sysErrors | Value representing the possible sys failures

## ◆ SX126xClearDeviceErrors()

void SX126xClearDeviceErrors | ( | void |  | ) |

Clear all the errors in the device.

## ◆ SX126xClearIrqStatus()

void SX126xClearIrqStatus | ( | uint16_t | irq | ) |

Clears the IRQs.

Parameters

  irq | IRQ(s) to be cleared