SingingCat 0
application
|
SX126x radio driver implementation. More...
Go to the source code of this file.
Data Structures | |
struct | gfsk_bw_t |
Macros | |
#define | SX126X_PLL_STEP_SCALED (SX126X_XTAL_FREQ >> (25 - SX126X_PLL_STEP_SHIFT_AMOUNT)) |
PLL step - scaled with SX126X_PLL_STEP_SHIFT_AMOUNT. More... | |
#define | SX126X_PLL_STEP_SHIFT_AMOUNT (14) |
Scaling factor used to perform fixed-point operations. More... | |
#define | SX126X_RTC_FREQ_IN_HZ 64000UL |
Internal frequency of the radio. More... | |
#define | SX126X_XTAL_FREQ 32000000UL |
Internal frequency of the radio. More... | |
Typedefs | |
typedef enum sx126x_commands_size_e | sx126x_commands_size_t |
typedef enum sx126x_commands_e | sx126x_commands_t |
Enumerations | |
enum | sx126x_commands_e { SX126X_SET_SLEEP = 0x84 , SX126X_SET_STANDBY = 0x80 , SX126X_SET_FS = 0xC1 , SX126X_SET_TX = 0x83 , SX126X_SET_RX = 0x82 , SX126X_SET_STOP_TIMER_ON_PREAMBLE = 0x9F , SX126X_SET_RX_DUTY_CYCLE = 0x94 , SX126X_SET_CAD = 0xC5 , SX126X_SET_TX_CONTINUOUS_WAVE = 0xD1 , SX126X_SET_TX_INFINITE_PREAMBLE = 0xD2 , SX126X_SET_REGULATOR_MODE = 0x96 , SX126X_CALIBRATE = 0x89 , SX126X_CALIBRATE_IMAGE = 0x98 , SX126X_SET_PA_CFG = 0x95 , SX126X_SET_RX_TX_FALLBACK_MODE = 0x93 , SX126X_WRITE_REGISTER = 0x0D , SX126X_READ_REGISTER = 0x1D , SX126X_WRITE_BUFFER = 0x0E , SX126X_READ_BUFFER = 0x1E , SX126X_SET_DIO_IRQ_PARAMS = 0x08 , SX126X_GET_IRQ_STATUS = 0x12 , SX126X_CLR_IRQ_STATUS = 0x02 , SX126X_SET_DIO2_AS_RF_SWITCH_CTRL = 0x9D , SX126X_SET_DIO3_AS_TCXO_CTRL = 0x97 , SX126X_SET_RF_FREQUENCY = 0x86 , SX126X_SET_PKT_TYPE = 0x8A , SX126X_GET_PKT_TYPE = 0x11 , SX126X_SET_TX_PARAMS = 0x8E , SX126X_SET_MODULATION_PARAMS = 0x8B , SX126X_SET_PKT_PARAMS = 0x8C , SX126X_SET_CAD_PARAMS = 0x88 , SX126X_SET_BUFFER_BASE_ADDRESS = 0x8F , SX126X_SET_LORA_SYMB_NUM_TIMEOUT = 0xA0 , SX126X_GET_STATUS = 0xC0 , SX126X_GET_RX_BUFFER_STATUS = 0x13 , SX126X_GET_PKT_STATUS = 0x14 , SX126X_GET_RSSI_INST = 0x15 , SX126X_GET_STATS = 0x10 , SX126X_RESET_STATS = 0x00 , SX126X_GET_DEVICE_ERRORS = 0x17 , SX126X_CLR_DEVICE_ERRORS = 0x07 } |
enum | sx126x_commands_size_e { SX126X_SIZE_SET_SLEEP = 2 , SX126X_SIZE_SET_STANDBY = 2 , SX126X_SIZE_SET_FS = 1 , SX126X_SIZE_SET_TX = 4 , SX126X_SIZE_SET_RX = 4 , SX126X_SIZE_SET_STOP_TIMER_ON_PREAMBLE = 2 , SX126X_SIZE_SET_RX_DUTY_CYCLE = 7 , SX126X_SIZE_SET_CAD = 1 , SX126X_SIZE_SET_TX_CONTINUOUS_WAVE = 1 , SX126X_SIZE_SET_TX_INFINITE_PREAMBLE = 1 , SX126X_SIZE_SET_REGULATOR_MODE = 2 , SX126X_SIZE_CALIBRATE = 2 , SX126X_SIZE_CALIBRATE_IMAGE = 3 , SX126X_SIZE_SET_PA_CFG = 5 , SX126X_SIZE_SET_RX_TX_FALLBACK_MODE = 2 , SX126X_SIZE_WRITE_REGISTER = 3 , SX126X_SIZE_READ_REGISTER = 4 , SX126X_SIZE_WRITE_BUFFER = 2 , SX126X_SIZE_READ_BUFFER = 3 , SX126X_SIZE_SET_DIO_IRQ_PARAMS = 9 , SX126X_SIZE_GET_IRQ_STATUS = 2 , SX126X_SIZE_CLR_IRQ_STATUS = 3 , SX126X_SIZE_SET_DIO2_AS_RF_SWITCH_CTRL = 2 , SX126X_SIZE_SET_DIO3_AS_TCXO_CTRL = 5 , SX126X_SIZE_SET_RF_FREQUENCY = 5 , SX126X_SIZE_SET_PKT_TYPE = 2 , SX126X_SIZE_GET_PKT_TYPE = 3 , SX126X_SIZE_SET_TX_PARAMS = 3 , SX126X_SIZE_SET_MODULATION_PARAMS_GFSK = 9 , SX126X_SIZE_SET_MODULATION_PARAMS_LORA = 5 , SX126X_SIZE_SET_PKT_PARAMS_GFSK = 10 , SX126X_SIZE_SET_PKT_PARAMS_LORA = 7 , SX126X_SIZE_SET_CAD_PARAMS = 8 , SX126X_SIZE_SET_BUFFER_BASE_ADDRESS = 3 , SX126X_SIZE_SET_LORA_SYMB_NUM_TIMEOUT = 2 , SX126X_SIZE_GET_STATUS = 1 , SX126X_SIZE_GET_RX_BUFFER_STATUS = 2 , SX126X_SIZE_GET_PKT_STATUS = 2 , SX126X_SIZE_GET_RSSI_INST = 2 , SX126X_SIZE_GET_STATS = 2 , SX126X_SIZE_RESET_STATS = 7 , SX126X_SIZE_GET_DEVICE_ERRORS = 2 , SX126X_SIZE_CLR_DEVICE_ERRORS = 3 , SX126X_SIZE_MAX_BUFFER = 255 , SX126X_SIZE_DUMMY_BYTE = 1 } |
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_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_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_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_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_standby (struct network_context *nctx, const sx126x_standby_cfg_t cfg) |
Set the chip in stand-by mode. 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_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_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... | |
SX126x radio driver implementation.
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.c.
#define SX126X_PLL_STEP_SCALED (SX126X_XTAL_FREQ >> (25 - SX126X_PLL_STEP_SHIFT_AMOUNT)) |
#define SX126X_PLL_STEP_SHIFT_AMOUNT (14) |
#define SX126X_RTC_FREQ_IN_HZ 64000UL |
#define SX126X_XTAL_FREQ 32000000UL |
typedef enum sx126x_commands_size_e sx126x_commands_size_t |
Commands Interface buffer sizes
typedef enum sx126x_commands_e sx126x_commands_t |
Commands Interface
enum sx126x_commands_e |
sx126x_status_t sx126x_cal | ( | struct network_context * | nctx, |
const sx126x_cal_mask_t | param | ||
) |
Perform the calibration of the requested blocks.
[in] | context | Chip implementation context. |
[in] | param | Mask holding the blocks to be calibrated |
sx126x_status_t sx126x_cal_img | ( | struct network_context * | nctx, |
const uint32_t | freq_in_hz | ||
) |
sx126x_status_t sx126x_cfg_rx_boosted | ( | struct network_context * | nctx, |
const bool | state | ||
) |
Configure the boost mode in reception.
[in] | context | Chip implementation context. |
[in] | state | Boost mode activation |
sx126x_status_t sx126x_cfg_tx_clamp | ( | struct network_context * | nctx | ) |
Configure the Tx PA clamp.
[in] | context | Chip implementation context. |
sx126x_status_t sx126x_clear_device_errors | ( | struct network_context * | nctx | ) |
sx126x_status_t sx126x_clear_irq_status | ( | struct network_context * | nctx, |
const sx126x_irq_mask_t | irq_mask | ||
) |
Clear selected system interrupts.
[in] | context | Chip implementation context. |
[in] | irq_mask | Variable that holds the system interrupt to be cleared |
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.
[in] | freq_in_hz | Frequency in Hertz |
Definition at line 993 of file sx126x.c.
References SX126X_PLL_STEP_SCALED, and SX126X_PLL_STEP_SHIFT_AMOUNT.
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.
[in] | timeout_in_ms | Timeout in millisecond |
Definition at line 1007 of file sx126x.c.
References SX126X_RTC_FREQ_IN_HZ.
sx126x_status_t sx126x_get_and_clear_irq_status | ( | struct network_context * | nctx, |
sx126x_irq_mask_t * | irq | ||
) |
sx126x_status_t sx126x_get_device_errors | ( | struct network_context * | nctx, |
sx126x_errors_mask_t * | errors | ||
) |
sx126x_status_t sx126x_get_irq_status | ( | struct network_context * | nctx, |
sx126x_irq_mask_t * | irq | ||
) |
Get system interrupt status.
[in] | context | Chip implementation context. |
[out] | irq | Pointer to a variable for holding the system interrupt status |
uint32_t sx126x_get_lora_bw_in_hz | ( | sx126x_lora_bw_t | bw | ) |
Get the actual value in Hertz of a given LoRa bandwidth.
[in] | bw | LoRa bandwidth parameter |
Definition at line 850 of file sx126x.c.
Referenced by sx126x_get_lora_time_on_air_in_ms().
sx126x_status_t sx126x_get_lora_pkt_status | ( | struct network_context * | nctx, |
sx126x_pkt_status_lora_t * | pkt_status | ||
) |
sx126x_status_t sx126x_get_lora_stats | ( | struct network_context * | nctx, |
sx126x_stats_lora_t * | stats | ||
) |
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.
[in] | pkt_p | Pointer to a structure holding the LoRa packet parameters |
[in] | mod_p | Pointer to a structure holding the LoRa modulation parameters |
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().
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.
[in] | pkt_p | Pointer to the structure holding the LoRa packet parameters |
[in] | mod_p | Pointer to the structure holding the LoRa modulation parameters |
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_status_t sx126x_get_pkt_type | ( | struct network_context * | nctx, |
sx126x_pkt_type_t * | pkt_type | ||
) |
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.
[in] | context | Chip implementation context. |
[out] | numbers | Array where numbers will be stored. |
[in] | n | Number of desired random numbers. |
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.
sx126x_status_t sx126x_get_rssi_inst | ( | struct network_context * | nctx, |
int16_t * | rssi_in_dbm | ||
) |
Get the instantaneous RSSI value.
[in] | context | Chip implementation context. |
[out] | rssi_in_dbm | Pointer to a variable to store the RSSI value in dBm |
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.
[in] | context | Chip implementation context. |
[out] | rx_buffer_status | Pointer to a structure to store the current status |
sx126x_status_t sx126x_get_status | ( | struct network_context * | nctx, |
sx126x_chip_status_t * | radio_status | ||
) |
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.
[in] | context | Chip implementation context. |
[in] | offset | Start address in the Rx buffer of the chip |
[in] | buffer | The buffer of bytes to be filled with content from Rx radio buffer |
[in] | size | The number of bytes to read from the Rx radio buffer |
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.
[in] | context | Chip implementation context. |
[in] | address | The register memory address to start reading operation |
[in] | buffer | The buffer of bytes to be filled with data from registers |
[in] | size | Number of bytes to read from memory, starting from address |
sx126x_status_t sx126x_reset | ( | struct network_context * | nctx | ) |
sx126x_status_t sx126x_reset_stats | ( | struct network_context * | nctx | ) |
sx126x_status_t sx126x_set_buffer_base_address | ( | struct network_context * | nctx, |
const uint8_t | tx_base_address, | ||
const uint8_t | rx_base_address | ||
) |
sx126x_status_t sx126x_set_cad | ( | struct network_context * | nctx | ) |
Set the chip in CAD (Channel Activity Detection) mode.
[in] | context | Chip implementation context. |
sx126x_status_t sx126x_set_cad_params | ( | struct network_context * | nctx, |
const sx126x_cad_params_t * | params | ||
) |
Set the parameters for CAD operation.
[in] | context | Chip implementation context. |
[in] | params | The structure of CAD configuration |
sx126x_status_t sx126x_set_dio2_as_rf_sw_ctrl | ( | struct network_context * | nctx, |
const bool | enable | ||
) |
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.
[in] | context | Chip implementation context. |
[in] | tcxo_voltage | Voltage used to power the TCXO. |
[in] | timeout | Time needed for the TCXO to be stable. |
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.
[in] | context | Chip implementation context. |
[in] | irq_mask | Variable that holds the system interrupt mask |
[in] | dio1_mask | Variable that holds the interrupt mask for dio1 |
[in] | dio2_mask | Variable that holds the interrupt mask for dio2 |
[in] | dio3_mask | Variable that holds the interrupt mask for dio3 |
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.
[in] | context | Chip implementation context. |
[in] | params | The structure of LoRa modulation configuration |
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.
[in] | context | Chip implementation context. |
[in] | params | The structure of LoRa packet configuration |
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.
[in] | context | Chip implementation context. |
[in] | sync_word | Sync word to be configured |
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.
[in] | context | Chip implementation context. |
[in] | params | Power amplifier configuration parameters |
sx126x_status_t sx126x_set_pkt_type | ( | struct network_context * | nctx, |
const sx126x_pkt_type_t | pkt_type | ||
) |
sx126x_status_t sx126x_set_reg_mode | ( | struct network_context * | nctx, |
const sx126x_reg_mod_t | mode | ||
) |
Configure the regulator mode to be used.
[in] | context | Chip implementation context. |
[in] | mode | Regulator mode configuration. |
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.
[in] | context | Chip implementation context. |
[in] | freq_in_hz | The frequency in Hz to set for radio operations |
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.
[in] | context | Chip implementation context. |
[in] | freq | The frequency in PLL steps to set for radio operations |
sx126x_status_t sx126x_set_rx | ( | struct network_context * | nctx, |
const uint32_t | timeout_in_ms | ||
) |
Set the chip in reception mode.
Special values | Meaning |
---|---|
SX126X_RX_SINGLE_MODE | Single: the chip stays in RX mode until a reception occurs, then switch to standby RC |
[in] | context | Chip implementation context. |
[in] | timeout_in_ms | The timeout configuration in millisecond for Rx operation |
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.
[in] | context | Chip implementation context. |
[in] | rx_time | The timeout of Rx period |
[in] | sleep_time | The length of sleep period |
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.
[in] | context | Chip implementation context. |
[in] | fallback_mode | Selected fallback mode |
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.
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 |
[in] | context | Chip implementation context. |
[in] | timeout_in_rtc_step | The timeout configuration for Rx operation |
sx126x_status_t sx126x_set_standby | ( | struct network_context * | nctx, |
const sx126x_standby_cfg_t | cfg | ||
) |
sx126x_status_t sx126x_set_tx | ( | struct network_context * | nctx, |
const uint32_t | timeout_in_ms | ||
) |
Set the chip in transmission mode.
[in] | context | Chip implementation context. |
[in] | timeout_in_ms | The timeout configuration in millisecond for Tx operation |
sx126x_status_t sx126x_set_tx_params | ( | struct network_context * | nctx, |
const int8_t | pwr_in_dbm, | ||
const sx126x_ramp_time_t | ramp_time | ||
) |
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.
[in] | context | Chip implementation context. |
[in] | timeout_in_rtc_step | The timeout configuration for Tx operation |
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.
[in] | context | Chip implementation context. |
[in] | offset | Start address in the Tx buffer of the chip |
[in] | buffer | The buffer of bytes to write into radio buffer |
[in] | size | The number of bytes to write into Tx radio buffer |
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.
[in] | context | Chip implementation context. |
[in] | address | The register memory address to start writing operation |
[in] | buffer | The buffer of bytes to write into memory. |
[in] | size | Number of bytes to write into memory, starting from address |