SX126x-Arduino  2.0.1
Functions | Variables
sx126x-board.h File Reference
#include <Arduino.h>
#include "sx126x-debug.h"

Go to the source code of this file.

Functions

void SX126xIoInit (void)
 Initializes the radio I/Os pins interface. More...
 
void SX126xIoReInit (void)
 Initializes the radio I/Os pins interface after deep sleep wake. More...
 
void SX126xIoIrqInit (DioIrqHandler dioIrq)
 Initializes DIO IRQ handlers. More...
 
void SX126xIoDeInit (void)
 De-initializes the radio I/Os pins interface. More...
 
void SX126xReset (void)
 HW Reset of the radio. More...
 
void SX126xWaitOnBusy (void)
 Blocking loop to wait while the Busy pin in high. More...
 
void SX126xWakeup (void)
 Wakes up the radio. More...
 
void SX126xWriteCommand (RadioCommands_t opcode, uint8_t *buffer, uint16_t size)
 Send a command that write data to the radio. More...
 
void SX126xReadCommand (RadioCommands_t opcode, uint8_t *buffer, uint16_t size)
 Send a command that read data from the radio. More...
 
void SX126xWriteRegister (uint16_t address, uint8_t value)
 Write a single byte of data to the radio memory. More...
 
uint8_t SX126xReadRegister (uint16_t address)
 Read a single byte of data from the radio memory. More...
 
void SX126xSetRfTxPower (int8_t power)
 Sets the radio output power. More...
 
uint8_t SX126xGetPaSelect (uint32_t channel)
 Gets the board PA selection configuration. More...
 
void SX126xAntSwOn (void)
 Initializes the RF Switch I/Os pins interface. More...
 
void SX126xAntSwOff (void)
 De-initializes the RF Switch I/Os pins interface. More...
 
void SX126xRXena (void)
 Set the RF antenna switch to receiving mode. More...
 
void SX126xTXena (void)
 Set the RF antenna switch to transmitting mode. More...
 
bool SX126xCheckRfFrequency (uint32_t frequency)
 Checks if the given RF frequency is supported by the hardware. More...
 
void SX126xGetStats (uint16_t *nb_pkt_received, uint16_t *nb_pkt_crc_error, uint16_t *nb_pkt_length_error)
 Gets info on the number of packets received. More...
 
void SX126xResetStats (void)
 Resets values read by GetStats. More...
 

Variables

SX126x_t SX126x
 Radio hardware and global parameters. More...
 

Function Documentation

◆ SX126xIoInit()

void SX126xIoInit ( void  )

Initializes the radio I/Os pins interface.

◆ SX126xIoReInit()

void SX126xIoReInit ( void  )

Initializes the radio I/Os pins interface after deep sleep wake.

◆ SX126xIoIrqInit()

void SX126xIoIrqInit ( DioIrqHandler  dioIrq)

Initializes DIO IRQ handlers.

Parameters
dioIrqArray containing the IRQ callback functions

◆ SX126xIoDeInit()

void SX126xIoDeInit ( void  )

De-initializes the radio I/Os pins interface.

Remarks
Useful when going in MCU low power modes

◆ SX126xReset()

void SX126xReset ( void  )

HW Reset of the radio.

◆ SX126xWaitOnBusy()

void SX126xWaitOnBusy ( void  )

Blocking loop to wait while the Busy pin in high.

Todo:
This error should be reported to the main app

◆ SX126xWakeup()

void SX126xWakeup ( void  )

Wakes up the radio.

◆ SX126xWriteCommand()

void SX126xWriteCommand ( RadioCommands_t  opcode,
uint8_t *  buffer,
uint16_t  size 
)

Send a command that write data to the radio.

Parameters
opcodeOpcode of the command
bufferBuffer to be send to the radio
sizeSize of the buffer to send

◆ SX126xReadCommand()

void SX126xReadCommand ( RadioCommands_t  opcode,
uint8_t *  buffer,
uint16_t  size 
)

Send a command that read data from the radio.

Parameters
opcodeOpcode of the command
bufferBuffer holding data from the radio
sizeSize of the buffer

◆ SX126xWriteRegister()

void SX126xWriteRegister ( uint16_t  address,
uint8_t  value 
)

Write a single byte of data to the radio memory.

Parameters
addressThe address of the first byte to write in the radio
valueThe data to be written in radio's memory

◆ SX126xReadRegister()

uint8_t SX126xReadRegister ( uint16_t  address)

Read a single byte of data from the radio memory.

Parameters
addressThe address of the first byte to write in the radio
Return values
valueThe value of the byte at the given address in radio's memory

◆ SX126xSetRfTxPower()

void SX126xSetRfTxPower ( int8_t  power)

Sets the radio output power.

Parameters
powerSets the RF output power

◆ SX126xGetPaSelect()

uint8_t SX126xGetPaSelect ( uint32_t  channel)

Gets the board PA selection configuration.

Parameters
channelChannel frequency in Hz
Return values
PaSelectRegPaConfig PaSelect value

◆ SX126xAntSwOn()

void SX126xAntSwOn ( void  )

Initializes the RF Switch I/Os pins interface.

◆ SX126xAntSwOff()

void SX126xAntSwOff ( void  )

De-initializes the RF Switch I/Os pins interface.

Remarks
Needed to decrease the power consumption in MCU low power modes

◆ SX126xRXena()

void SX126xRXena ( void  )

Set the RF antenna switch to receiving mode.

Remarks
Used only on some modules e.g. eByte E22

◆ SX126xTXena()

void SX126xTXena ( void  )

Set the RF antenna switch to transmitting mode.

Remarks
Used only on some modules e.g. eByte E22

◆ SX126xCheckRfFrequency()

bool SX126xCheckRfFrequency ( uint32_t  frequency)

Checks if the given RF frequency is supported by the hardware.

Parameters
frequencyRF frequency to be checked
Return values
isSupported[true: supported, false: unsupported]

◆ SX126xGetStats()

void SX126xGetStats ( uint16_t *  nb_pkt_received,
uint16_t *  nb_pkt_crc_error,
uint16_t *  nb_pkt_length_error 
)

Gets info on the number of packets received.

Parameters
nb_pkt_receivedNumber of received packets with CRC OK
nb_pkt_crc_errorNumber of received packets with CRC error
nb_pkt_length_errorNumber of received packets with length error

◆ SX126xResetStats()

void SX126xResetStats ( void  )

Resets values read by GetStats.

Variable Documentation

◆ SX126x

SX126x_t SX126x

Radio hardware and global parameters.

Radio hardware and global parameters