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

SX126x radio driver definition. More...

#include <stdint.h>
#include <stdbool.h>
#include "networkif.h"

Go to the source code of this file.

Data Structures

struct  sx126x_cad_param_s
 SX126X CAD parameters structure definition. More...
 
struct  sx126x_chip_status_s
 SX126X chip status structure definition. More...
 
struct  sx126x_mod_params_gfsk_s
 SX126X GFSK modulation parameters structure definition. More...
 
struct  sx126x_mod_params_lora_s
 SX126X LoRa modulation parameters structure definition. More...
 
struct  sx126x_pa_cfg_params_s
 SX126X power amplifier configuration parameters structure definition. More...
 
struct  sx126x_pkt_params_gfsk_s
 SX126X GFSK packet parameters structure definition. More...
 
struct  sx126x_pkt_params_lora_s
 SX126X LoRa packet parameters structure definition. More...
 
struct  sx126x_pkt_status_gfsk_s
 SX126X GFSK packet status structure definition. More...
 
struct  sx126x_pkt_status_lora_s
 SX126X LoRa packet status structure definition. More...
 
struct  sx126x_rx_buffer_status_s
 SX126X RX buffer status structure definition. More...
 
struct  sx126x_rx_status_gfsk_s
 
struct  sx126x_stats_gfsk_s
 SX126X GFSK reception statistics structure definition. More...
 
struct  sx126x_stats_lora_s
 SX126X LoRa reception statistics structure definition. More...
 

Macros

#define SX126X_CHIP_MODES_MASK   (0x07UL << SX126X_CHIP_MODES_POS)
 
#define SX126X_CHIP_MODES_POS   (4U)
 
#define SX126X_CMD_STATUS_MASK   (0x07UL << SX126X_CMD_STATUS_POS)
 
#define SX126X_CMD_STATUS_POS   (1U)
 
#define SX126X_GFSK_RX_STATUS_ABORT_ERROR_MASK   (0x01UL << SX126X_GFSK_RX_STATUS_ABORT_ERROR_POS)
 
#define SX126X_GFSK_RX_STATUS_ABORT_ERROR_POS   (2U)
 
#define SX126X_GFSK_RX_STATUS_ADRS_ERROR_MASK   (0x01UL << SX126X_GFSK_RX_STATUS_ADRS_ERROR_POS)
 
#define SX126X_GFSK_RX_STATUS_ADRS_ERROR_POS   (5U)
 
#define SX126X_GFSK_RX_STATUS_CRC_ERROR_MASK   (0x01UL << SX126X_GFSK_RX_STATUS_CRC_ERROR_POS)
 
#define SX126X_GFSK_RX_STATUS_CRC_ERROR_POS   (4U)
 
#define SX126X_GFSK_RX_STATUS_LENGTH_ERROR_MASK   (0x01UL << SX126X_GFSK_RX_STATUS_LENGTH_ERROR_POS)
 
#define SX126X_GFSK_RX_STATUS_LENGTH_ERROR_POS   (3U)
 
#define SX126X_GFSK_RX_STATUS_PKT_RECEIVED_MASK   (0x01UL << SX126X_GFSK_RX_STATUS_PKT_RECEIVED_POS)
 
#define SX126X_GFSK_RX_STATUS_PKT_RECEIVED_POS   (1U)
 
#define SX126X_GFSK_RX_STATUS_PKT_SENT_MASK   (0x01UL << SX126X_GFSK_RX_STATUS_PKT_SENT_POS)
 
#define SX126X_GFSK_RX_STATUS_PKT_SENT_POS   (0U)
 
#define SX126X_MAX_TIMEOUT_IN_MS   (SX126X_MAX_TIMEOUT_IN_RTC_STEP / 64)
 Maximum value for parameter timeout_in_ms in both functions sx126x_set_rx and sx126x_set_tx. More...
 
#define SX126X_MAX_TIMEOUT_IN_RTC_STEP   0x00FFFFFE
 Maximum value for parameter timeout_in_rtc_step in both functions sx126x_set_rx_with_timeout_in_rtc_step and sx126x_set_tx_with_timeout_in_rtc_step. More...
 
#define SX126X_RX_CONTINUOUS   0x00FFFFFF
 Timeout parameter in sx126x_set_rx_with_timeout_in_rtc_step to launch a continuous reception. More...
 
#define SX126X_RX_SINGLE_MODE   0x00000000
 Timeout parameter in sx126x_set_rx_with_timeout_in_rtc_step to set the chip in reception until a reception occurs. More...
 

Typedefs

typedef enum sx126x_cad_exit_modes_e sx126x_cad_exit_modes_t
 SX126X LoRa CAD exit modes enumeration definition. More...
 
typedef struct sx126x_cad_param_s sx126x_cad_params_t
 SX126X CAD parameters structure definition.
 
typedef enum sx126x_cad_symbs_e sx126x_cad_symbs_t
 SX126X LoRa CAD number of symbols enumeration definition. More...
 
typedef uint8_t sx126x_cal_mask_t
 
typedef enum sx126x_chip_modes_e sx126x_chip_modes_t
 SX126X chip mode enumeration definition.
 
typedef struct sx126x_chip_status_s sx126x_chip_status_t
 SX126X chip status structure definition.
 
typedef enum sx126x_cmd_status_e sx126x_cmd_status_t
 SX126X command status enumeration definition.
 
typedef uint16_t sx126x_errors_mask_t
 
typedef enum sx126x_fallback_modes_e sx126x_fallback_modes_t
 SX126X fallback modes enumeration definition.
 
typedef enum sx126x_gfsk_address_filtering_e sx126x_gfsk_address_filtering_t
 SX126X GFSK address filtering configuration enumeration definition.
 
typedef enum sx126x_gfsk_bw_e sx126x_gfsk_bw_t
 SX126X GFSK Rx bandwidth enumeration definition.
 
typedef enum sx16x_gfsk_crc_types_e sx126x_gfsk_crc_types_t
 SX126X GFSK CRC type enumeration definition.
 
typedef enum sx126x_gfsk_dc_free_e sx126x_gfsk_dc_free_t
 SX126X GFSK whitening control enumeration definition.
 
typedef enum sx126x_gfsk_pkt_len_modes_e sx126x_gfsk_pkt_len_modes_t
 SX126X GFSK packet length enumeration definition.
 
typedef enum sx126x_gfsk_preamble_detector_e sx126x_gfsk_preamble_detector_t
 SX126X GFSK preamble length Rx detection size enumeration definition.
 
typedef enum sx126x_gfsk_pulse_shape_e sx126x_gfsk_pulse_shape_t
 SX126X GFSK modulation shaping enumeration definition.
 
typedef uint16_t sx126x_irq_mask_t
 
typedef enum sx126x_lora_bw_e sx126x_lora_bw_t
 SX126X LoRa bandwidth enumeration definition.
 
typedef enum sx126x_lora_cr_e sx126x_lora_cr_t
 SX126X LoRa coding rate enumeration definition.
 
typedef enum sx126x_lora_pkt_len_modes_e sx126x_lora_pkt_len_modes_t
 SX126X LoRa packet length enumeration definition.
 
typedef enum sx126x_lora_sf_e sx126x_lora_sf_t
 SX126X LoRa spreading factor enumeration definition.
 
typedef struct sx126x_mod_params_gfsk_s sx126x_mod_params_gfsk_t
 SX126X GFSK modulation parameters structure definition.
 
typedef struct sx126x_mod_params_lora_s sx126x_mod_params_lora_t
 SX126X LoRa modulation parameters structure definition.
 
typedef struct sx126x_pa_cfg_params_s sx126x_pa_cfg_params_t
 SX126X power amplifier configuration parameters structure definition.
 
typedef struct sx126x_pkt_params_gfsk_s sx126x_pkt_params_gfsk_t
 SX126X GFSK packet parameters structure definition.
 
typedef struct sx126x_pkt_params_lora_s sx126x_pkt_params_lora_t
 SX126X LoRa packet parameters structure definition.
 
typedef struct sx126x_pkt_status_gfsk_s sx126x_pkt_status_gfsk_t
 SX126X GFSK packet status structure definition.
 
typedef struct sx126x_pkt_status_lora_s sx126x_pkt_status_lora_t
 SX126X LoRa packet status structure definition.
 
typedef enum sx126x_pkt_types_e sx126x_pkt_type_t
 SX126X packet types enumeration definition.
 
typedef enum sx126x_ramp_time_e sx126x_ramp_time_t
 SX126X power amplifier ramp-up timings enumeration definition.
 
typedef enum sx126x_reg_mods_e sx126x_reg_mod_t
 SX126X power regulator modes enumeration definition.
 
typedef struct sx126x_rx_buffer_status_s sx126x_rx_buffer_status_t
 SX126X RX buffer status structure definition.
 
typedef struct sx126x_rx_status_gfsk_s sx126x_rx_status_gfsk_t
 
typedef enum sx126x_sleep_cfgs_e sx126x_sleep_cfgs_t
 SX126X sleep mode configurations definition.
 
typedef uint8_t sx126x_standby_cfg_t
 
typedef enum sx126x_standby_cfgs_e sx126x_standby_cfgs_t
 SX126X standby modes enumeration definition.
 
typedef struct sx126x_stats_gfsk_s sx126x_stats_gfsk_t
 SX126X GFSK reception statistics structure definition.
 
typedef struct sx126x_stats_lora_s sx126x_stats_lora_t
 SX126X LoRa reception statistics structure definition.
 
typedef enum sx126x_status_e sx126x_status_t
 SX126X APIs return status enumeration definition.
 
typedef enum sx126x_tcxo_ctrl_voltages_e sx126x_tcxo_ctrl_voltages_t
 SX126X TCXO control voltages enumeration definition.
 

Enumerations

enum  sx126x_cad_exit_modes_e { SX126X_CAD_ONLY = 0x00 , SX126X_CAD_RX = 0x01 , SX126X_CAD_LBT = 0x10 }
 SX126X LoRa CAD exit modes enumeration definition. More...
 
enum  sx126x_cad_symbs_e {
  SX126X_CAD_01_SYMB = 0x00 , SX126X_CAD_02_SYMB = 0x01 , SX126X_CAD_04_SYMB = 0x02 , SX126X_CAD_08_SYMB = 0x03 ,
  SX126X_CAD_16_SYMB = 0x04
}
 SX126X LoRa CAD number of symbols enumeration definition. More...
 
enum  sx126x_cal_mask_e {
  SX126X_CAL_RC64K = (1 << 0) , SX126X_CAL_RC13M = (1 << 1) , SX126X_CAL_PLL = (1 << 2) , SX126X_CAL_ADC_PULSE = (1 << 3) ,
  SX126X_CAL_ADC_BULK_N = (1 << 4) , SX126X_CAL_ADC_BULK_P = (1 << 5) , SX126X_CAL_IMAGE = (1 << 6) , SX126X_CAL_ALL
}
 Calibration settings. More...
 
enum  sx126x_chip_modes_e {
  SX126X_CHIP_MODE_UNUSED = 0 , SX126X_CHIP_MODE_RFU = 1 , SX126X_CHIP_MODE_STBY_RC = 2 , SX126X_CHIP_MODE_STBY_XOSC = 3 ,
  SX126X_CHIP_MODE_FS = 4 , SX126X_CHIP_MODE_RX = 5 , SX126X_CHIP_MODE_TX = 6
}
 SX126X chip mode enumeration definition. More...
 
enum  sx126x_cmd_status_e {
  SX126X_CMD_STATUS_RESERVED = 0 , SX126X_CMD_STATUS_RFU = 1 , SX126X_CMD_STATUS_DATA_AVAILABLE = 2 , SX126X_CMD_STATUS_CMD_TIMEOUT = 3 ,
  SX126X_CMD_STATUS_CMD_PROCESS_ERROR = 4 , SX126X_CMD_STATUS_CMD_EXEC_FAILURE = 5 , SX126X_CMD_STATUS_CMD_TX_DONE = 6
}
 SX126X command status enumeration definition. More...
 
enum  sx126x_errors_e {
  SX126X_ERRORS_RC64K_CALIBRATION = (1 << 0) , SX126X_ERRORS_RC13M_CALIBRATION = (1 << 1) , SX126X_ERRORS_PLL_CALIBRATION = (1 << 2) , SX126X_ERRORS_ADC_CALIBRATION = (1 << 3) ,
  SX126X_ERRORS_IMG_CALIBRATION = (1 << 4) , SX126X_ERRORS_XOSC_START = (1 << 5) , SX126X_ERRORS_PLL_LOCK = (1 << 6) , SX126X_ERRORS_PA_RAMP = (1 << 8)
}
 SX126X errors enumeration definition. More...
 
enum  sx126x_fallback_modes_e { SX126X_FALLBACK_STDBY_RC = 0x20 , SX126X_FALLBACK_STDBY_XOSC = 0x30 , SX126X_FALLBACK_FS = 0x40 }
 SX126X fallback modes enumeration definition. More...
 
enum  sx126x_gfsk_address_filtering_e { SX126X_GFSK_ADDRESS_FILTERING_DISABLE = 0x00 , SX126X_GFSK_ADDRESS_FILTERING_NODE_ADDRESS = 0x01 , SX126X_GFSK_ADDRESS_FILTERING_NODE_AND_BROADCAST_ADDRESSES = 0x02 }
 SX126X GFSK address filtering configuration enumeration definition. More...
 
enum  sx126x_gfsk_bw_e {
  SX126X_GFSK_BW_4800 = 0x1F , SX126X_GFSK_BW_5800 = 0x17 , SX126X_GFSK_BW_7300 = 0x0F , SX126X_GFSK_BW_9700 = 0x1E ,
  SX126X_GFSK_BW_11700 = 0x16 , SX126X_GFSK_BW_14600 = 0x0E , SX126X_GFSK_BW_19500 = 0x1D , SX126X_GFSK_BW_23400 = 0x15 ,
  SX126X_GFSK_BW_29300 = 0x0D , SX126X_GFSK_BW_39000 = 0x1C , SX126X_GFSK_BW_46900 = 0x14 , SX126X_GFSK_BW_58600 = 0x0C ,
  SX126X_GFSK_BW_78200 = 0x1B , SX126X_GFSK_BW_93800 = 0x13 , SX126X_GFSK_BW_117300 = 0x0B , SX126X_GFSK_BW_156200 = 0x1A ,
  SX126X_GFSK_BW_187200 = 0x12 , SX126X_GFSK_BW_234300 = 0x0A , SX126X_GFSK_BW_312000 = 0x19 , SX126X_GFSK_BW_373600 = 0x11 ,
  SX126X_GFSK_BW_467000 = 0x09
}
 SX126X GFSK Rx bandwidth enumeration definition. More...
 
enum  sx126x_gfsk_dc_free_e { SX126X_GFSK_DC_FREE_OFF = 0x00 , SX126X_GFSK_DC_FREE_WHITENING = 0x01 }
 SX126X GFSK whitening control enumeration definition. More...
 
enum  sx126x_gfsk_pkt_len_modes_e { SX126X_GFSK_PKT_FIX_LEN = 0x00 , SX126X_GFSK_PKT_VAR_LEN = 0x01 }
 SX126X GFSK packet length enumeration definition. More...
 
enum  sx126x_gfsk_preamble_detector_e {
  SX126X_GFSK_PREAMBLE_DETECTOR_OFF = 0x00 , SX126X_GFSK_PREAMBLE_DETECTOR_MIN_8BITS = 0x04 , SX126X_GFSK_PREAMBLE_DETECTOR_MIN_16BITS = 0x05 , SX126X_GFSK_PREAMBLE_DETECTOR_MIN_24BITS = 0x06 ,
  SX126X_GFSK_PREAMBLE_DETECTOR_MIN_32BITS = 0x07
}
 SX126X GFSK preamble length Rx detection size enumeration definition. More...
 
enum  sx126x_gfsk_pulse_shape_e {
  SX126X_GFSK_PULSE_SHAPE_OFF = 0x00 , SX126X_GFSK_PULSE_SHAPE_BT_03 = 0x08 , SX126X_GFSK_PULSE_SHAPE_BT_05 = 0x09 , SX126X_GFSK_PULSE_SHAPE_BT_07 = 0x0A ,
  SX126X_GFSK_PULSE_SHAPE_BT_1 = 0x0B
}
 SX126X GFSK modulation shaping enumeration definition. More...
 
enum  sx126x_irq_masks_e {
  SX126X_IRQ_NONE = (0 << 0) , SX126X_IRQ_TX_DONE = (1 << 0) , SX126X_IRQ_RX_DONE = (1 << 1) , SX126X_IRQ_PREAMBLE_DETECTED = (1 << 2) ,
  SX126X_IRQ_SYNC_WORD_VALID = (1 << 3) , SX126X_IRQ_HEADER_VALID = (1 << 4) , SX126X_IRQ_HEADER_ERROR = (1 << 5) , SX126X_IRQ_CRC_ERROR = (1 << 6) ,
  SX126X_IRQ_CAD_DONE = (1 << 7) , SX126X_IRQ_CAD_DETECTED = (1 << 8) , SX126X_IRQ_TIMEOUT = (1 << 9) , SX126X_IRQ_ALL
}
 SX126X interrupt masks enumeration definition. More...
 
enum  sx126x_lora_bw_e {
  SX126X_LORA_BW_500 = 6 , SX126X_LORA_BW_250 = 5 , SX126X_LORA_BW_125 = 4 , SX126X_LORA_BW_062 = 3 ,
  SX126X_LORA_BW_041 = 10 , SX126X_LORA_BW_031 = 2 , SX126X_LORA_BW_020 = 9 , SX126X_LORA_BW_015 = 1 ,
  SX126X_LORA_BW_010 = 8 , SX126X_LORA_BW_007 = 0
}
 SX126X LoRa bandwidth enumeration definition. More...
 
enum  sx126x_lora_cr_e { SX126X_LORA_CR_4_5 = 0x01 , SX126X_LORA_CR_4_6 = 0x02 , SX126X_LORA_CR_4_7 = 0x03 , SX126X_LORA_CR_4_8 = 0x04 }
 SX126X LoRa coding rate enumeration definition. More...
 
enum  sx126x_lora_pkt_len_modes_e { SX126X_LORA_PKT_EXPLICIT = 0x00 , SX126X_LORA_PKT_IMPLICIT = 0x01 }
 SX126X LoRa packet length enumeration definition. More...
 
enum  sx126x_lora_sf_e {
  SX126X_LORA_SF5 = 0x05 , SX126X_LORA_SF6 = 0x06 , SX126X_LORA_SF7 = 0x07 , SX126X_LORA_SF8 = 0x08 ,
  SX126X_LORA_SF9 = 0x09 , SX126X_LORA_SF10 = 0x0A , SX126X_LORA_SF11 = 0x0B , SX126X_LORA_SF12 = 0x0C
}
 SX126X LoRa spreading factor enumeration definition. More...
 
enum  sx126x_pkt_types_e { SX126X_PKT_TYPE_GFSK = 0x00 , SX126X_PKT_TYPE_LORA = 0x01 }
 SX126X packet types enumeration definition. More...
 
enum  sx126x_ramp_time_e {
  SX126X_RAMP_10_US = 0x00 , SX126X_RAMP_20_US = 0x01 , SX126X_RAMP_40_US = 0x02 , SX126X_RAMP_80_US = 0x03 ,
  SX126X_RAMP_200_US = 0x04 , SX126X_RAMP_800_US = 0x05 , SX126X_RAMP_1700_US = 0x06 , SX126X_RAMP_3400_US = 0x07
}
 SX126X power amplifier ramp-up timings enumeration definition. More...
 
enum  sx126x_reg_mods_e { SX126X_REG_MODE_LDO = 0x00 , SX126X_REG_MODE_DCDC = 0x01 }
 SX126X power regulator modes enumeration definition. More...
 
enum  sx126x_sleep_cfgs_e { SX126X_SLEEP_CFG_COLD_START = (0 << 2) , SX126X_SLEEP_CFG_WARM_START = (1 << 2) }
 SX126X sleep mode configurations definition. More...
 
enum  sx126x_standby_cfgs_e { SX126X_STANDBY_CFG_RC = 0x00 , SX126X_STANDBY_CFG_XOSC = 0x01 }
 SX126X standby modes enumeration definition. More...
 
enum  sx126x_status_e { SX126X_STATUS_OK = 0 , SX126X_STATUS_UNSUPPORTED_FEATURE , SX126X_STATUS_UNKNOWN_VALUE , SX126X_STATUS_ERROR }
 SX126X APIs return status enumeration definition. More...
 
enum  sx126x_tcxo_ctrl_voltages_e {
  SX126X_TCXO_CTRL_1_6V = 0x00 , SX126X_TCXO_CTRL_1_7V = 0x01 , SX126X_TCXO_CTRL_1_8V = 0x02 , SX126X_TCXO_CTRL_2_2V = 0x03 ,
  SX126X_TCXO_CTRL_2_4V = 0x04 , SX126X_TCXO_CTRL_2_7V = 0x05 , SX126X_TCXO_CTRL_3_0V = 0x06 , SX126X_TCXO_CTRL_3_3V = 0x07
}
 SX126X TCXO control voltages enumeration definition. More...
 
enum  sx16x_gfsk_crc_types_e {
  SX126X_GFSK_CRC_OFF = 0x01 , SX126X_GFSK_CRC_1_BYTE = 0x00 , SX126X_GFSK_CRC_2_BYTES = 0x02 , SX126X_GFSK_CRC_1_BYTE_INV = 0x04 ,
  SX126X_GFSK_CRC_2_BYTES_INV = 0x06
}
 SX126X GFSK CRC type enumeration definition. More...
 

Functions

sx126x_status_t sx126x_cal (struct network_context *nctx, const sx126x_cal_mask_t param)
 Perform the calibration of the requested blocks. More...
 
sx126x_status_t sx126x_cal_img (struct network_context *nctx, const uint32_t freq_in_hz)
 Perform device operating frequency band image rejection calibration. More...
 
sx126x_status_t sx126x_cfg_rx_boosted (struct network_context *nctx, const bool state)
 Configure the boost mode in reception. More...
 
sx126x_status_t sx126x_cfg_tx_clamp (struct network_context *nctx)
 Configure the Tx PA clamp. More...
 
sx126x_status_t sx126x_clear_device_errors (struct network_context *nctx)
 Clear all active errors. More...
 
sx126x_status_t sx126x_clear_irq_status (struct network_context *nctx, const sx126x_irq_mask_t irq_mask)
 Clear selected system interrupts. More...
 
uint32_t sx126x_convert_freq_in_hz_to_pll_step (uint32_t freq_in_hz)
 Get the number of PLL steps for a given frequency in Hertz. More...
 
uint32_t sx126x_convert_timeout_in_ms_to_rtc_step (uint32_t timeout_in_ms)
 Get the number of RTC steps for a given timeout in millisecond. More...
 
sx126x_status_t sx126x_get_and_clear_irq_status (struct network_context *nctx, sx126x_irq_mask_t *irq)
 Clears any radio irq status flags that are set and returns the flags that were cleared. More...
 
sx126x_status_t sx126x_get_device_errors (struct network_context *nctx, sx126x_errors_mask_t *errors)
 Get the list of all active errors. More...
 
sx126x_status_t sx126x_get_gfsk_bw_param (const uint32_t bw, uint8_t *param)
 Get the parameter corresponding to a GFSK Rx bandwith immediately above the minimum requested one. More...
 
sx126x_status_t sx126x_get_gfsk_pkt_status (struct network_context *nctx, sx126x_pkt_status_gfsk_t *pkt_status)
 Get the status of the last GFSK packet received. More...
 
sx126x_status_t sx126x_get_gfsk_stats (struct network_context *nctx, sx126x_stats_gfsk_t *stats)
 Get the statistics about GFSK communication. More...
 
uint32_t sx126x_get_gfsk_time_on_air_in_ms (const sx126x_pkt_params_gfsk_t *pkt_p, const sx126x_mod_params_gfsk_t *mod_p)
 Get the time on air in ms for GFSK transmission. More...
 
uint32_t sx126x_get_gfsk_time_on_air_numerator (const sx126x_pkt_params_gfsk_t *pkt_p)
 Compute the numerator for GFSK time-on-air computation. More...
 
sx126x_status_t sx126x_get_irq_status (struct network_context *nctx, sx126x_irq_mask_t *irq)
 Get system interrupt status. More...
 
uint32_t sx126x_get_lora_bw_in_hz (sx126x_lora_bw_t bw)
 Get the actual value in Hertz of a given LoRa bandwidth. More...
 
sx126x_status_t sx126x_get_lora_pkt_status (struct network_context *nctx, sx126x_pkt_status_lora_t *pkt_status)
 Get the status of the last LoRa packet received. More...
 
sx126x_status_t sx126x_get_lora_stats (struct network_context *nctx, sx126x_stats_lora_t *stats)
 Get the statistics about LoRa communication. More...
 
uint32_t sx126x_get_lora_time_on_air_in_ms (const sx126x_pkt_params_lora_t *pkt_p, const sx126x_mod_params_lora_t *mod_p)
 Get the time on air in ms for LoRa transmission. More...
 
uint32_t sx126x_get_lora_time_on_air_numerator (const sx126x_pkt_params_lora_t *pkt_p, const sx126x_mod_params_lora_t *mod_p)
 Compute the numerator for LoRa time-on-air computation. More...
 
sx126x_status_t sx126x_get_pkt_type (struct network_context *nctx, sx126x_pkt_type_t *pkt_type)
 Get the current packet type. More...
 
sx126x_status_t sx126x_get_random_numbers (struct network_context *nctx, uint32_t *numbers, unsigned int n)
 Generate one or more 32-bit random numbers. More...
 
sx126x_status_t sx126x_get_rssi_inst (struct network_context *nctx, int16_t *rssi_in_dbm)
 Get the instantaneous RSSI value. More...
 
sx126x_status_t sx126x_get_rx_buffer_status (struct network_context *nctx, sx126x_rx_buffer_status_t *rx_buffer_status)
 Get the current Rx buffer status for both LoRa and GFSK Rx operations. More...
 
sx126x_status_t sx126x_get_status (struct network_context *nctx, sx126x_chip_status_t *radio_status)
 Get the chip status. More...
 
sx126x_status_t sx126x_read_buffer (struct network_context *nctx, const uint8_t offset, uint8_t *buffer, const uint8_t size)
 Read data from radio Rx buffer memory space. More...
 
sx126x_status_t sx126x_read_register (struct network_context *nctx, const uint16_t address, uint8_t *buffer, const uint8_t size)
 Read data from register memory space. More...
 
sx126x_status_t sx126x_reset (struct network_context *nctx)
 Perform a hard reset of the chip. More...
 
sx126x_status_t sx126x_reset_stats (struct network_context *nctx)
 Reset all the statistics for both Lora and GFSK communications. More...
 
sx126x_status_t sx126x_set_buffer_base_address (struct network_context *nctx, const uint8_t tx_base_address, const uint8_t rx_base_address)
 Set buffer start addresses for both Tx and Rx operations. More...
 
sx126x_status_t sx126x_set_cad (struct network_context *nctx)
 Set the chip in CAD (Channel Activity Detection) mode. More...
 
sx126x_status_t sx126x_set_cad_params (struct network_context *nctx, const sx126x_cad_params_t *params)
 Set the parameters for CAD operation. More...
 
sx126x_status_t sx126x_set_dio2_as_rf_sw_ctrl (struct network_context *nctx, const bool enable)
 Configure the embedded RF switch control. More...
 
sx126x_status_t sx126x_set_dio3_as_tcxo_ctrl (struct network_context *nctx, const sx126x_tcxo_ctrl_voltages_t tcxo_voltage, const uint32_t timeout)
 Configure the embedded TCXO switch control. More...
 
sx126x_status_t sx126x_set_dio_irq_params (struct network_context *nctx, const uint16_t irq_mask, const uint16_t dio1_mask, const uint16_t dio2_mask, const uint16_t dio3_mask)
 Set which interrupt signals are redirected to the dedicated DIO pin. More...
 
sx126x_status_t sx126x_set_fs (struct network_context *nctx)
 Set the chip in frequency synthesis mode. More...
 
sx126x_status_t sx126x_set_gfsk_crc_polynomial (struct network_context *nctx, const uint16_t polynomial)
 Configure the polynomial used to compute CRC in GFSK packet. More...
 
sx126x_status_t sx126x_set_gfsk_crc_seed (struct network_context *nctx, uint16_t seed)
 Configure the seed used to compute CRC in GFSK packet. More...
 
sx126x_status_t sx126x_set_gfsk_mod_params (struct network_context *nctx, const sx126x_mod_params_gfsk_t *params)
 Set the modulation parameters for GFSK packets. More...
 
sx126x_status_t sx126x_set_gfsk_pkt_params (struct network_context *nctx, const sx126x_pkt_params_gfsk_t *params)
 Set the packet parameters for GFSK packets. More...
 
sx126x_status_t sx126x_set_gfsk_sync_word (struct network_context *nctx, const uint8_t *sync_word, const uint8_t sync_word_len)
 Configure the sync word used in GFSK packet. More...
 
sx126x_status_t sx126x_set_gfsk_whitening_seed (struct network_context *nctx, const uint16_t seed)
 Configure the whitening seed used in GFSK packet. More...
 
sx126x_status_t sx126x_set_lora_mod_params (struct network_context *nctx, const sx126x_mod_params_lora_t *params)
 Set the modulation parameters for LoRa packets. More...
 
sx126x_status_t sx126x_set_lora_pkt_params (struct network_context *nctx, const sx126x_pkt_params_lora_t *params)
 Set the packet parameters for LoRa packets. More...
 
sx126x_status_t sx126x_set_lora_symb_nb_timeout (struct network_context *nctx, const uint8_t nb_of_symbs)
 
sx126x_status_t sx126x_set_lora_sync_word (struct network_context *nctx, const uint8_t sync_word)
 Configure the sync word used in LoRa packet. More...
 
sx126x_status_t sx126x_set_ocp_value (struct network_context *nctx, const uint8_t ocp_in_step_of_2_5_ma)
 Configure the Over Current Protection (OCP) value. More...
 
sx126x_status_t sx126x_set_pa_cfg (struct network_context *nctx, const sx126x_pa_cfg_params_t *params)
 Configure the PA (Power Amplifier) More...
 
sx126x_status_t sx126x_set_pkt_type (struct network_context *nctx, const sx126x_pkt_type_t pkt_type)
 Set the packet type. More...
 
sx126x_status_t sx126x_set_reg_mode (struct network_context *nctx, const sx126x_reg_mod_t mode)
 Configure the regulator mode to be used. More...
 
sx126x_status_t sx126x_set_rf_freq (struct network_context *nctx, const uint32_t freq_in_hz)
 Set the RF frequency for future radio operations. More...
 
sx126x_status_t sx126x_set_rf_freq_in_pll_steps (struct network_context *nctx, const uint32_t freq)
 Set the RF frequency for future radio operations - parameter in PLL steps. More...
 
sx126x_status_t sx126x_set_rx (struct network_context *nctx, const uint32_t timeout_in_ms)
 Set the chip in reception mode. More...
 
sx126x_status_t sx126x_set_rx_duty_cycle (struct network_context *nctx, const uint32_t rx_time_in_ms, const uint32_t sleep_time_in_ms)
 Set the chip in reception mode with duty cycling. More...
 
sx126x_status_t sx126x_set_rx_duty_cycle_with_timings_in_rtc_step (struct network_context *nctx, const uint32_t rx_time_in_rtc_step, const uint32_t sleep_time_in_rtc_step)
 Set the chip in reception mode with duty cycling. More...
 
sx126x_status_t sx126x_set_rx_tx_fallback_mode (struct network_context *nctx, const sx126x_fallback_modes_t fallback_mode)
 Set chip mode to be used after successful transmission or reception. More...
 
sx126x_status_t sx126x_set_rx_with_timeout_in_rtc_step (struct network_context *nctx, const uint32_t timeout_in_rtc_step)
 Set the chip in reception mode. More...
 
sx126x_status_t sx126x_set_sleep (struct network_context *nctx, const sx126x_sleep_cfgs_t cfg)
 Set the chip in sleep mode. More...
 
sx126x_status_t sx126x_set_standby (struct network_context *nctx, const sx126x_standby_cfg_t cfg)
 Set the chip in stand-by mode. More...
 
sx126x_status_t sx126x_set_trimming_capacitor_values (struct network_context *nctx, const uint8_t trimming_cap_xta, const uint8_t trimming_cap_xtb)
 Configure the internal trimming capacitor values. More...
 
sx126x_status_t sx126x_set_tx (struct network_context *nctx, const uint32_t timeout_in_ms)
 Set the chip in transmission mode. More...
 
sx126x_status_t sx126x_set_tx_cw (struct network_context *nctx)
 Set the chip in Tx continuous wave (RF tone). More...
 
sx126x_status_t sx126x_set_tx_infinite_preamble (struct network_context *nctx)
 Set the chip in Tx infinite preamble (modulated signal). More...
 
sx126x_status_t sx126x_set_tx_params (struct network_context *nctx, const int8_t pwr_in_dbm, const sx126x_ramp_time_t ramp_time)
 Set the parameters for TX power and power amplifier ramp time. More...
 
sx126x_status_t sx126x_set_tx_with_timeout_in_rtc_step (struct network_context *nctx, const uint32_t timeout_in_rtc_step)
 Set the chip in transmission mode. More...
 
sx126x_status_t sx126x_stop_rtc (struct network_context *nctx)
 Stop the RTC and clear the related event. More...
 
sx126x_status_t sx126x_stop_timer_on_preamble (struct network_context *nctx, const bool enable)
 Configure the event on which the Rx timeout is stopped. More...
 
sx126x_status_t sx126x_wakeup (struct network_context *nctx)
 Wake the radio up from sleep mode. More...
 
sx126x_status_t sx126x_write_buffer (struct network_context *nctx, const uint8_t offset, const uint8_t *buffer, const uint8_t size)
 Write data into radio Tx buffer memory space. More...
 
sx126x_status_t sx126x_write_register (struct network_context *nctx, const uint16_t address, const uint8_t *buffer, const uint8_t size)
 Write data into register memory space. More...
 

Detailed Description

SX126x radio driver definition.

Revised BSD License Copyright Semtech Corporation 2020. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file sx126x.h.

Macro Definition Documentation

◆ SX126X_CHIP_MODES_MASK

#define SX126X_CHIP_MODES_MASK   (0x07UL << SX126X_CHIP_MODES_POS)

Definition at line 80 of file sx126x.h.

◆ SX126X_CHIP_MODES_POS

#define SX126X_CHIP_MODES_POS   (4U)

Definition at line 79 of file sx126x.h.

◆ SX126X_CMD_STATUS_MASK

#define SX126X_CMD_STATUS_MASK   (0x07UL << SX126X_CMD_STATUS_POS)

Definition at line 83 of file sx126x.h.

◆ SX126X_CMD_STATUS_POS

#define SX126X_CMD_STATUS_POS   (1U)

Definition at line 82 of file sx126x.h.

◆ SX126X_GFSK_RX_STATUS_ABORT_ERROR_MASK

#define SX126X_GFSK_RX_STATUS_ABORT_ERROR_MASK   (0x01UL << SX126X_GFSK_RX_STATUS_ABORT_ERROR_POS)

Definition at line 92 of file sx126x.h.

◆ SX126X_GFSK_RX_STATUS_ABORT_ERROR_POS

#define SX126X_GFSK_RX_STATUS_ABORT_ERROR_POS   (2U)

Definition at line 91 of file sx126x.h.

◆ SX126X_GFSK_RX_STATUS_ADRS_ERROR_MASK

#define SX126X_GFSK_RX_STATUS_ADRS_ERROR_MASK   (0x01UL << SX126X_GFSK_RX_STATUS_ADRS_ERROR_POS)

Definition at line 101 of file sx126x.h.

◆ SX126X_GFSK_RX_STATUS_ADRS_ERROR_POS

#define SX126X_GFSK_RX_STATUS_ADRS_ERROR_POS   (5U)

Definition at line 100 of file sx126x.h.

◆ SX126X_GFSK_RX_STATUS_CRC_ERROR_MASK

#define SX126X_GFSK_RX_STATUS_CRC_ERROR_MASK   (0x01UL << SX126X_GFSK_RX_STATUS_CRC_ERROR_POS)

Definition at line 98 of file sx126x.h.

◆ SX126X_GFSK_RX_STATUS_CRC_ERROR_POS

#define SX126X_GFSK_RX_STATUS_CRC_ERROR_POS   (4U)

Definition at line 97 of file sx126x.h.

◆ SX126X_GFSK_RX_STATUS_LENGTH_ERROR_MASK

#define SX126X_GFSK_RX_STATUS_LENGTH_ERROR_MASK   (0x01UL << SX126X_GFSK_RX_STATUS_LENGTH_ERROR_POS)

Definition at line 95 of file sx126x.h.

◆ SX126X_GFSK_RX_STATUS_LENGTH_ERROR_POS

#define SX126X_GFSK_RX_STATUS_LENGTH_ERROR_POS   (3U)

Definition at line 94 of file sx126x.h.

◆ SX126X_GFSK_RX_STATUS_PKT_RECEIVED_MASK

#define SX126X_GFSK_RX_STATUS_PKT_RECEIVED_MASK   (0x01UL << SX126X_GFSK_RX_STATUS_PKT_RECEIVED_POS)

Definition at line 89 of file sx126x.h.

◆ SX126X_GFSK_RX_STATUS_PKT_RECEIVED_POS

#define SX126X_GFSK_RX_STATUS_PKT_RECEIVED_POS   (1U)

Definition at line 88 of file sx126x.h.

◆ SX126X_GFSK_RX_STATUS_PKT_SENT_MASK

#define SX126X_GFSK_RX_STATUS_PKT_SENT_MASK   (0x01UL << SX126X_GFSK_RX_STATUS_PKT_SENT_POS)

Definition at line 86 of file sx126x.h.

◆ SX126X_GFSK_RX_STATUS_PKT_SENT_POS

#define SX126X_GFSK_RX_STATUS_PKT_SENT_POS   (0U)

Definition at line 85 of file sx126x.h.

◆ SX126X_MAX_TIMEOUT_IN_MS

#define SX126X_MAX_TIMEOUT_IN_MS   (SX126X_MAX_TIMEOUT_IN_RTC_STEP / 64)

Maximum value for parameter timeout_in_ms in both functions sx126x_set_rx and sx126x_set_tx.

Definition at line 66 of file sx126x.h.

◆ SX126X_MAX_TIMEOUT_IN_RTC_STEP

#define SX126X_MAX_TIMEOUT_IN_RTC_STEP   0x00FFFFFE

Maximum value for parameter timeout_in_rtc_step in both functions sx126x_set_rx_with_timeout_in_rtc_step and sx126x_set_tx_with_timeout_in_rtc_step.

Definition at line 61 of file sx126x.h.

◆ SX126X_RX_CONTINUOUS

#define SX126X_RX_CONTINUOUS   0x00FFFFFF

Timeout parameter in sx126x_set_rx_with_timeout_in_rtc_step to launch a continuous reception.

Definition at line 77 of file sx126x.h.

◆ SX126X_RX_SINGLE_MODE

#define SX126X_RX_SINGLE_MODE   0x00000000

Timeout parameter in sx126x_set_rx_with_timeout_in_rtc_step to set the chip in reception until a reception occurs.

Definition at line 72 of file sx126x.h.

Typedef Documentation

◆ sx126x_cad_exit_modes_t

SX126X LoRa CAD exit modes enumeration definition.

Note
Represents the action to be performed after a CAD is done

◆ sx126x_cad_symbs_t

SX126X LoRa CAD number of symbols enumeration definition.

Note
Represents the number of symbols to be used for a CAD operation

◆ sx126x_cal_mask_t

typedef uint8_t sx126x_cal_mask_t

Definition at line 200 of file sx126x.h.

◆ sx126x_errors_mask_t

typedef uint16_t sx126x_errors_mask_t

Definition at line 552 of file sx126x.h.

◆ sx126x_irq_mask_t

typedef uint16_t sx126x_irq_mask_t

Definition at line 183 of file sx126x.h.

◆ sx126x_standby_cfg_t

typedef uint8_t sx126x_standby_cfg_t

Definition at line 134 of file sx126x.h.

Enumeration Type Documentation

◆ sx126x_cad_exit_modes_e

SX126X LoRa CAD exit modes enumeration definition.

Note
Represents the action to be performed after a CAD is done

Definition at line 434 of file sx126x.h.

◆ sx126x_cad_symbs_e

SX126X LoRa CAD number of symbols enumeration definition.

Note
Represents the number of symbols to be used for a CAD operation

Definition at line 421 of file sx126x.h.

◆ sx126x_cal_mask_e

Calibration settings.

Definition at line 188 of file sx126x.h.

◆ sx126x_chip_modes_e

SX126X chip mode enumeration definition.

Definition at line 454 of file sx126x.h.

◆ sx126x_cmd_status_e

SX126X command status enumeration definition.

Definition at line 467 of file sx126x.h.

◆ sx126x_errors_e

SX126X errors enumeration definition.

Definition at line 541 of file sx126x.h.

◆ sx126x_fallback_modes_e

SX126X fallback modes enumeration definition.

Definition at line 157 of file sx126x.h.

◆ sx126x_gfsk_address_filtering_e

SX126X GFSK address filtering configuration enumeration definition.

Definition at line 350 of file sx126x.h.

◆ sx126x_gfsk_bw_e

SX126X GFSK Rx bandwidth enumeration definition.

Definition at line 252 of file sx126x.h.

◆ sx126x_gfsk_dc_free_e

SX126X GFSK whitening control enumeration definition.

Definition at line 378 of file sx126x.h.

◆ sx126x_gfsk_pkt_len_modes_e

SX126X GFSK packet length enumeration definition.

Enumerator
SX126X_GFSK_PKT_FIX_LEN 

The packet length is known on both sides, no header included.

SX126X_GFSK_PKT_VAR_LEN 

The packet length is variable, header included.

Definition at line 359 of file sx126x.h.

◆ sx126x_gfsk_preamble_detector_e

SX126X GFSK preamble length Rx detection size enumeration definition.

Definition at line 339 of file sx126x.h.

◆ sx126x_gfsk_pulse_shape_e

SX126X GFSK modulation shaping enumeration definition.

Definition at line 241 of file sx126x.h.

◆ sx126x_irq_masks_e

SX126X interrupt masks enumeration definition.

Definition at line 166 of file sx126x.h.

◆ sx126x_lora_bw_e

SX126X LoRa bandwidth enumeration definition.

Definition at line 303 of file sx126x.h.

◆ sx126x_lora_cr_e

SX126X LoRa coding rate enumeration definition.

Definition at line 319 of file sx126x.h.

◆ sx126x_lora_pkt_len_modes_e

SX126X LoRa packet length enumeration definition.

Enumerator
SX126X_LORA_PKT_EXPLICIT 

Header included in the packet.

SX126X_LORA_PKT_IMPLICIT 

Header not included in the packet.

Definition at line 386 of file sx126x.h.

◆ sx126x_lora_sf_e

SX126X LoRa spreading factor enumeration definition.

Definition at line 289 of file sx126x.h.

◆ sx126x_pkt_types_e

SX126X packet types enumeration definition.

Definition at line 219 of file sx126x.h.

◆ sx126x_ramp_time_e

SX126X power amplifier ramp-up timings enumeration definition.

Definition at line 227 of file sx126x.h.

◆ sx126x_reg_mods_e

SX126X power regulator modes enumeration definition.

Definition at line 139 of file sx126x.h.

◆ sx126x_sleep_cfgs_e

SX126X sleep mode configurations definition.

Definition at line 121 of file sx126x.h.

◆ sx126x_standby_cfgs_e

SX126X standby modes enumeration definition.

Definition at line 129 of file sx126x.h.

◆ sx126x_status_e

SX126X APIs return status enumeration definition.

Definition at line 111 of file sx126x.h.

◆ sx126x_tcxo_ctrl_voltages_e

SX126X TCXO control voltages enumeration definition.

Definition at line 205 of file sx126x.h.

◆ sx16x_gfsk_crc_types_e

SX126X GFSK CRC type enumeration definition.

Definition at line 367 of file sx126x.h.

Function Documentation

◆ sx126x_cal()

sx126x_status_t sx126x_cal ( struct network_context nctx,
const sx126x_cal_mask_t  param 
)

Perform the calibration of the requested blocks.

Remarks
This function shall only be called in stand-by RC mode
The chip will return to stand-by RC mode on exit. Potential calibration issues can be read out with sx126x_get_device_errors command.
Parameters
[in]contextChip implementation context.
[in]paramMask holding the blocks to be calibrated
Returns
Operation status

Definition at line 338 of file sx126x.c.

◆ sx126x_cal_img()

sx126x_status_t sx126x_cal_img ( struct network_context nctx,
const uint32_t  freq_in_hz 
)

Perform device operating frequency band image rejection calibration.

Parameters
[in]contextChip implementation context.
[in]freq_in_hzFrequency in Hz used for the image calibration
Returns
Operation status

Definition at line 348 of file sx126x.c.

◆ sx126x_cfg_rx_boosted()

sx126x_status_t sx126x_cfg_rx_boosted ( struct network_context nctx,
const bool  state 
)

Configure the boost mode in reception.

Remarks
This configuration is not kept in the retention memory. Rx boosted mode shall be enabled each time the chip leaves sleep mode.
Parameters
[in]contextChip implementation context.
[in]stateBoost mode activation
Returns
Operation status

Definition at line 1015 of file sx126x.c.

◆ sx126x_cfg_tx_clamp()

sx126x_status_t sx126x_cfg_tx_clamp ( struct network_context nctx)

Configure the Tx PA clamp.

Remarks
Workaround - On the SX1262, during the chip initialization, calling this function optimize the PA clamping threshold. The call must be done after a Power On Reset, or a wake-up from cold Start.(see DS_SX1261-2_V1.2 datasheet chapter 15.2)
Parameters
[in]contextChip implementation context.
Returns
Operation status

Definition at line 1041 of file sx126x.c.

◆ sx126x_clear_device_errors()

sx126x_status_t sx126x_clear_device_errors ( struct network_context nctx)

Clear all active errors.

Parameters
[in]contextChip implementation context.
Returns
Operation status

Definition at line 842 of file sx126x.c.

◆ sx126x_clear_irq_status()

sx126x_status_t sx126x_clear_irq_status ( struct network_context nctx,
const sx126x_irq_mask_t  irq_mask 
)

Clear selected system interrupts.

Parameters
[in]contextChip implementation context.
[in]irq_maskVariable that holds the system interrupt to be cleared
Returns
Operation status
See also
sx126x_get_irq_status

Definition at line 491 of file sx126x.c.

◆ sx126x_convert_freq_in_hz_to_pll_step()

uint32_t sx126x_convert_freq_in_hz_to_pll_step ( uint32_t  freq_in_hz)

Get the number of PLL steps for a given frequency in Hertz.

Parameters
[in]freq_in_hzFrequency in Hertz
Returns
Number of PLL steps

Definition at line 993 of file sx126x.c.

References SX126X_PLL_STEP_SCALED, and SX126X_PLL_STEP_SHIFT_AMOUNT.

◆ sx126x_convert_timeout_in_ms_to_rtc_step()

uint32_t sx126x_convert_timeout_in_ms_to_rtc_step ( uint32_t  timeout_in_ms)

Get the number of RTC steps for a given timeout in millisecond.

Parameters
[in]timeout_in_msTimeout in millisecond
Returns
Number of RTC steps

Definition at line 1007 of file sx126x.c.

References SX126X_RTC_FREQ_IN_HZ.

◆ sx126x_get_and_clear_irq_status()

sx126x_status_t sx126x_get_and_clear_irq_status ( struct network_context nctx,
sx126x_irq_mask_t *  irq 
)

Clears any radio irq status flags that are set and returns the flags that were cleared.

Parameters
[in]contextChip implementation context.
[out]irqPointer to a variable for holding the system interrupt status. Can be NULL.
Returns
Operation status

Definition at line 502 of file sx126x.c.

◆ sx126x_get_device_errors()

sx126x_status_t sx126x_get_device_errors ( struct network_context nctx,
sx126x_errors_mask_t *  errors 
)

Get the list of all active errors.

Parameters
[in]contextChip implementation context.
[out]errorsPointer to a variable to store the error list
Returns
Operation status

Definition at line 825 of file sx126x.c.

◆ sx126x_get_gfsk_bw_param()

sx126x_status_t sx126x_get_gfsk_bw_param ( const uint32_t  bw,
uint8_t *  param 
)

Get the parameter corresponding to a GFSK Rx bandwith immediately above the minimum requested one.

Parameters
[in]bwMinimum required bandwith in Hz
[out]paramPointer to a value to store the parameter
Returns
Operation status

◆ sx126x_get_gfsk_pkt_status()

sx126x_status_t sx126x_get_gfsk_pkt_status ( struct network_context nctx,
sx126x_pkt_status_gfsk_t pkt_status 
)

Get the status of the last GFSK packet received.

Parameters
[in]contextChip implementation context.
[out]pkt_statusPointer to a structure to store the packet status
Returns
Operation status

◆ sx126x_get_gfsk_stats()

sx126x_status_t sx126x_get_gfsk_stats ( struct network_context nctx,
sx126x_stats_gfsk_t stats 
)

Get the statistics about GFSK communication.

Parameters
[in]contextChip implementation context.
[out]statsPointer to a structure to store GFSK-related statistics
Returns
Operation status

◆ sx126x_get_gfsk_time_on_air_in_ms()

uint32_t sx126x_get_gfsk_time_on_air_in_ms ( const sx126x_pkt_params_gfsk_t pkt_p,
const sx126x_mod_params_gfsk_t mod_p 
)

Get the time on air in ms for GFSK transmission.

Parameters
[in]pkt_pPointer to a structure holding the GFSK packet parameters
[in]mod_pPointer to a structure holding the GFSK modulation parameters
Returns
Time-on-air value in ms for GFSK transmission

◆ sx126x_get_gfsk_time_on_air_numerator()

uint32_t sx126x_get_gfsk_time_on_air_numerator ( const sx126x_pkt_params_gfsk_t pkt_p)

Compute the numerator for GFSK time-on-air computation.

Remarks
To get the actual time-on-air in second, this value has to be divided by the GFSK bitrate in bits per second.
Parameters
[in]pkt_pPointer to the structure holding the GFSK packet parameters
Returns
GFSK time-on-air numerator

◆ sx126x_get_irq_status()

sx126x_status_t sx126x_get_irq_status ( struct network_context nctx,
sx126x_irq_mask_t *  irq 
)

Get system interrupt status.

Parameters
[in]contextChip implementation context.
[out]irqPointer to a variable for holding the system interrupt status
Returns
Operation status
See also
sx126x_clear_irq_status

Definition at line 474 of file sx126x.c.

◆ sx126x_get_lora_bw_in_hz()

uint32_t sx126x_get_lora_bw_in_hz ( sx126x_lora_bw_t  bw)

Get the actual value in Hertz of a given LoRa bandwidth.

Parameters
[in]bwLoRa bandwidth parameter
Returns
Actual LoRa bandwidth in Hertz

Definition at line 850 of file sx126x.c.

Referenced by sx126x_get_lora_time_on_air_in_ms().

◆ sx126x_get_lora_pkt_status()

sx126x_status_t sx126x_get_lora_pkt_status ( struct network_context nctx,
sx126x_pkt_status_lora_t pkt_status 
)

Get the status of the last LoRa packet received.

Parameters
[in]contextChip implementation context.
[out]pkt_statusPointer to a structure to store the packet status
Returns
Operation status

Definition at line 755 of file sx126x.c.

◆ sx126x_get_lora_stats()

sx126x_status_t sx126x_get_lora_stats ( struct network_context nctx,
sx126x_stats_lora_t stats 
)

Get the statistics about LoRa communication.

Parameters
[in]contextChip implementation context.
[out]statsPointer to a structure to store LoRa-related statistics
Returns
Operation status

Definition at line 791 of file sx126x.c.

◆ sx126x_get_lora_time_on_air_in_ms()

uint32_t sx126x_get_lora_time_on_air_in_ms ( const sx126x_pkt_params_lora_t pkt_p,
const sx126x_mod_params_lora_t mod_p 
)

Get the time on air in ms for LoRa transmission.

Parameters
[in]pkt_pPointer to a structure holding the LoRa packet parameters
[in]mod_pPointer to a structure holding the LoRa modulation parameters
Returns
Time-on-air value in ms for LoRa transmission

Definition at line 927 of file sx126x.c.

References sx126x_mod_params_lora_s::bw, sx126x_get_lora_bw_in_hz(), and sx126x_get_lora_time_on_air_numerator().

◆ sx126x_get_lora_time_on_air_numerator()

uint32_t sx126x_get_lora_time_on_air_numerator ( const sx126x_pkt_params_lora_t pkt_p,
const sx126x_mod_params_lora_t mod_p 
)

Compute the numerator for LoRa time-on-air computation.

Remarks
To get the actual time-on-air in second, this value has to be divided by the LoRa bandwidth in Hertz.
Parameters
[in]pkt_pPointer to the structure holding the LoRa packet parameters
[in]mod_pPointer to the structure holding the LoRa modulation parameters
Returns
LoRa time-on-air numerator

Definition at line 889 of file sx126x.c.

References sx126x_mod_params_lora_s::cr, sx126x_pkt_params_lora_s::crc_is_on, sx126x_pkt_params_lora_s::header_type, sx126x_mod_params_lora_s::ldro, sx126x_pkt_params_lora_s::pld_len_in_bytes, sx126x_pkt_params_lora_s::preamble_len_in_symb, sx126x_mod_params_lora_s::sf, and SX126X_LORA_PKT_IMPLICIT.

Referenced by sx126x_get_lora_time_on_air_in_ms().

◆ sx126x_get_pkt_type()

sx126x_status_t sx126x_get_pkt_type ( struct network_context nctx,
sx126x_pkt_type_t pkt_type 
)

Get the current packet type.

Parameters
[in]contextChip implementation context.
[out]pkt_typePointer to a variable holding the packet type
Returns
Operation status

Definition at line 574 of file sx126x.c.

◆ sx126x_get_random_numbers()

sx126x_status_t sx126x_get_random_numbers ( struct network_context nctx,
uint32_t *  numbers,
unsigned int  n 
)

Generate one or more 32-bit random numbers.

Remarks
A valid packet type must have been configured with sx126x_set_pkt_type before using this command.
Parameters
[in]contextChip implementation context.
[out]numbersArray where numbers will be stored.
[in]nNumber of desired random numbers.
Returns
Operation status

This code can potentially result in interrupt generation. It is the responsibility of the calling code to disable radio interrupts before calling this function, and re-enable them afterwards if necessary, or be certain that any interrupts generated during this process will not cause undesired side-effects in the software.

Please note that the random numbers produced by the generator do not have a uniform or Gaussian distribution. If uniformity is needed, perform appropriate software post-processing.

Definition at line 936 of file sx126x.c.

◆ sx126x_get_rssi_inst()

sx126x_status_t sx126x_get_rssi_inst ( struct network_context nctx,
int16_t *  rssi_in_dbm 
)

Get the instantaneous RSSI value.

Remarks
This function shall be called when in Rx mode.
Parameters
[in]contextChip implementation context.
[out]rssi_in_dbmPointer to a variable to store the RSSI value in dBm
Returns
Operation status
See also
sx126x_set_rx

Definition at line 774 of file sx126x.c.

◆ sx126x_get_rx_buffer_status()

sx126x_status_t sx126x_get_rx_buffer_status ( struct network_context nctx,
sx126x_rx_buffer_status_t rx_buffer_status 
)

Get the current Rx buffer status for both LoRa and GFSK Rx operations.

This function is used to get the length of the received payload and the start address to be used when reading data from the Rx buffer.

Parameters
[in]contextChip implementation context.
[out]rx_buffer_statusPointer to a structure to store the current status
Returns
Operation status

Definition at line 737 of file sx126x.c.

◆ sx126x_get_status()

sx126x_status_t sx126x_get_status ( struct network_context nctx,
sx126x_chip_status_t radio_status 
)

Get the chip status.

Parameters
[in]contextChip implementation context.
[out]radio_statusPointer to a structure holding the radio status
Returns
Operation status

Definition at line 718 of file sx126x.c.

◆ sx126x_read_buffer()

sx126x_status_t sx126x_read_buffer ( struct network_context nctx,
const uint8_t  offset,
uint8_t *  buffer,
const uint8_t  size 
)

Read data from radio Rx buffer memory space.

Parameters
[in]contextChip implementation context.
[in]offsetStart address in the Rx buffer of the chip
[in]bufferThe buffer of bytes to be filled with content from Rx radio buffer
[in]sizeThe number of bytes to read from the Rx radio buffer
Returns
Operation status
See also
sx126x_write_buffer

Definition at line 437 of file sx126x.c.

◆ sx126x_read_register()

sx126x_status_t sx126x_read_register ( struct network_context nctx,
const uint16_t  address,
uint8_t *  buffer,
const uint8_t  size 
)

Read data from register memory space.

Parameters
[in]contextChip implementation context.
[in]addressThe register memory address to start reading operation
[in]bufferThe buffer of bytes to be filled with data from registers
[in]sizeNumber of bytes to read from memory, starting from address
See also
sx126x_write_register

Definition at line 412 of file sx126x.c.

◆ sx126x_reset()

sx126x_status_t sx126x_reset ( struct network_context nctx)

Perform a hard reset of the chip.

Parameters
[in]contextChip implementation context.
Returns
Operation status

Definition at line 821 of file sx126x.c.

◆ sx126x_reset_stats()

sx126x_status_t sx126x_reset_stats ( struct network_context nctx)

Reset all the statistics for both Lora and GFSK communications.

Parameters
[in]contextChip implementation context.
Returns
Operation status

Definition at line 809 of file sx126x.c.

◆ sx126x_set_buffer_base_address()

sx126x_status_t sx126x_set_buffer_base_address ( struct network_context nctx,
const uint8_t  tx_base_address,
const uint8_t  rx_base_address 
)

Set buffer start addresses for both Tx and Rx operations.

Parameters
[in]contextChip implementation context.
[in]tx_base_addressThe start address used for Tx operations
[in]rx_base_addressThe start address used for Rx operations
Returns
Operation status

Definition at line 675 of file sx126x.c.

◆ sx126x_set_cad()

sx126x_status_t sx126x_set_cad ( struct network_context nctx)

Set the chip in CAD (Channel Activity Detection) mode.

Remarks
The LoRa packet type shall be selected with sx126x_set_pkt_type before this function is called.
The fallback mode is configured with sx126x_set_cad_params.
Parameters
[in]contextChip implementation context.
Returns
Operation status

Definition at line 320 of file sx126x.c.

◆ sx126x_set_cad_params()

sx126x_status_t sx126x_set_cad_params ( struct network_context nctx,
const sx126x_cad_params_t params 
)

Set the parameters for CAD operation.

Remarks
The command sx126x_set_pkt_type must be called prior to this one.
Parameters
[in]contextChip implementation context.
[in]paramsThe structure of CAD configuration
Returns
Operation status

Definition at line 659 of file sx126x.c.

◆ sx126x_set_dio2_as_rf_sw_ctrl()

sx126x_status_t sx126x_set_dio2_as_rf_sw_ctrl ( struct network_context nctx,
const bool  enable 
)

Configure the embedded RF switch control.

Parameters
[in]contextChip implementation context.
[in]enableEnable this feature if set to true
Returns
Operation status

Definition at line 516 of file sx126x.c.

◆ sx126x_set_dio3_as_tcxo_ctrl()

sx126x_status_t sx126x_set_dio3_as_tcxo_ctrl ( struct network_context nctx,
const sx126x_tcxo_ctrl_voltages_t  tcxo_voltage,
const uint32_t  timeout 
)

Configure the embedded TCXO switch control.

Remarks
This function shall only be called in standby RC mode.
The chip will wait for the timeout to happen before starting any operation that requires the TCXO.
Parameters
[in]contextChip implementation context.
[in]tcxo_voltageVoltage used to power the TCXO.
[in]timeoutTime needed for the TCXO to be stable.
Returns
Operation status

Definition at line 526 of file sx126x.c.

◆ sx126x_set_dio_irq_params()

sx126x_status_t sx126x_set_dio_irq_params ( struct network_context nctx,
const uint16_t  irq_mask,
const uint16_t  dio1_mask,
const uint16_t  dio2_mask,
const uint16_t  dio3_mask 
)

Set which interrupt signals are redirected to the dedicated DIO pin.

Remarks
By default, no interrupt signal is redirected.
An interrupt will not occur until it is enabled system-wide, even if it is redirected to a specific DIO.
The DIO pin will remain asserted until all redirected interrupt signals are cleared with a call to sx126x_clear_irq_status.
DIO2 and DIO3 are shared with other features. See sx126x_set_dio2_as_rf_sw_ctrl and sx126x_set_dio3_as_tcxo_ctrl
Parameters
[in]contextChip implementation context.
[in]irq_maskVariable that holds the system interrupt mask
[in]dio1_maskVariable that holds the interrupt mask for dio1
[in]dio2_maskVariable that holds the interrupt mask for dio2
[in]dio3_maskVariable that holds the interrupt mask for dio3
Returns
Operation status
See also
sx126x_clear_irq_status, sx126x_get_irq_status, sx126x_set_dio2_as_rf_sw_ctrl, sx126x_set_dio3_as_tcxo_ctrl

Definition at line 453 of file sx126x.c.

◆ sx126x_set_fs()

sx126x_status_t sx126x_set_fs ( struct network_context nctx)

Set the chip in frequency synthesis mode.

Parameters
[in]contextChip implementation context.
Returns
Operation status

◆ sx126x_set_gfsk_crc_polynomial()

sx126x_status_t sx126x_set_gfsk_crc_polynomial ( struct network_context nctx,
const uint16_t  polynomial 
)

Configure the polynomial used to compute CRC in GFSK packet.

Parameters
[in]contextChip implementation context.
[in]polynomialPolynomial value used to compute the CRC value
Returns
Operation status

◆ sx126x_set_gfsk_crc_seed()

sx126x_status_t sx126x_set_gfsk_crc_seed ( struct network_context nctx,
uint16_t  seed 
)

Configure the seed used to compute CRC in GFSK packet.

Parameters
[in]contextChip implementation context.
[in]seedSeed value used to compute the CRC value
Returns
Operation status

◆ sx126x_set_gfsk_mod_params()

sx126x_status_t sx126x_set_gfsk_mod_params ( struct network_context nctx,
const sx126x_mod_params_gfsk_t params 
)

Set the modulation parameters for GFSK packets.

Remarks
The command sx126x_set_pkt_type must be called prior to this one.
Parameters
[in]contextChip implementation context.
[in]paramsThe structure of GFSK modulation configuration
Returns
Operation status

◆ sx126x_set_gfsk_pkt_params()

sx126x_status_t sx126x_set_gfsk_pkt_params ( struct network_context nctx,
const sx126x_pkt_params_gfsk_t params 
)

Set the packet parameters for GFSK packets.

Remarks
The command sx126x_set_pkt_type must be called prior to this one.
Parameters
[in]contextChip implementation context.
[in]paramsThe structure of GFSK packet configuration
Returns
Operation status

◆ sx126x_set_gfsk_sync_word()

sx126x_status_t sx126x_set_gfsk_sync_word ( struct network_context nctx,
const uint8_t *  sync_word,
const uint8_t  sync_word_len 
)

Configure the sync word used in GFSK packet.

Parameters
[in]contextChip implementation context.
[in]sync_wordBuffer holding the sync word to be configured
[in]sync_word_lenSync word length in byte
Returns
Operation status

◆ sx126x_set_gfsk_whitening_seed()

sx126x_status_t sx126x_set_gfsk_whitening_seed ( struct network_context nctx,
const uint16_t  seed 
)

Configure the whitening seed used in GFSK packet.

Parameters
[in]contextChip implementation context.
[in]seedSeed value used in data whitening
Returns
Operation status

◆ sx126x_set_lora_mod_params()

sx126x_status_t sx126x_set_lora_mod_params ( struct network_context nctx,
const sx126x_mod_params_lora_t params 
)

Set the modulation parameters for LoRa packets.

Remarks
The command sx126x_set_pkt_type must be called prior to this one.
Parameters
[in]contextChip implementation context.
[in]paramsThe structure of LoRa modulation configuration
Returns
Operation status

Definition at line 600 of file sx126x.c.

◆ sx126x_set_lora_pkt_params()

sx126x_status_t sx126x_set_lora_pkt_params ( struct network_context nctx,
const sx126x_pkt_params_lora_t params 
)

Set the packet parameters for LoRa packets.

Remarks
The command sx126x_set_pkt_type must be called prior to this one.
Parameters
[in]contextChip implementation context.
[in]paramsThe structure of LoRa packet configuration
Returns
Operation status

Definition at line 624 of file sx126x.c.

◆ sx126x_set_lora_symb_nb_timeout()

sx126x_status_t sx126x_set_lora_symb_nb_timeout ( struct network_context nctx,
const uint8_t  nb_of_symbs 
)

Definition at line 687 of file sx126x.c.

◆ sx126x_set_lora_sync_word()

sx126x_status_t sx126x_set_lora_sync_word ( struct network_context nctx,
const uint8_t  sync_word 
)

Configure the sync word used in LoRa packet.

Remarks
In the case of a LoRaWAN use case, the two following values are specified:
  • 0x12 for a private LoRaWAN network (default)
  • 0x34 for a public LoRaWAN network
Parameters
[in]contextChip implementation context.
[in]sync_wordSync word to be configured
Returns
Operation status

Definition at line 1023 of file sx126x.c.

◆ sx126x_set_ocp_value()

sx126x_status_t sx126x_set_ocp_value ( struct network_context nctx,
const uint8_t  ocp_in_step_of_2_5_ma 
)

Configure the Over Current Protection (OCP) value.

Remarks
The maximum value that can be configured is 63 (i.e. 157.5 mA)
Parameters
[in]contextChip implementation context.
[in]ocp_in_step_of_2_5_maOCP value given in steps of 2.5 mA
Returns
Operation status

◆ sx126x_set_pa_cfg()

sx126x_status_t sx126x_set_pa_cfg ( struct network_context nctx,
const sx126x_pa_cfg_params_t params 
)

Configure the PA (Power Amplifier)

This command is used to differentiate the SX1261 from the SX1262 / SX1268. When using this command, the user selects the PA to be used by the device as well as its configuration.

Parameters
[in]contextChip implementation context.
[in]paramsPower amplifier configuration parameters
Returns
Operation status

Definition at line 373 of file sx126x.c.

◆ sx126x_set_pkt_type()

sx126x_status_t sx126x_set_pkt_type ( struct network_context nctx,
const sx126x_pkt_type_t  pkt_type 
)

Set the packet type.

Parameters
[in]contextChip implementation context.
[in]pkt_typePacket type to set
Returns
Operation status

Definition at line 564 of file sx126x.c.

◆ sx126x_set_reg_mode()

sx126x_status_t sx126x_set_reg_mode ( struct network_context nctx,
const sx126x_reg_mod_t  mode 
)

Configure the regulator mode to be used.

Remarks
This function shall be called to set the correct regulator mode, depending on the usage of LDO or DC/DC on the PCB implementation.
Parameters
[in]contextChip implementation context.
[in]modeRegulator mode configuration.
Returns
Operation status

Definition at line 328 of file sx126x.c.

◆ sx126x_set_rf_freq()

sx126x_status_t sx126x_set_rf_freq ( struct network_context nctx,
const uint32_t  freq_in_hz 
)

Set the RF frequency for future radio operations.

Remarks
This commands shall be called only after a packet type is selected.
Parameters
[in]contextChip implementation context.
[in]freq_in_hzThe frequency in Hz to set for radio operations
Returns
Operation status

Definition at line 545 of file sx126x.c.

◆ sx126x_set_rf_freq_in_pll_steps()

sx126x_status_t sx126x_set_rf_freq_in_pll_steps ( struct network_context nctx,
const uint32_t  freq 
)

Set the RF frequency for future radio operations - parameter in PLL steps.

Remarks
This commands shall be called only after a packet type is selected.
Parameters
[in]contextChip implementation context.
[in]freqThe frequency in PLL steps to set for radio operations
Returns
Operation status

Definition at line 551 of file sx126x.c.

◆ sx126x_set_rx()

sx126x_status_t sx126x_set_rx ( struct network_context nctx,
const uint32_t  timeout_in_ms 
)

Set the chip in reception mode.

Remarks
The packet type shall be configured with sx126x_set_pkt_type before using this command.
By default, the chip returns automatically to standby RC mode as soon as a packet is received or if no packet has been received before the timeout. This behavior can be altered by sx126x_set_rx_tx_fallback_mode.
The timeout argument can have the following special values:
Special values Meaning
SX126X_RX_SINGLE_MODE Single: the chip stays in RX mode until a reception occurs, then switch to standby RC
Parameters
[in]contextChip implementation context.
[in]timeout_in_msThe timeout configuration in millisecond for Rx operation
Returns
Operation status

Definition at line 280 of file sx126x.c.

◆ sx126x_set_rx_duty_cycle()

sx126x_status_t sx126x_set_rx_duty_cycle ( struct network_context nctx,
const uint32_t  rx_time_in_ms,
const uint32_t  sleep_time_in_ms 
)

Set the chip in reception mode with duty cycling.

Parameters
[in]contextChip implementation context.
[in]rx_time_in_msThe timeout of Rx period - in millisecond
[in]sleep_time_in_msThe length of sleep period - in millisecond
Returns
Operation status

◆ sx126x_set_rx_duty_cycle_with_timings_in_rtc_step()

sx126x_status_t sx126x_set_rx_duty_cycle_with_timings_in_rtc_step ( struct network_context nctx,
const uint32_t  rx_time_in_rtc_step,
const uint32_t  sleep_time_in_rtc_step 
)

Set the chip in reception mode with duty cycling.

Remarks
The Rx mode duration is defined by: $ rx\_duration\_ms = rx_time \times \frac{1}{64} $
The sleep mode duration is defined by: $ sleep\_duration\_ms = sleep_time \times \frac{1}{64} $
Maximal timeout value is 0xFFFFFF (i.e. 511 seconds).
Parameters
[in]contextChip implementation context.
[in]rx_timeThe timeout of Rx period
[in]sleep_timeThe length of sleep period
Returns
Operation status

Definition at line 302 of file sx126x.c.

◆ sx126x_set_rx_tx_fallback_mode()

sx126x_status_t sx126x_set_rx_tx_fallback_mode ( struct network_context nctx,
const sx126x_fallback_modes_t  fallback_mode 
)

Set chip mode to be used after successful transmission or reception.

Remarks
This setting is not taken into account during Rx Duty Cycle mode or Auto TxRx.
Parameters
[in]contextChip implementation context.
[in]fallback_modeSelected fallback mode
Returns
Operation status

Definition at line 386 of file sx126x.c.

◆ sx126x_set_rx_with_timeout_in_rtc_step()

sx126x_status_t sx126x_set_rx_with_timeout_in_rtc_step ( struct network_context nctx,
const uint32_t  timeout_in_rtc_step 
)

Set the chip in reception mode.

Remarks
The packet type shall be configured with sx126x_set_pkt_type before using this command.
By default, the chip returns automatically to standby RC mode as soon as a packet is received or if no packet has been received before the timeout. This behavior can be altered by sx126x_set_rx_tx_fallback_mode.
The timeout duration is obtained by: $ timeout\_duration\_ms = timeout_in_rtc_step \times \frac{1}{64} $
Maximal timeout value is SX126X_MAX_TIMEOUT_IN_RTC_STEP (i.e. 262 143 ms).
The timeout argument can have the following special values:
Special values Meaning
SX126X_RX_SINGLE_MODE Single: the chip stays in RX mode until a reception occurs, then switch to standby RC
SX126X_RX_CONTINUOUS Continuous: the chip stays in RX mode even after reception of a packet
Parameters
[in]contextChip implementation context.
[in]timeout_in_rtc_stepThe timeout configuration for Rx operation
Returns
Operation status

Definition at line 290 of file sx126x.c.

◆ sx126x_set_sleep()

sx126x_status_t sx126x_set_sleep ( struct network_context nctx,
const sx126x_sleep_cfgs_t  cfg 
)

Set the chip in sleep mode.

Parameters
[in]contextChip implementation context.
[in]cfgSleep mode configuration
Returns
Operation status

◆ sx126x_set_standby()

sx126x_status_t sx126x_set_standby ( struct network_context nctx,
const sx126x_standby_cfg_t  cfg 
)

Set the chip in stand-by mode.

Parameters
[in]contextChip implementation context.
[in]cfgStand-by mode configuration
Returns
Operation status

Definition at line 248 of file sx126x.c.

◆ sx126x_set_trimming_capacitor_values()

sx126x_status_t sx126x_set_trimming_capacitor_values ( struct network_context nctx,
const uint8_t  trimming_cap_xta,
const uint8_t  trimming_cap_xtb 
)

Configure the internal trimming capacitor values.

Remarks
The device is fitted with internal programmable capacitors connected independently to the pins XTA and XTB of the device. Each capacitor can be controlled independently in steps of 0.47 pF added to the minimal value 11.3pF.
Parameters
[in]contextChip implementation context.
[in]trimming_cap_xtaValue for the trimming capacitor connected to XTA pin
[in]trimming_cap_xtbValue for the trimming capacitor connected to XTB pin
Returns
Operation status

◆ sx126x_set_tx()

sx126x_status_t sx126x_set_tx ( struct network_context nctx,
const uint32_t  timeout_in_ms 
)

Set the chip in transmission mode.

Remarks
The packet type shall be configured with sx126x_set_pkt_type before using this command.
By default, the chip returns automatically to standby RC mode as soon as the packet is sent or if the packet has not been completely transmitted before the timeout. This behavior can be altered by sx126x_set_rx_tx_fallback_mode.
If the timeout argument is 0, then no timeout is used.
Parameters
[in]contextChip implementation context.
[in]timeout_in_msThe timeout configuration in millisecond for Tx operation
Returns
Operation status

Definition at line 258 of file sx126x.c.

◆ sx126x_set_tx_cw()

sx126x_status_t sx126x_set_tx_cw ( struct network_context nctx)

Set the chip in Tx continuous wave (RF tone).

Remarks
The packet type shall be configured with sx126x_set_pkt_type before using this command.
Parameters
[in]contextChip implementation context.
Returns
Operation status

◆ sx126x_set_tx_infinite_preamble()

sx126x_status_t sx126x_set_tx_infinite_preamble ( struct network_context nctx)

Set the chip in Tx infinite preamble (modulated signal).

Remarks
The packet type shall be configured with sx126x_set_pkt_type before using this command.
Parameters
[in]contextChip implementation context.
Returns
Operation status

◆ sx126x_set_tx_params()

sx126x_status_t sx126x_set_tx_params ( struct network_context nctx,
const int8_t  pwr_in_dbm,
const sx126x_ramp_time_t  ramp_time 
)

Set the parameters for TX power and power amplifier ramp time.

Parameters
[in]contextChip implementation context.
[in]pwr_in_dbmThe Tx output power in dBm
[in]ramp_timeThe ramping time configuration for the PA
Returns
Operation status

Definition at line 587 of file sx126x.c.

◆ sx126x_set_tx_with_timeout_in_rtc_step()

sx126x_status_t sx126x_set_tx_with_timeout_in_rtc_step ( struct network_context nctx,
const uint32_t  timeout_in_rtc_step 
)

Set the chip in transmission mode.

Remarks
The packet type shall be configured with sx126x_set_pkt_type before using this command.
By default, the chip returns automatically to standby RC mode as soon as the packet is sent or if the packet has not been completely transmitted before the timeout. This behavior can be altered by sx126x_set_rx_tx_fallback_mode.
The timeout duration can be computed with the formula: $ timeout\_duration\_ms = timeout_in_rtc_step \times * \frac{1}{64} $
Maximal value is SX126X_MAX_TIMEOUT_IN_RTC_STEP (i.e. 262 143 ms)
If the timeout argument is 0, then no timeout is used.
Parameters
[in]contextChip implementation context.
[in]timeout_in_rtc_stepThe timeout configuration for Tx operation
Returns
Operation status

Definition at line 268 of file sx126x.c.

◆ sx126x_stop_rtc()

sx126x_status_t sx126x_stop_rtc ( struct network_context nctx)

Stop the RTC and clear the related event.

Remarks
Workaround - It is advised to call this function after ANY reception with timeout active sequence, which stop the RTC and clear the timeout event, if any (see DS_SX1261-2_V1.2 datasheet chapter 15.4)
Parameters
[in]contextChip implementation context.
Returns
Operation status

◆ sx126x_stop_timer_on_preamble()

sx126x_status_t sx126x_stop_timer_on_preamble ( struct network_context nctx,
const bool  enable 
)

Configure the event on which the Rx timeout is stopped.

Remarks
The two options are:
  • Syncword / Header detection (default)
  • Preamble detection
Parameters
[in]contextChip implementation context.
[in]enableIf true, the timer stops on Syncword / Header detection.
Returns
Operation status

◆ sx126x_wakeup()

sx126x_status_t sx126x_wakeup ( struct network_context nctx)

Wake the radio up from sleep mode.

Parameters
[in]contextChip implementation context.
Returns
Operation status

◆ sx126x_write_buffer()

sx126x_status_t sx126x_write_buffer ( struct network_context nctx,
const uint8_t  offset,
const uint8_t *  buffer,
const uint8_t  size 
)

Write data into radio Tx buffer memory space.

Parameters
[in]contextChip implementation context.
[in]offsetStart address in the Tx buffer of the chip
[in]bufferThe buffer of bytes to write into radio buffer
[in]sizeThe number of bytes to write into Tx radio buffer
Returns
Operation status
See also
sx126x_read_buffer

Definition at line 426 of file sx126x.c.

◆ sx126x_write_register()

sx126x_status_t sx126x_write_register ( struct network_context nctx,
const uint16_t  address,
const uint8_t *  buffer,
const uint8_t  size 
)

Write data into register memory space.

Parameters
[in]contextChip implementation context.
[in]addressThe register memory address to start writing operation
[in]bufferThe buffer of bytes to write into memory.
[in]sizeNumber of bytes to write into memory, starting from address
See also
sx126x_read_register

Definition at line 400 of file sx126x.c.