LibDriver SX1262
Loading...
Searching...
No Matches
driver_sx1262.h
Go to the documentation of this file.
1
36
37#ifndef DRIVER_SX1262_H
38#define DRIVER_SX1262_H
39
40#include <stdio.h>
41#include <stdint.h>
42#include <string.h>
43
44#ifdef __cplusplus
45extern "C"{
46#endif
47
53
58
62typedef enum
63{
67
76
85
94
108
125
135
150
160
175
187
215
230
247
258
270
280
291
303
312
321
333
345
360
375
379typedef struct sx1262_handle_s
380{
381 uint8_t (*reset_gpio_init)(void);
382 uint8_t (*reset_gpio_deinit)(void);
383 uint8_t (*reset_gpio_write)(uint8_t value);
384 uint8_t (*busy_gpio_init)(void);
385 uint8_t (*busy_gpio_deinit)(void);
386 uint8_t (*busy_gpio_read)(uint8_t *value);
387 uint8_t (*spi_init)(void);
388 uint8_t (*spi_deinit)(void);
389 uint8_t (*spi_write_read)(uint8_t *in_buf, uint32_t in_len,
390 uint8_t *out_buf, uint32_t out_len);
391 void (*delay_ms)(uint32_t ms);
392 void (*debug_print)(const char *const fmt, ...);
393 void (*receive_callback)(uint16_t type,
394 uint8_t *buf, uint16_t len);
395 uint8_t inited;
396 uint8_t tx_done;
397 uint8_t cad_done;
398 uint8_t cad_detected;
399 uint8_t crc_error;
400 uint8_t timeout;
401 uint8_t buf[384];
402 uint8_t receive_buf[256];
404
420
424
431
438#define DRIVER_SX1262_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
439
446#define DRIVER_SX1262_LINK_SPI_INIT(HANDLE, FUC) (HANDLE)->spi_init = FUC
447
454#define DRIVER_SX1262_LINK_SPI_DEINIT(HANDLE, FUC) (HANDLE)->spi_deinit = FUC
455
462#define DRIVER_SX1262_LINK_SPI_WRITE_READ(HANDLE, FUC) (HANDLE)->spi_write_read = FUC
463
470#define DRIVER_SX1262_LINK_RESET_GPIO_INIT(HANDLE, FUC) (HANDLE)->reset_gpio_init = FUC
471
478#define DRIVER_SX1262_LINK_RESET_GPIO_DEINIT(HANDLE, FUC) (HANDLE)->reset_gpio_deinit = FUC
479
486#define DRIVER_SX1262_LINK_RESET_GPIO_WRITE(HANDLE, FUC) (HANDLE)->reset_gpio_write = FUC
487
494#define DRIVER_SX1262_LINK_BUSY_GPIO_INIT(HANDLE, FUC) (HANDLE)->busy_gpio_init = FUC
495
502#define DRIVER_SX1262_LINK_BUSY_GPIO_DEINIT(HANDLE, FUC) (HANDLE)->busy_gpio_deinit = FUC
503
510#define DRIVER_SX1262_LINK_BUSY_GPIO_READ(HANDLE, FUC) (HANDLE)->busy_gpio_read = FUC
511
518#define DRIVER_SX1262_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
519
526#define DRIVER_SX1262_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
527
534#define DRIVER_SX1262_LINK_RECEIVE_CALLBACK(HANDLE, FUC) (HANDLE)->receive_callback = FUC
535
539
546
555uint8_t sx1262_info(sx1262_info_t *info);
556
567uint8_t sx1262_irq_handler(sx1262_handle_t *handle);
568
582uint8_t sx1262_init(sx1262_handle_t *handle);
583
598uint8_t sx1262_deinit(sx1262_handle_t *handle);
599
623 uint16_t preamble_length, sx1262_lora_header_t header_type,
624 sx1262_lora_crc_type_t crc_type, sx1262_bool_t invert_iq_enable,
625 uint8_t *buf, uint16_t len, uint32_t us);
626
640uint8_t sx1262_lora_cad(sx1262_handle_t *handle, sx1262_bool_t *enable);
641
654uint8_t sx1262_single_receive(sx1262_handle_t *handle, double us);
655
668
683uint8_t sx1262_write_register(sx1262_handle_t *handle, uint16_t reg, uint8_t *buf, uint16_t len);
684
699uint8_t sx1262_read_register(sx1262_handle_t *handle, uint16_t reg, uint8_t *buf, uint16_t len);
700
715uint8_t sx1262_write_buffer(sx1262_handle_t *handle, uint8_t offset, uint8_t *buf, uint16_t len);
716
731uint8_t sx1262_read_buffer(sx1262_handle_t *handle, uint8_t offset, uint8_t *buf, uint16_t len);
732
744
758uint8_t sx1262_set_sleep(sx1262_handle_t *handle, sx1262_start_mode_t mode, sx1262_bool_t rtc_wake_up_enable);
759
773
786
799uint8_t sx1262_set_tx(sx1262_handle_t *handle, uint32_t timeout);
800
814uint8_t sx1262_set_rx(sx1262_handle_t *handle, uint32_t timeout);
815
827uint8_t sx1262_timeout_convert_to_register(sx1262_handle_t *handle, double us, uint32_t *reg);
828
840uint8_t sx1262_timeout_convert_to_data(sx1262_handle_t *handle, uint32_t reg, double *us);
841
855
869uint8_t sx1262_set_rx_duty_cycle(sx1262_handle_t *handle, uint32_t rx_period, uint32_t sleep_period);
870
882uint8_t sx1262_set_cad(sx1262_handle_t *handle);
883
896
909
923
936uint8_t sx1262_set_calibration(sx1262_handle_t *handle, uint8_t settings);
937
951uint8_t sx1262_set_calibration_image(sx1262_handle_t *handle, uint8_t freq1, uint8_t freq2);
952
966uint8_t sx1262_set_pa_config(sx1262_handle_t *handle, uint8_t pa_duty_cycle, uint8_t hp_max);
967
981
997uint8_t sx1262_set_dio_irq_params(sx1262_handle_t *handle, uint16_t irq_mask, uint16_t dio1_mask,
998 uint16_t dio2_mask, uint16_t dio3_mask);
999
1012uint8_t sx1262_get_irq_status(sx1262_handle_t *handle, uint16_t *status);
1013
1026uint8_t sx1262_clear_irq_status(sx1262_handle_t *handle, uint16_t clear_irq_param);
1027
1041
1055uint8_t sx1262_set_dio3_as_tcxo_ctrl(sx1262_handle_t *handle, sx1262_tcxo_voltage_t voltage, uint32_t delay);
1056
1068uint8_t sx1262_frequency_convert_to_register(sx1262_handle_t *handle, uint32_t freq, uint32_t *reg);
1069
1081uint8_t sx1262_frequency_convert_to_data(sx1262_handle_t *handle, uint32_t reg, uint32_t *freq);
1082
1095uint8_t sx1262_set_rf_frequency(sx1262_handle_t *handle, uint32_t reg);
1096
1110
1124
1138uint8_t sx1262_set_tx_params(sx1262_handle_t *handle, int8_t dbm, sx1262_ramp_time_t t);
1139
1156 sx1262_gfsk_bandwidth_t bw, uint32_t fdev);
1157
1169uint8_t sx1262_gfsk_bit_rate_convert_to_register(sx1262_handle_t *handle, uint32_t br, uint32_t *reg);
1170
1182uint8_t sx1262_gfsk_bit_rate_convert_to_data(sx1262_handle_t *handle, uint32_t reg, uint32_t *br);
1183
1195uint8_t sx1262_gfsk_frequency_deviation_convert_to_register(sx1262_handle_t *handle, uint32_t freq, uint32_t *reg);
1196
1208uint8_t sx1262_gfsk_frequency_deviation_convert_to_data(sx1262_handle_t *handle, uint32_t reg, uint32_t *freq);
1209
1226 sx1262_lora_cr_t cr, sx1262_bool_t low_data_rate_optimize_enable);
1227
1248uint8_t sx1262_set_gfsk_packet_params(sx1262_handle_t *handle, uint16_t preamble_length,
1250 uint8_t sync_word_length, sx1262_gfsk_addr_filter_t filter,
1251 sx1262_gfsk_packet_type_t packet_type, uint8_t payload_length,
1252 sx1262_gfsk_crc_type_t crc_type, sx1262_bool_t whitening_enable);
1253
1270uint8_t sx1262_set_lora_packet_params(sx1262_handle_t *handle, uint16_t preamble_length,
1271 sx1262_lora_header_t header_type, uint8_t payload_length,
1272 sx1262_lora_crc_type_t crc_type, sx1262_bool_t invert_iq_enable);
1273
1291 uint8_t cad_det_peak, uint8_t cad_det_min, sx1262_lora_cad_exit_mode_t mode,
1292 uint32_t timeout);
1293
1307uint8_t sx1262_set_buffer_base_address(sx1262_handle_t *handle, uint8_t tx_base_addr, uint8_t rx_base_addr);
1308
1321uint8_t sx1262_set_lora_symb_num_timeout(sx1262_handle_t *handle, uint8_t symb_num);
1322
1335uint8_t sx1262_get_status(sx1262_handle_t *handle, uint8_t *status);
1336
1350uint8_t sx1262_get_rx_buffer_status(sx1262_handle_t *handle, uint8_t *payload_length_rx, uint8_t *rx_start_buffer_pointer);
1351
1368uint8_t sx1262_get_gfsk_packet_status(sx1262_handle_t *handle, uint8_t *rx_status, uint8_t *rssi_sync_raw,
1369 uint8_t *rssi_avg_raw, float *rssi_sync, float *rssi_avg);
1370
1388uint8_t sx1262_get_lora_packet_status(sx1262_handle_t *handle, uint8_t *rssi_pkt_raw, int8_t *snr_pkt_raw,
1389 uint8_t *signal_rssi_pkt_raw, float *rssi_pkt, float *snr_pkt, float *signal_rssi_pkt);
1390
1404uint8_t sx1262_get_instantaneous_rssi(sx1262_handle_t *handle, uint8_t *rssi_inst_raw, float *rssi_inst);
1405
1420uint8_t sx1262_get_stats(sx1262_handle_t *handle, uint16_t *pkt_received, uint16_t *pkt_crc_error, uint16_t *pkt_length_header_error);
1421
1436uint8_t sx1262_reset_stats(sx1262_handle_t *handle, uint16_t pkt_received, uint16_t pkt_crc_error, uint16_t pkt_length_header_error);
1437
1450uint8_t sx1262_get_device_errors(sx1262_handle_t *handle, uint16_t *op_error);
1451
1464
1468
1475
1488uint8_t sx1262_set_fsk_whitening_initial_value(sx1262_handle_t *handle, uint16_t value);
1489
1502uint8_t sx1262_get_fsk_whitening_initial_value(sx1262_handle_t *handle, uint16_t *value);
1503
1516uint8_t sx1262_set_fsk_crc_initical_value(sx1262_handle_t *handle, uint16_t value);
1517
1530uint8_t sx1262_get_fsk_crc_initical_value(sx1262_handle_t *handle, uint16_t *value);
1531
1544uint8_t sx1262_set_fsk_crc_polynomial_value(sx1262_handle_t *handle, uint16_t value);
1545
1558uint8_t sx1262_get_fsk_crc_polynomial_value(sx1262_handle_t *handle, uint16_t *value);
1559
1572uint8_t sx1262_set_fsk_sync_word(sx1262_handle_t *handle, uint8_t sync_word[8]);
1573
1586uint8_t sx1262_get_fsk_sync_word(sx1262_handle_t *handle, uint8_t sync_word[8]);
1587
1600uint8_t sx1262_set_fsk_node_address(sx1262_handle_t *handle, uint8_t addr);
1601
1614uint8_t sx1262_get_fsk_node_address(sx1262_handle_t *handle, uint8_t *addr);
1615
1628uint8_t sx1262_set_fsk_broadcast_address(sx1262_handle_t *handle, uint8_t addr);
1629
1642uint8_t sx1262_get_fsk_broadcast_address(sx1262_handle_t *handle, uint8_t *addr);
1643
1656uint8_t sx1262_set_iq_polarity(sx1262_handle_t *handle, uint8_t setup);
1657
1670uint8_t sx1262_get_iq_polarity(sx1262_handle_t *handle, uint8_t *setup);
1671
1684uint8_t sx1262_set_lora_sync_word(sx1262_handle_t *handle, uint16_t sync_word);
1685
1698uint8_t sx1262_get_lora_sync_word(sx1262_handle_t *handle, uint16_t *sync_word);
1699
1712uint8_t sx1262_get_random_number(sx1262_handle_t *handle, uint32_t *r);
1713
1726uint8_t sx1262_set_tx_modulation(sx1262_handle_t *handle, uint8_t modulation);
1727
1740uint8_t sx1262_get_tx_modulation(sx1262_handle_t *handle, uint8_t *modulation);
1741
1754uint8_t sx1262_set_rx_gain(sx1262_handle_t *handle, uint8_t gain);
1755
1768uint8_t sx1262_get_rx_gain(sx1262_handle_t *handle, uint8_t *gain);
1769
1782uint8_t sx1262_set_tx_clamp_config(sx1262_handle_t *handle, uint8_t config);
1783
1796uint8_t sx1262_get_tx_clamp_config(sx1262_handle_t *handle, uint8_t *config);
1797
1810uint8_t sx1262_set_ocp(sx1262_handle_t *handle, uint8_t ocp);
1811
1824uint8_t sx1262_get_ocp(sx1262_handle_t *handle, uint8_t *ocp);
1825
1838uint8_t sx1262_set_rtc_control(sx1262_handle_t *handle, uint8_t control);
1839
1852uint8_t sx1262_get_rtc_control(sx1262_handle_t *handle, uint8_t *control);
1853
1866uint8_t sx1262_set_xta_trim(sx1262_handle_t *handle, uint8_t trim);
1867
1880uint8_t sx1262_get_xta_trim(sx1262_handle_t *handle, uint8_t *trim);
1881
1894uint8_t sx1262_set_xtb_trim(sx1262_handle_t *handle, uint8_t trim);
1895
1908uint8_t sx1262_get_xtb_trim(sx1262_handle_t *handle, uint8_t *trim);
1909
1922uint8_t sx1262_set_dio3_output_control(sx1262_handle_t *handle, uint8_t control);
1923
1936uint8_t sx1262_get_dio3_output_control(sx1262_handle_t *handle, uint8_t *control);
1937
1950uint8_t sx1262_set_event_mask(sx1262_handle_t *handle, uint8_t mask);
1951
1964uint8_t sx1262_get_event_mask(sx1262_handle_t *handle, uint8_t *mask);
1965
1978uint8_t sx1262_set_dio_output_enable(sx1262_handle_t *handle, uint8_t enable);
1979
1992uint8_t sx1262_get_dio_output_enable(sx1262_handle_t *handle, uint8_t *enable);
1993
2006uint8_t sx1262_set_dio_input_enable(sx1262_handle_t *handle, uint8_t enable);
2007
2020uint8_t sx1262_get_dio_input_enable(sx1262_handle_t *handle, uint8_t *enable);
2021
2034uint8_t sx1262_set_pull_up_control(sx1262_handle_t *handle, uint8_t control);
2035
2048uint8_t sx1262_get_pull_up_control(sx1262_handle_t *handle, uint8_t *control);
2049
2062uint8_t sx1262_set_pull_down_control(sx1262_handle_t *handle, uint8_t control);
2063
2076uint8_t sx1262_get_pull_down_control(sx1262_handle_t *handle, uint8_t *control);
2077
2090uint8_t sx1262_set_fhss_hopping_enable(sx1262_handle_t *handle, uint8_t enable);
2091
2104uint8_t sx1262_get_fhss_hopping_enable(sx1262_handle_t *handle, uint8_t *enable);
2105
2118uint8_t sx1262_set_fhss_packet_length(sx1262_handle_t *handle, uint8_t len);
2119
2132uint8_t sx1262_get_fhss_packet_length(sx1262_handle_t *handle, uint8_t *len);
2133
2146uint8_t sx1262_set_fhss_nb_hopping_blocks(sx1262_handle_t *handle, uint8_t n);
2147
2160uint8_t sx1262_get_fhss_nb_hopping_blocks(sx1262_handle_t *handle, uint8_t *n);
2161
2174uint8_t sx1262_set_fhss_symbols_freq0(sx1262_handle_t *handle, uint16_t num);
2175
2188uint8_t sx1262_get_fhss_symbols_freq0(sx1262_handle_t *handle, uint16_t *num);
2189
2202uint8_t sx1262_set_fhss_freq0(sx1262_handle_t *handle, uint32_t freq);
2203
2216uint8_t sx1262_get_fhss_freq0(sx1262_handle_t *handle, uint32_t *freq);
2217
2230uint8_t sx1262_set_fhss_symbols_freq15(sx1262_handle_t *handle, uint16_t num);
2231
2244uint8_t sx1262_get_fhss_symbols_freq15(sx1262_handle_t *handle, uint16_t *num);
2245
2258uint8_t sx1262_set_fhss_freq15(sx1262_handle_t *handle, uint32_t freq);
2259
2272uint8_t sx1262_get_fhss_freq15(sx1262_handle_t *handle, uint32_t *freq);
2273
2277
2284
2299uint8_t sx1262_write_read_reg(sx1262_handle_t *handle, uint8_t *in_buf, uint32_t in_len,
2300 uint8_t *out_buf, uint32_t out_len);
2301
2305
2309
2310#ifdef __cplusplus
2311}
2312#endif
2313
2314#endif
sx1262_lora_bandwidth_t
sx1262 lora bandwidth enumeration definition
sx1262_gfsk_packet_type_t
sx1262 gfsk packet type enumeration definition
uint8_t sx1262_set_lora_modulation_params(sx1262_handle_t *handle, sx1262_lora_sf_t sf, sx1262_lora_bandwidth_t bw, sx1262_lora_cr_t cr, sx1262_bool_t low_data_rate_optimize_enable)
set the modulation params in LoRa mode
sx1262_bool_t
sx1262 bool enumeration definition
uint8_t sx1262_set_tx_continuous_wave(sx1262_handle_t *handle)
enter to the tx continuous wave mode
uint8_t sx1262_gfsk_frequency_deviation_convert_to_register(sx1262_handle_t *handle, uint32_t freq, uint32_t *reg)
convert the frequency deviation to the register raw data
uint8_t sx1262_set_buffer_base_address(sx1262_handle_t *handle, uint8_t tx_base_addr, uint8_t rx_base_addr)
set the buffer base address
uint8_t sx1262_get_gfsk_packet_status(sx1262_handle_t *handle, uint8_t *rx_status, uint8_t *rssi_sync_raw, uint8_t *rssi_avg_raw, float *rssi_sync, float *rssi_avg)
get the packet status in GFSK mode
uint8_t sx1262_clear_irq_status(sx1262_handle_t *handle, uint16_t clear_irq_param)
clear the irq status
sx1262_tcxo_voltage_t
sx1262 tcxo voltage enumeration definition
sx1262_lora_cad_exit_mode_t
sx1262 lora cad exit mode enumeration definition
sx1262_gfsk_bandwidth_t
sx1262 gfsk bandwidth enumeration definition
uint8_t sx1262_set_calibration_image(sx1262_handle_t *handle, uint8_t freq1, uint8_t freq2)
set the calibration image frequency
uint8_t sx1262_set_gfsk_packet_params(sx1262_handle_t *handle, uint16_t preamble_length, sx1262_gfsk_preamble_detector_length_t detector_length, uint8_t sync_word_length, sx1262_gfsk_addr_filter_t filter, sx1262_gfsk_packet_type_t packet_type, uint8_t payload_length, sx1262_gfsk_crc_type_t crc_type, sx1262_bool_t whitening_enable)
set the packet params in GFSK mode
uint8_t sx1262_set_rx_tx_fallback_mode(sx1262_handle_t *handle, sx1262_rx_tx_fallback_mode_t mode)
set the rx tx fallback mode
uint8_t sx1262_gfsk_bit_rate_convert_to_data(sx1262_handle_t *handle, uint32_t reg, uint32_t *br)
convert the register raw data to the bit rate
uint8_t sx1262_set_tx(sx1262_handle_t *handle, uint32_t timeout)
enter to the tx mode
uint8_t sx1262_set_rx(sx1262_handle_t *handle, uint32_t timeout)
enter to the rx mode
uint8_t sx1262_reset_stats(sx1262_handle_t *handle, uint16_t pkt_received, uint16_t pkt_crc_error, uint16_t pkt_length_header_error)
reset the stats
sx1262_lora_sf_t
sx1262 lora spreading factor enumeration definition
uint8_t sx1262_set_sleep(sx1262_handle_t *handle, sx1262_start_mode_t mode, sx1262_bool_t rtc_wake_up_enable)
enter to the sleep mode
uint8_t sx1262_lora_transmit(sx1262_handle_t *handle, sx1262_clock_source_t standby_src, uint16_t preamble_length, sx1262_lora_header_t header_type, sx1262_lora_crc_type_t crc_type, sx1262_bool_t invert_iq_enable, uint8_t *buf, uint16_t len, uint32_t us)
send the lora data
uint8_t sx1262_read_buffer(sx1262_handle_t *handle, uint8_t offset, uint8_t *buf, uint16_t len)
read the buffer
struct sx1262_info_s sx1262_info_t
sx1262 information structure definition
struct sx1262_handle_s sx1262_handle_t
sx1262 handle structure definition
uint8_t sx1262_set_standby(sx1262_handle_t *handle, sx1262_clock_source_t src)
enter to the standby mode
uint8_t sx1262_set_tx_params(sx1262_handle_t *handle, int8_t dbm, sx1262_ramp_time_t t)
set the tx params
uint8_t sx1262_timeout_convert_to_data(sx1262_handle_t *handle, uint32_t reg, double *us)
convert the register raw data to the timeout
uint8_t sx1262_write_buffer(sx1262_handle_t *handle, uint8_t offset, uint8_t *buf, uint16_t len)
write the buffer
sx1262_ramp_time_t
sx1262 ramp time enumeration definition
uint8_t sx1262_get_rx_buffer_status(sx1262_handle_t *handle, uint8_t *payload_length_rx, uint8_t *rx_start_buffer_pointer)
get the rx buffer status
sx1262_rx_tx_fallback_mode_t
sx1262 rx tx fallback mode enumeration definition
uint8_t sx1262_get_irq_status(sx1262_handle_t *handle, uint16_t *status)
get the irq status
uint8_t sx1262_set_dio2_as_rf_switch_ctrl(sx1262_handle_t *handle, sx1262_bool_t enable)
set dio2 as rf switch ctrl
uint8_t sx1262_set_regulator_mode(sx1262_handle_t *handle, sx1262_regulator_mode_t mode)
set the regulator_mode
uint8_t sx1262_set_lora_packet_params(sx1262_handle_t *handle, uint16_t preamble_length, sx1262_lora_header_t header_type, uint8_t payload_length, sx1262_lora_crc_type_t crc_type, sx1262_bool_t invert_iq_enable)
set the packet params in LoRa mode
uint8_t sx1262_frequency_convert_to_data(sx1262_handle_t *handle, uint32_t reg, uint32_t *freq)
convert the register raw data to the frequency
sx1262_gfsk_pulse_shape_t
sx1262 gfsk pulse shape enumeration definition
sx1262_start_mode_t
sx1262 start mode enumeration definition
uint8_t sx1262_set_lora_symb_num_timeout(sx1262_handle_t *handle, uint8_t symb_num)
set the lora symbol number timeout
uint8_t sx1262_read_register(sx1262_handle_t *handle, uint16_t reg, uint8_t *buf, uint16_t len)
read the register
sx1262_packet_type_t
sx1262 packet type enumeration definition
uint8_t sx1262_gfsk_bit_rate_convert_to_register(sx1262_handle_t *handle, uint32_t br, uint32_t *reg)
convert the bit rate to the register raw data
uint8_t sx1262_irq_handler(sx1262_handle_t *handle)
irq handler
sx1262_lora_crc_type_t
sx1262 lora crc type enumeration definition
uint8_t sx1262_continuous_receive(sx1262_handle_t *handle)
enter to the continuous receive mode
uint8_t sx1262_gfsk_frequency_deviation_convert_to_data(sx1262_handle_t *handle, uint32_t reg, uint32_t *freq)
convert the register raw data to the frequency deviation
uint8_t sx1262_set_rx_duty_cycle(sx1262_handle_t *handle, uint32_t rx_period, uint32_t sleep_period)
set the rx duty cycle
uint8_t sx1262_set_pa_config(sx1262_handle_t *handle, uint8_t pa_duty_cycle, uint8_t hp_max)
set the pa config
uint8_t sx1262_single_receive(sx1262_handle_t *handle, double us)
enter to the single receive mode
uint8_t sx1262_set_gfsk_modulation_params(sx1262_handle_t *handle, uint32_t br, sx1262_gfsk_pulse_shape_t shape, sx1262_gfsk_bandwidth_t bw, uint32_t fdev)
set the modulation params in GFSK mode
sx1262_gfsk_addr_filter_t
sx1262 gfsk addr filter enumeration definition
sx1262_gfsk_preamble_detector_length_t
sx1262 gfsk preamble detector length enumeration definition
uint8_t sx1262_set_tx_infinite_preamble(sx1262_handle_t *handle)
enter to the tx infinite preamble mode
uint8_t sx1262_set_rf_frequency(sx1262_handle_t *handle, uint32_t reg)
set the rf frequency
uint8_t sx1262_set_packet_type(sx1262_handle_t *handle, sx1262_packet_type_t type)
set the packet type
uint8_t sx1262_set_dio3_as_tcxo_ctrl(sx1262_handle_t *handle, sx1262_tcxo_voltage_t voltage, uint32_t delay)
set dio3 as tcxo ctrl
uint8_t sx1262_set_cad(sx1262_handle_t *handle)
run the cad
sx1262_lora_header_t
sx1262 lora header enumeration definition
uint8_t sx1262_set_frequency_synthesis(sx1262_handle_t *handle)
enter to the frequency synthesis mode
uint8_t sx1262_get_status(sx1262_handle_t *handle, uint8_t *status)
get the status
uint8_t sx1262_get_lora_packet_status(sx1262_handle_t *handle, uint8_t *rssi_pkt_raw, int8_t *snr_pkt_raw, uint8_t *signal_rssi_pkt_raw, float *rssi_pkt, float *snr_pkt, float *signal_rssi_pkt)
get the packet status in LoRa mode
sx1262_irq_t
sx1262 irq enumeration definition
uint8_t sx1262_timeout_convert_to_register(sx1262_handle_t *handle, double us, uint32_t *reg)
convert the timeout to the register raw data
uint8_t sx1262_set_calibration(sx1262_handle_t *handle, uint8_t settings)
set the calibration settings
uint8_t sx1262_get_packet_type(sx1262_handle_t *handle, sx1262_packet_type_t *type)
get the packet type
uint8_t sx1262_write_register(sx1262_handle_t *handle, uint16_t reg, uint8_t *buf, uint16_t len)
write the register
uint8_t sx1262_set_stop_timer_on_preamble(sx1262_handle_t *handle, sx1262_bool_t enable)
stop timer on preamble
uint8_t sx1262_get_instantaneous_rssi(sx1262_handle_t *handle, uint8_t *rssi_inst_raw, float *rssi_inst)
get the instantaneous rssi
uint8_t sx1262_deinit(sx1262_handle_t *handle)
close the chip
uint8_t sx1262_set_dio_irq_params(sx1262_handle_t *handle, uint16_t irq_mask, uint16_t dio1_mask, uint16_t dio2_mask, uint16_t dio3_mask)
set the dio irq params
sx1262_lora_cad_symbol_num_t
sx1262 lora cad symbol num enumeration definition
uint8_t sx1262_frequency_convert_to_register(sx1262_handle_t *handle, uint32_t freq, uint32_t *reg)
convert the frequency to the register raw data
sx1262_gfsk_crc_type_t
sx1262 gfsk crc type enumeration definition
uint8_t sx1262_get_device_errors(sx1262_handle_t *handle, uint16_t *op_error)
get the device errors
uint8_t sx1262_set_cad_params(sx1262_handle_t *handle, sx1262_lora_cad_symbol_num_t num, uint8_t cad_det_peak, uint8_t cad_det_min, sx1262_lora_cad_exit_mode_t mode, uint32_t timeout)
set the cad params
uint8_t sx1262_check_packet_error(sx1262_handle_t *handle, sx1262_bool_t *enable)
check the packet error
sx1262_clock_source_t
sx1262 clock source enumeration definition
sx1262_fsk_rx_status_t
sx1262 fsk rx status enumeration definition
uint8_t sx1262_get_stats(sx1262_handle_t *handle, uint16_t *pkt_received, uint16_t *pkt_crc_error, uint16_t *pkt_length_header_error)
get the stats
sx1262_calibration_t
sx1262 calibration enumeration definition
sx1262_op_error_t
sx1262 op error enumeration definition
uint8_t sx1262_clear_device_errors(sx1262_handle_t *handle)
clear the device errors
sx1262_regulator_mode_t
sx1262 regulator mode enumeration definition
uint8_t sx1262_init(sx1262_handle_t *handle)
initialize the chip
uint8_t sx1262_lora_cad(sx1262_handle_t *handle, sx1262_bool_t *enable)
run the cad
uint8_t sx1262_info(sx1262_info_t *info)
get chip's information
sx1262_lora_cr_t
sx1262 lora coding rate enumeration definition
@ SX1262_LORA_BANDWIDTH_10P42_KHZ
@ SX1262_LORA_BANDWIDTH_7P81_KHZ
@ SX1262_LORA_BANDWIDTH_500_KHZ
@ SX1262_LORA_BANDWIDTH_20P83_KHZ
@ SX1262_LORA_BANDWIDTH_31P25_KHZ
@ SX1262_LORA_BANDWIDTH_15P63_KHZ
@ SX1262_LORA_BANDWIDTH_41P67_KHZ
@ SX1262_LORA_BANDWIDTH_62P50_KHZ
@ SX1262_LORA_BANDWIDTH_125_KHZ
@ SX1262_LORA_BANDWIDTH_250_KHZ
@ SX1262_GFSK_PACKET_TYPE_KNOWN_LENGTH
@ SX1262_GFSK_PACKET_TYPE_VARIABLE_SIZE
@ SX1262_BOOL_FALSE
@ SX1262_BOOL_TRUE
@ SX1262_TCXO_VOLTAGE_2P7V
@ SX1262_TCXO_VOLTAGE_1P7V
@ SX1262_TCXO_VOLTAGE_2P4V
@ SX1262_TCXO_VOLTAGE_3P0V
@ SX1262_TCXO_VOLTAGE_1P6V
@ SX1262_TCXO_VOLTAGE_3P3V
@ SX1262_TCXO_VOLTAGE_1P8V
@ SX1262_TCXO_VOLTAGE_2P2V
@ SX1262_LORA_CAD_EXIT_MODE_ONLY
@ SX1262_LORA_CAD_EXIT_MODE_RX
@ SX1262_GFSK_BANDWIDTH_187P2_KHZ
@ SX1262_GFSK_BANDWIDTH_93P8_KHZ
@ SX1262_GFSK_BANDWIDTH_23P4_KHZ
@ SX1262_GFSK_BANDWIDTH_117P3_KHZ
@ SX1262_GFSK_BANDWIDTH_7P3_KHZ
@ SX1262_GFSK_BANDWIDTH_9P7_KHZ
@ SX1262_GFSK_BANDWIDTH_232P3_KHZ
@ SX1262_GFSK_BANDWIDTH_373P6_KHZ
@ SX1262_GFSK_BANDWIDTH_14P6_KHZ
@ SX1262_GFSK_BANDWIDTH_467_KHZ
@ SX1262_GFSK_BANDWIDTH_29P3_KHZ
@ SX1262_GFSK_BANDWIDTH_156P2_KHZ
@ SX1262_GFSK_BANDWIDTH_78P2_KHZ
@ SX1262_GFSK_BANDWIDTH_19P5_KHZ
@ SX1262_GFSK_BANDWIDTH_58P6_KHZ
@ SX1262_GFSK_BANDWIDTH_312_KHZ
@ SX1262_GFSK_BANDWIDTH_46P9_KHZ
@ SX1262_GFSK_BANDWIDTH_5P8_KHZ
@ SX1262_GFSK_BANDWIDTH_4P8_KHZ
@ SX1262_GFSK_BANDWIDTH_11P7_KHZ
@ SX1262_GFSK_BANDWIDTH_39_KHZ
@ SX1262_LORA_SF_11
@ SX1262_LORA_SF_9
@ SX1262_LORA_SF_12
@ SX1262_LORA_SF_5
@ SX1262_LORA_SF_6
@ SX1262_LORA_SF_10
@ SX1262_LORA_SF_8
@ SX1262_LORA_SF_7
@ SX1262_RAMP_TIME_40US
@ SX1262_RAMP_TIME_10US
@ SX1262_RAMP_TIME_80US
@ SX1262_RAMP_TIME_3400US
@ SX1262_RAMP_TIME_1700US
@ SX1262_RAMP_TIME_200US
@ SX1262_RAMP_TIME_20US
@ SX1262_RAMP_TIME_800US
@ SX1262_RX_TX_FALLBACK_MODE_STDBY_XOSC
@ SX1262_RX_TX_FALLBACK_MODE_FS
@ SX1262_RX_TX_FALLBACK_MODE_STDBY_RC
@ SX1262_GFSK_PULSE_SHAPE_NO_FILTER
@ SX1262_GFSK_PULSE_SHAPE_GAUSSIAN_BT_0P7
@ SX1262_GFSK_PULSE_SHAPE_GAUSSIAN_BT_0P3
@ SX1262_GFSK_PULSE_SHAPE_GAUSSIAN_BT_0P5
@ SX1262_GFSK_PULSE_SHAPE_GAUSSIAN_BT_1
@ SX1262_START_MODE_WARM
@ SX1262_START_MODE_COLD
@ SX1262_PACKET_TYPE_GFSK
@ SX1262_PACKET_TYPE_LORA
@ SX1262_PACKET_TYPE_FHSS
@ SX1262_LORA_CRC_TYPE_ON
@ SX1262_LORA_CRC_TYPE_OFF
@ SX1262_GFSK_ADDR_FILTER_DISABLE
@ SX1262_GFSK_ADDR_FILTER_ACTIVATED_NODE_BROADCAST_ADDR
@ SX1262_GFSK_ADDR_FILTER_ACTIVATED_NODE_ADDR
@ SX1262_GFSK_PREAMBLE_DETECTOR_LENGTH_24_BITS
@ SX1262_GFSK_PREAMBLE_DETECTOR_LENGTH_32_BITS
@ SX1262_GFSK_PREAMBLE_DETECTOR_LENGTH_16_BITS
@ SX1262_GFSK_PREAMBLE_DETECTOR_LENGTH_OFF
@ SX1262_GFSK_PREAMBLE_DETECTOR_LENGTH_8_BITS
@ SX1262_LORA_HEADER_IMPLICIT
@ SX1262_LORA_HEADER_EXPLICIT
@ SX1262_IRQ_PREAMBLE_DETECTED
@ SX1262_IRQ_HEADER_ERR
@ SX1262_IRQ_CAD_DONE
@ SX1262_IRQ_RX_DONE
@ SX1262_IRQ_CAD_DETECTED
@ SX1262_IRQ_CRC_ERR
@ SX1262_IRQ_TX_DONE
@ SX1262_IRQ_TIMEOUT
@ SX1262_IRQ_SYNC_WORD_VALID
@ SX1262_IRQ_HEADER_VALID
@ SX1262_LORA_CAD_SYMBOL_NUM_1
@ SX1262_LORA_CAD_SYMBOL_NUM_16
@ SX1262_LORA_CAD_SYMBOL_NUM_8
@ SX1262_LORA_CAD_SYMBOL_NUM_2
@ SX1262_LORA_CAD_SYMBOL_NUM_4
@ SX1262_GFSK_CRC_TYPE_2_BYTE_INV
@ SX1262_GFSK_CRC_TYPE_1_BYTE_INV
@ SX1262_GFSK_CRC_TYPE_OFF
@ SX1262_GFSK_CRC_TYPE_1_BYTE
@ SX1262_GFSK_CRC_TYPE_2_BYTE
@ SX1262_CLOCK_SOURCE_RC_13M
@ SX1262_CLOCK_SOURCE_XTAL_32MHZ
@ SX1262_FSK_RX_STATUS_ABORT_ERR
@ SX1262_FSK_RX_STATUS_PREAMBLE_ERR
@ SX1262_FSK_RX_STATUS_PKT_RECEIVED
@ SX1262_FSK_RX_STATUS_PKT_SEND
@ SX1262_FSK_RX_STATUS_SYNC_ERR
@ SX1262_FSK_RX_STATUS_CRC_ERR
@ SX1262_FSK_RX_STATUS_ADDR_ERR
@ SX1262_FSK_RX_STATUS_LENGTH_ERR
@ SX1262_CALIBRATION_ADC_PULSE
@ SX1262_CALIBRATION_RC64K
@ SX1262_CALIBRATION_ADC_BULK_P
@ SX1262_CALIBRATION_ADC_BULK_N
@ SX1262_CALIBRATION_RC13M
@ SX1262_CALIBRATION_IMAGE
@ SX1262_CALIBRATION_PLL
@ SX1262_OP_ERROR_ADC_CALIB_ERR
@ SX1262_OP_ERROR_PA_RAMP_ERR
@ SX1262_OP_ERROR_RC13M_CALIB_ERR
@ SX1262_OP_ERROR_RC64K_CALIB_ERR
@ SX1262_OP_ERROR_XOSC_START_ERR
@ SX1262_OP_ERROR_PLL_LOCK_ERR
@ SX1262_OP_ERROR_IMG_CALIB_ERR
@ SX1262_OP_ERROR_PLL_CALIB_ERR
@ SX1262_REGULATOR_MODE_DC_DC_LDO
@ SX1262_REGULATOR_MODE_ONLY_LDO
@ SX1262_LORA_CR_4_5
@ SX1262_LORA_CR_4_7
@ SX1262_LORA_CR_4_8
@ SX1262_LORA_CR_4_6
uint8_t sx1262_write_read_reg(sx1262_handle_t *handle, uint8_t *in_buf, uint32_t in_len, uint8_t *out_buf, uint32_t out_len)
write and read register
uint8_t sx1262_get_fhss_freq0(sx1262_handle_t *handle, uint32_t *freq)
get fhss freq0
uint8_t sx1262_set_dio_input_enable(sx1262_handle_t *handle, uint8_t enable)
set the dio input enable
uint8_t sx1262_set_tx_clamp_config(sx1262_handle_t *handle, uint8_t config)
set the tx clamp config
uint8_t sx1262_set_dio3_output_control(sx1262_handle_t *handle, uint8_t control)
set the dio3 output
uint8_t sx1262_set_lora_sync_word(sx1262_handle_t *handle, uint16_t sync_word)
set the lora sync word
uint8_t sx1262_set_pull_up_control(sx1262_handle_t *handle, uint8_t control)
set the pull up control
uint8_t sx1262_get_fhss_symbols_freq0(sx1262_handle_t *handle, uint16_t *num)
get fhss freq0 symbols
uint8_t sx1262_set_pull_down_control(sx1262_handle_t *handle, uint8_t control)
set the pull down control
uint8_t sx1262_get_iq_polarity(sx1262_handle_t *handle, uint8_t *setup)
get the iq polarity
uint8_t sx1262_set_iq_polarity(sx1262_handle_t *handle, uint8_t setup)
set the iq polarity
uint8_t sx1262_set_xta_trim(sx1262_handle_t *handle, uint8_t trim)
set the xta trim
uint8_t sx1262_get_fhss_nb_hopping_blocks(sx1262_handle_t *handle, uint8_t *n)
get fhss nb hopping blocks
uint8_t sx1262_set_rx_gain(sx1262_handle_t *handle, uint8_t gain)
set the rx gain
uint8_t sx1262_set_fsk_node_address(sx1262_handle_t *handle, uint8_t addr)
set the node address in FSK mode
uint8_t sx1262_get_lora_sync_word(sx1262_handle_t *handle, uint16_t *sync_word)
get the lora sync word
uint8_t sx1262_get_fsk_sync_word(sx1262_handle_t *handle, uint8_t sync_word[8])
get the sync word in FSK mode
uint8_t sx1262_get_fhss_packet_length(sx1262_handle_t *handle, uint8_t *len)
get fhss packet length
uint8_t sx1262_get_dio_output_enable(sx1262_handle_t *handle, uint8_t *enable)
get the dio output enable
uint8_t sx1262_set_rtc_control(sx1262_handle_t *handle, uint8_t control)
set the rtc control
uint8_t sx1262_set_ocp(sx1262_handle_t *handle, uint8_t ocp)
set the ocp
uint8_t sx1262_set_tx_modulation(sx1262_handle_t *handle, uint8_t modulation)
set the tx modulation
uint8_t sx1262_get_fhss_symbols_freq15(sx1262_handle_t *handle, uint16_t *num)
get fhss freq15 symbols
uint8_t sx1262_get_random_number(sx1262_handle_t *handle, uint32_t *r)
get the random number
uint8_t sx1262_set_fsk_crc_initical_value(sx1262_handle_t *handle, uint16_t value)
set the crc initial value in FSK mode
uint8_t sx1262_set_fsk_whitening_initial_value(sx1262_handle_t *handle, uint16_t value)
set the whitening initial value in FSK mode
uint8_t sx1262_get_rx_gain(sx1262_handle_t *handle, uint8_t *gain)
get the rx gain
uint8_t sx1262_set_fhss_nb_hopping_blocks(sx1262_handle_t *handle, uint8_t n)
set fhss nb hopping blocks
uint8_t sx1262_set_fhss_packet_length(sx1262_handle_t *handle, uint8_t len)
set fhss packet length
uint8_t sx1262_get_fsk_node_address(sx1262_handle_t *handle, uint8_t *addr)
get the node address in FSK mode
uint8_t sx1262_get_tx_clamp_config(sx1262_handle_t *handle, uint8_t *config)
get the tx clamp config
uint8_t sx1262_get_event_mask(sx1262_handle_t *handle, uint8_t *mask)
get the event mask
uint8_t sx1262_set_fhss_freq15(sx1262_handle_t *handle, uint32_t freq)
set fhss freq15
uint8_t sx1262_get_fsk_crc_polynomial_value(sx1262_handle_t *handle, uint16_t *value)
get the crc polynomial value in FSK mode
uint8_t sx1262_get_xta_trim(sx1262_handle_t *handle, uint8_t *trim)
get the xta trim
uint8_t sx1262_set_fhss_symbols_freq15(sx1262_handle_t *handle, uint16_t num)
set fhss freq15 symbols
uint8_t sx1262_get_dio_input_enable(sx1262_handle_t *handle, uint8_t *enable)
get the dio input enable
uint8_t sx1262_get_rtc_control(sx1262_handle_t *handle, uint8_t *control)
get the rtc control
uint8_t sx1262_get_tx_modulation(sx1262_handle_t *handle, uint8_t *modulation)
get the tx modulation
uint8_t sx1262_get_fhss_hopping_enable(sx1262_handle_t *handle, uint8_t *enable)
get fhss hopping enable
uint8_t sx1262_get_fsk_crc_initical_value(sx1262_handle_t *handle, uint16_t *value)
get the crc initical value in FSK mode
uint8_t sx1262_get_pull_down_control(sx1262_handle_t *handle, uint8_t *control)
get the pull down control
uint8_t sx1262_get_dio3_output_control(sx1262_handle_t *handle, uint8_t *control)
get the dio3 output
uint8_t sx1262_get_fsk_broadcast_address(sx1262_handle_t *handle, uint8_t *addr)
get the broadcast address in FSK mode
uint8_t sx1262_set_event_mask(sx1262_handle_t *handle, uint8_t mask)
set the event mask
uint8_t sx1262_get_pull_up_control(sx1262_handle_t *handle, uint8_t *control)
get the pull up control
uint8_t sx1262_get_fsk_whitening_initial_value(sx1262_handle_t *handle, uint16_t *value)
get the whitening initial value in FSK mode
uint8_t sx1262_set_fhss_symbols_freq0(sx1262_handle_t *handle, uint16_t num)
set fhss freq0 symbols
uint8_t sx1262_set_dio_output_enable(sx1262_handle_t *handle, uint8_t enable)
set the dio output enable
uint8_t sx1262_get_xtb_trim(sx1262_handle_t *handle, uint8_t *trim)
get the xtb trim
uint8_t sx1262_set_fsk_broadcast_address(sx1262_handle_t *handle, uint8_t addr)
set the broadcast address in FSK mode
uint8_t sx1262_set_fsk_sync_word(sx1262_handle_t *handle, uint8_t sync_word[8])
set the sync word in FSK mode
uint8_t sx1262_set_fhss_freq0(sx1262_handle_t *handle, uint32_t freq)
set fhss freq0
uint8_t sx1262_get_ocp(sx1262_handle_t *handle, uint8_t *ocp)
get the ocp
uint8_t sx1262_set_xtb_trim(sx1262_handle_t *handle, uint8_t trim)
set the xtb trim
uint8_t sx1262_set_fhss_hopping_enable(sx1262_handle_t *handle, uint8_t enable)
set fhss hopping enable
uint8_t sx1262_get_fhss_freq15(sx1262_handle_t *handle, uint32_t *freq)
get fhss freq15
uint8_t sx1262_set_fsk_crc_polynomial_value(sx1262_handle_t *handle, uint16_t value)
set the crc polynomial value in FSK mode
sx1262 handle structure definition
uint8_t(* spi_write_read)(uint8_t *in_buf, uint32_t in_len, uint8_t *out_buf, uint32_t out_len)
uint8_t(* spi_init)(void)
void(* delay_ms)(uint32_t ms)
uint8_t(* busy_gpio_init)(void)
void(* receive_callback)(uint16_t type, uint8_t *buf, uint16_t len)
uint8_t(* reset_gpio_deinit)(void)
void(* debug_print)(const char *const fmt,...)
uint8_t(* busy_gpio_deinit)(void)
uint8_t(* spi_deinit)(void)
uint8_t(* reset_gpio_init)(void)
uint8_t receive_buf[256]
uint8_t(* busy_gpio_read)(uint8_t *value)
uint8_t buf[384]
uint8_t(* reset_gpio_write)(uint8_t value)
sx1262 information structure definition
float supply_voltage_max_v
uint32_t driver_version
char manufacturer_name[32]
float supply_voltage_min_v
char chip_name[32]