LibDriver SX1268
Loading...
Searching...
No Matches
driver_sx1268.h
Go to the documentation of this file.
1
36
37#ifndef DRIVER_SX1268_H
38#define DRIVER_SX1268_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
159
174
186
214
229
246
257
269
279
290
302
311
320
332
344
359
374
378typedef struct sx1268_handle_s
379{
380 uint8_t (*reset_gpio_init)(void);
381 uint8_t (*reset_gpio_deinit)(void);
382 uint8_t (*reset_gpio_write)(uint8_t value);
383 uint8_t (*busy_gpio_init)(void);
384 uint8_t (*busy_gpio_deinit)(void);
385 uint8_t (*busy_gpio_read)(uint8_t *value);
386 uint8_t (*spi_init)(void);
387 uint8_t (*spi_deinit)(void);
388 uint8_t (*spi_write_read)(uint8_t *in_buf, uint32_t in_len,
389 uint8_t *out_buf, uint32_t out_len);
390 void (*delay_ms)(uint32_t ms);
391 void (*debug_print)(const char *const fmt, ...);
392 void (*receive_callback)(uint16_t type,
393 uint8_t *buf, uint16_t len);
394 uint8_t inited;
395 uint8_t tx_done;
396 uint8_t cad_done;
397 uint8_t cad_detected;
398 uint8_t crc_error;
399 uint8_t timeout;
400 uint8_t buf[384];
401 uint8_t receive_buf[256];
403
419
423
430
437#define DRIVER_SX1268_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
438
445#define DRIVER_SX1268_LINK_SPI_INIT(HANDLE, FUC) (HANDLE)->spi_init = FUC
446
453#define DRIVER_SX1268_LINK_SPI_DEINIT(HANDLE, FUC) (HANDLE)->spi_deinit = FUC
454
461#define DRIVER_SX1268_LINK_SPI_WRITE_READ(HANDLE, FUC) (HANDLE)->spi_write_read = FUC
462
469#define DRIVER_SX1268_LINK_RESET_GPIO_INIT(HANDLE, FUC) (HANDLE)->reset_gpio_init = FUC
470
477#define DRIVER_SX1268_LINK_RESET_GPIO_DEINIT(HANDLE, FUC) (HANDLE)->reset_gpio_deinit = FUC
478
485#define DRIVER_SX1268_LINK_RESET_GPIO_WRITE(HANDLE, FUC) (HANDLE)->reset_gpio_write = FUC
486
493#define DRIVER_SX1268_LINK_BUSY_GPIO_INIT(HANDLE, FUC) (HANDLE)->busy_gpio_init = FUC
494
501#define DRIVER_SX1268_LINK_BUSY_GPIO_DEINIT(HANDLE, FUC) (HANDLE)->busy_gpio_deinit = FUC
502
509#define DRIVER_SX1268_LINK_BUSY_GPIO_READ(HANDLE, FUC) (HANDLE)->busy_gpio_read = FUC
510
517#define DRIVER_SX1268_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
518
525#define DRIVER_SX1268_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
526
533#define DRIVER_SX1268_LINK_RECEIVE_CALLBACK(HANDLE, FUC) (HANDLE)->receive_callback = FUC
534
538
545
554uint8_t sx1268_info(sx1268_info_t *info);
555
566uint8_t sx1268_irq_handler(sx1268_handle_t *handle);
567
581uint8_t sx1268_init(sx1268_handle_t *handle);
582
597uint8_t sx1268_deinit(sx1268_handle_t *handle);
598
622 uint16_t preamble_length, sx1268_lora_header_t header_type,
623 sx1268_lora_crc_type_t crc_type, sx1268_bool_t invert_iq_enable,
624 uint8_t *buf, uint16_t len, uint32_t us);
625
639uint8_t sx1268_lora_cad(sx1268_handle_t *handle, sx1268_bool_t *enable);
640
653uint8_t sx1268_single_receive(sx1268_handle_t *handle, double us);
654
667
682uint8_t sx1268_write_register(sx1268_handle_t *handle, uint16_t reg, uint8_t *buf, uint16_t len);
683
698uint8_t sx1268_read_register(sx1268_handle_t *handle, uint16_t reg, uint8_t *buf, uint16_t len);
699
714uint8_t sx1268_write_buffer(sx1268_handle_t *handle, uint8_t offset, uint8_t *buf, uint16_t len);
715
730uint8_t sx1268_read_buffer(sx1268_handle_t *handle, uint8_t offset, uint8_t *buf, uint16_t len);
731
743
757uint8_t sx1268_set_sleep(sx1268_handle_t *handle, sx1268_start_mode_t mode, sx1268_bool_t rtc_wake_up_enable);
758
772
785
798uint8_t sx1268_set_tx(sx1268_handle_t *handle, uint32_t timeout);
799
813uint8_t sx1268_set_rx(sx1268_handle_t *handle, uint32_t timeout);
814
826uint8_t sx1268_timeout_convert_to_register(sx1268_handle_t *handle, double us, uint32_t *reg);
827
839uint8_t sx1268_timeout_convert_to_data(sx1268_handle_t *handle, uint32_t reg, double *us);
840
854
868uint8_t sx1268_set_rx_duty_cycle(sx1268_handle_t *handle, uint32_t rx_period, uint32_t sleep_period);
869
881uint8_t sx1268_set_cad(sx1268_handle_t *handle);
882
895
908
922
935uint8_t sx1268_set_calibration(sx1268_handle_t *handle, uint8_t settings);
936
950uint8_t sx1268_set_calibration_image(sx1268_handle_t *handle, uint8_t freq1, uint8_t freq2);
951
965uint8_t sx1268_set_pa_config(sx1268_handle_t *handle, uint8_t pa_duty_cycle, uint8_t hp_max);
966
980
996uint8_t sx1268_set_dio_irq_params(sx1268_handle_t *handle, uint16_t irq_mask, uint16_t dio1_mask,
997 uint16_t dio2_mask, uint16_t dio3_mask);
998
1011uint8_t sx1268_get_irq_status(sx1268_handle_t *handle, uint16_t *status);
1012
1025uint8_t sx1268_clear_irq_status(sx1268_handle_t *handle, uint16_t clear_irq_param);
1026
1040
1054uint8_t sx1268_set_dio3_as_tcxo_ctrl(sx1268_handle_t *handle, sx1268_tcxo_voltage_t voltage, uint32_t delay);
1055
1067uint8_t sx1268_frequency_convert_to_register(sx1268_handle_t *handle, uint32_t freq, uint32_t *reg);
1068
1080uint8_t sx1268_frequency_convert_to_data(sx1268_handle_t *handle, uint32_t reg, uint32_t *freq);
1081
1094uint8_t sx1268_set_rf_frequency(sx1268_handle_t *handle, uint32_t reg);
1095
1109
1123
1137uint8_t sx1268_set_tx_params(sx1268_handle_t *handle, int8_t dbm, sx1268_ramp_time_t t);
1138
1155 sx1268_gfsk_bandwidth_t bw, uint32_t fdev);
1156
1168uint8_t sx1268_gfsk_bit_rate_convert_to_register(sx1268_handle_t *handle, uint32_t br, uint32_t *reg);
1169
1181uint8_t sx1268_gfsk_bit_rate_convert_to_data(sx1268_handle_t *handle, uint32_t reg, uint32_t *br);
1182
1194uint8_t sx1268_gfsk_frequency_deviation_convert_to_register(sx1268_handle_t *handle, uint32_t freq, uint32_t *reg);
1195
1207uint8_t sx1268_gfsk_frequency_deviation_convert_to_data(sx1268_handle_t *handle, uint32_t reg, uint32_t *freq);
1208
1225 sx1268_lora_cr_t cr, sx1268_bool_t low_data_rate_optimize_enable);
1226
1247uint8_t sx1268_set_gfsk_packet_params(sx1268_handle_t *handle, uint16_t preamble_length,
1249 uint8_t sync_word_length, sx1268_gfsk_addr_filter_t filter,
1250 sx1268_gfsk_packet_type_t packet_type, uint8_t payload_length,
1251 sx1268_gfsk_crc_type_t crc_type, sx1268_bool_t whitening_enable);
1252
1269uint8_t sx1268_set_lora_packet_params(sx1268_handle_t *handle, uint16_t preamble_length,
1270 sx1268_lora_header_t header_type, uint8_t payload_length,
1271 sx1268_lora_crc_type_t crc_type, sx1268_bool_t invert_iq_enable);
1272
1290 uint8_t cad_det_peak, uint8_t cad_det_min, sx1268_lora_cad_exit_mode_t mode,
1291 uint32_t timeout);
1292
1306uint8_t sx1268_set_buffer_base_address(sx1268_handle_t *handle, uint8_t tx_base_addr, uint8_t rx_base_addr);
1307
1320uint8_t sx1268_set_lora_symb_num_timeout(sx1268_handle_t *handle, uint8_t symb_num);
1321
1334uint8_t sx1268_get_status(sx1268_handle_t *handle, uint8_t *status);
1335
1349uint8_t sx1268_get_rx_buffer_status(sx1268_handle_t *handle, uint8_t *payload_length_rx, uint8_t *rx_start_buffer_pointer);
1350
1367uint8_t sx1268_get_gfsk_packet_status(sx1268_handle_t *handle, uint8_t *rx_status, uint8_t *rssi_sync_raw,
1368 uint8_t *rssi_avg_raw, float *rssi_sync, float *rssi_avg);
1369
1387uint8_t sx1268_get_lora_packet_status(sx1268_handle_t *handle, uint8_t *rssi_pkt_raw, int8_t *snr_pkt_raw,
1388 uint8_t *signal_rssi_pkt_raw, float *rssi_pkt, float *snr_pkt, float *signal_rssi_pkt);
1389
1403uint8_t sx1268_get_instantaneous_rssi(sx1268_handle_t *handle, uint8_t *rssi_inst_raw, float *rssi_inst);
1404
1419uint8_t sx1268_get_stats(sx1268_handle_t *handle, uint16_t *pkt_received, uint16_t *pkt_crc_error, uint16_t *pkt_length_header_error);
1420
1435uint8_t sx1268_reset_stats(sx1268_handle_t *handle, uint16_t pkt_received, uint16_t pkt_crc_error, uint16_t pkt_length_header_error);
1436
1449uint8_t sx1268_get_device_errors(sx1268_handle_t *handle, uint16_t *op_error);
1450
1463
1467
1474
1487uint8_t sx1268_set_fsk_whitening_initial_value(sx1268_handle_t *handle, uint16_t value);
1488
1501uint8_t sx1268_get_fsk_whitening_initial_value(sx1268_handle_t *handle, uint16_t *value);
1502
1515uint8_t sx1268_set_fsk_crc_initical_value(sx1268_handle_t *handle, uint16_t value);
1516
1529uint8_t sx1268_get_fsk_crc_initical_value(sx1268_handle_t *handle, uint16_t *value);
1530
1543uint8_t sx1268_set_fsk_crc_polynomial_value(sx1268_handle_t *handle, uint16_t value);
1544
1557uint8_t sx1268_get_fsk_crc_polynomial_value(sx1268_handle_t *handle, uint16_t *value);
1558
1571uint8_t sx1268_set_fsk_sync_word(sx1268_handle_t *handle, uint8_t sync_word[8]);
1572
1585uint8_t sx1268_get_fsk_sync_word(sx1268_handle_t *handle, uint8_t sync_word[8]);
1586
1599uint8_t sx1268_set_fsk_node_address(sx1268_handle_t *handle, uint8_t addr);
1600
1613uint8_t sx1268_get_fsk_node_address(sx1268_handle_t *handle, uint8_t *addr);
1614
1627uint8_t sx1268_set_fsk_broadcast_address(sx1268_handle_t *handle, uint8_t addr);
1628
1641uint8_t sx1268_get_fsk_broadcast_address(sx1268_handle_t *handle, uint8_t *addr);
1642
1655uint8_t sx1268_set_iq_polarity(sx1268_handle_t *handle, uint8_t setup);
1656
1669uint8_t sx1268_get_iq_polarity(sx1268_handle_t *handle, uint8_t *setup);
1670
1683uint8_t sx1268_set_lora_sync_word(sx1268_handle_t *handle, uint16_t sync_word);
1684
1697uint8_t sx1268_get_lora_sync_word(sx1268_handle_t *handle, uint16_t *sync_word);
1698
1711uint8_t sx1268_get_random_number(sx1268_handle_t *handle, uint32_t *r);
1712
1725uint8_t sx1268_set_tx_modulation(sx1268_handle_t *handle, uint8_t modulation);
1726
1739uint8_t sx1268_get_tx_modulation(sx1268_handle_t *handle, uint8_t *modulation);
1740
1753uint8_t sx1268_set_rx_gain(sx1268_handle_t *handle, uint8_t gain);
1754
1767uint8_t sx1268_get_rx_gain(sx1268_handle_t *handle, uint8_t *gain);
1768
1781uint8_t sx1268_set_tx_clamp_config(sx1268_handle_t *handle, uint8_t config);
1782
1795uint8_t sx1268_get_tx_clamp_config(sx1268_handle_t *handle, uint8_t *config);
1796
1809uint8_t sx1268_set_ocp(sx1268_handle_t *handle, uint8_t ocp);
1810
1823uint8_t sx1268_get_ocp(sx1268_handle_t *handle, uint8_t *ocp);
1824
1837uint8_t sx1268_set_rtc_control(sx1268_handle_t *handle, uint8_t control);
1838
1851uint8_t sx1268_get_rtc_control(sx1268_handle_t *handle, uint8_t *control);
1852
1865uint8_t sx1268_set_xta_trim(sx1268_handle_t *handle, uint8_t trim);
1866
1879uint8_t sx1268_get_xta_trim(sx1268_handle_t *handle, uint8_t *trim);
1880
1893uint8_t sx1268_set_xtb_trim(sx1268_handle_t *handle, uint8_t trim);
1894
1907uint8_t sx1268_get_xtb_trim(sx1268_handle_t *handle, uint8_t *trim);
1908
1921uint8_t sx1268_set_dio3_output_control(sx1268_handle_t *handle, uint8_t control);
1922
1935uint8_t sx1268_get_dio3_output_control(sx1268_handle_t *handle, uint8_t *control);
1936
1949uint8_t sx1268_set_event_mask(sx1268_handle_t *handle, uint8_t mask);
1950
1963uint8_t sx1268_get_event_mask(sx1268_handle_t *handle, uint8_t *mask);
1964
1977uint8_t sx1268_set_dio_output_enable(sx1268_handle_t *handle, uint8_t enable);
1978
1991uint8_t sx1268_get_dio_output_enable(sx1268_handle_t *handle, uint8_t *enable);
1992
2005uint8_t sx1268_set_dio_input_enable(sx1268_handle_t *handle, uint8_t enable);
2006
2019uint8_t sx1268_get_dio_input_enable(sx1268_handle_t *handle, uint8_t *enable);
2020
2033uint8_t sx1268_set_pull_up_control(sx1268_handle_t *handle, uint8_t control);
2034
2047uint8_t sx1268_get_pull_up_control(sx1268_handle_t *handle, uint8_t *control);
2048
2061uint8_t sx1268_set_pull_down_control(sx1268_handle_t *handle, uint8_t control);
2062
2075uint8_t sx1268_get_pull_down_control(sx1268_handle_t *handle, uint8_t *control);
2076
2080
2087
2102uint8_t sx1268_write_read_reg(sx1268_handle_t *handle, uint8_t *in_buf, uint32_t in_len,
2103 uint8_t *out_buf, uint32_t out_len);
2104
2108
2112
2113#ifdef __cplusplus
2114}
2115#endif
2116
2117#endif
uint8_t sx1268_lora_transmit(sx1268_handle_t *handle, sx1268_clock_source_t standby_src, uint16_t preamble_length, sx1268_lora_header_t header_type, sx1268_lora_crc_type_t crc_type, sx1268_bool_t invert_iq_enable, uint8_t *buf, uint16_t len, uint32_t us)
send the lora data
uint8_t sx1268_get_gfsk_packet_status(sx1268_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
sx1268_lora_sf_t
sx1268 lora spreading factor enumeration definition
sx1268_tcxo_voltage_t
sx1268 tcxo voltage enumeration definition
uint8_t sx1268_set_rx(sx1268_handle_t *handle, uint32_t timeout)
enter to the rx mode
uint8_t sx1268_gfsk_bit_rate_convert_to_data(sx1268_handle_t *handle, uint32_t reg, uint32_t *br)
convert the register raw data to the bit rate
sx1268_op_error_t
sx1268 op error enumeration definition
uint8_t sx1268_frequency_convert_to_data(sx1268_handle_t *handle, uint32_t reg, uint32_t *freq)
convert the register raw data to the frequency
uint8_t sx1268_get_packet_type(sx1268_handle_t *handle, sx1268_packet_type_t *type)
get the packet type
uint8_t sx1268_init(sx1268_handle_t *handle)
initialize the chip
uint8_t sx1268_clear_device_errors(sx1268_handle_t *handle)
clear the device errors
uint8_t sx1268_timeout_convert_to_register(sx1268_handle_t *handle, double us, uint32_t *reg)
convert the timeout to the register raw data
uint8_t sx1268_get_irq_status(sx1268_handle_t *handle, uint16_t *status)
get the irq status
uint8_t sx1268_set_cad(sx1268_handle_t *handle)
run the cad
uint8_t sx1268_set_rx_tx_fallback_mode(sx1268_handle_t *handle, sx1268_rx_tx_fallback_mode_t mode)
set the rx tx fallback mode
uint8_t sx1268_read_buffer(sx1268_handle_t *handle, uint8_t offset, uint8_t *buf, uint16_t len)
read the buffer
sx1268_bool_t
sx1268 bool enumeration definition
struct sx1268_handle_s sx1268_handle_t
sx1268 handle structure definition
uint8_t sx1268_get_device_errors(sx1268_handle_t *handle, uint16_t *op_error)
get the device errors
uint8_t sx1268_get_status(sx1268_handle_t *handle, uint8_t *status)
get the status
uint8_t sx1268_single_receive(sx1268_handle_t *handle, double us)
enter to the single receive mode
sx1268_start_mode_t
sx1268 start mode enumeration definition
sx1268_gfsk_preamble_detector_length_t
sx1268 gfsk preamble detector length enumeration definition
uint8_t sx1268_lora_cad(sx1268_handle_t *handle, sx1268_bool_t *enable)
run the cad
sx1268_lora_crc_type_t
sx1268 lora crc type enumeration definition
uint8_t sx1268_clear_irq_status(sx1268_handle_t *handle, uint16_t clear_irq_param)
clear the irq status
uint8_t sx1268_set_cad_params(sx1268_handle_t *handle, sx1268_lora_cad_symbol_num_t num, uint8_t cad_det_peak, uint8_t cad_det_min, sx1268_lora_cad_exit_mode_t mode, uint32_t timeout)
set the cad params
uint8_t sx1268_set_standby(sx1268_handle_t *handle, sx1268_clock_source_t src)
enter to the standby mode
sx1268_regulator_mode_t
sx1268 regulator mode enumeration definition
uint8_t sx1268_write_register(sx1268_handle_t *handle, uint16_t reg, uint8_t *buf, uint16_t len)
write the register
uint8_t sx1268_check_packet_error(sx1268_handle_t *handle, sx1268_bool_t *enable)
check the packet error
uint8_t sx1268_set_rx_duty_cycle(sx1268_handle_t *handle, uint32_t rx_period, uint32_t sleep_period)
set the rx duty cycle
sx1268_clock_source_t
sx1268 clock source enumeration definition
uint8_t sx1268_set_frequency_synthesis(sx1268_handle_t *handle)
enter to the frequency synthesis mode
sx1268_gfsk_crc_type_t
sx1268 gfsk crc type enumeration definition
uint8_t sx1268_set_tx_params(sx1268_handle_t *handle, int8_t dbm, sx1268_ramp_time_t t)
set the tx params
uint8_t sx1268_set_lora_symb_num_timeout(sx1268_handle_t *handle, uint8_t symb_num)
set the lora symbol number timeout
uint8_t sx1268_read_register(sx1268_handle_t *handle, uint16_t reg, uint8_t *buf, uint16_t len)
read the register
uint8_t sx1268_set_calibration_image(sx1268_handle_t *handle, uint8_t freq1, uint8_t freq2)
set the calibration image frequency
uint8_t sx1268_get_stats(sx1268_handle_t *handle, uint16_t *pkt_received, uint16_t *pkt_crc_error, uint16_t *pkt_length_header_error)
get the stats
sx1268_lora_cad_symbol_num_t
sx1268 lora cad symbol num enumeration definition
uint8_t sx1268_set_gfsk_modulation_params(sx1268_handle_t *handle, uint32_t br, sx1268_gfsk_pulse_shape_t shape, sx1268_gfsk_bandwidth_t bw, uint32_t fdev)
set the modulation params in GFSK mode
struct sx1268_info_s sx1268_info_t
sx1268 information structure definition
uint8_t sx1268_set_tx(sx1268_handle_t *handle, uint32_t timeout)
enter to the tx mode
uint8_t sx1268_timeout_convert_to_data(sx1268_handle_t *handle, uint32_t reg, double *us)
convert the register raw data to the timeout
uint8_t sx1268_frequency_convert_to_register(sx1268_handle_t *handle, uint32_t freq, uint32_t *reg)
convert the frequency to the register raw data
sx1268_gfsk_pulse_shape_t
sx1268 gfsk pulse shape enumeration definition
sx1268_ramp_time_t
sx1268 ramp time enumeration definition
uint8_t sx1268_set_sleep(sx1268_handle_t *handle, sx1268_start_mode_t mode, sx1268_bool_t rtc_wake_up_enable)
enter to the sleep mode
uint8_t sx1268_set_lora_modulation_params(sx1268_handle_t *handle, sx1268_lora_sf_t sf, sx1268_lora_bandwidth_t bw, sx1268_lora_cr_t cr, sx1268_bool_t low_data_rate_optimize_enable)
set the modulation params in LoRa mode
uint8_t sx1268_gfsk_frequency_deviation_convert_to_data(sx1268_handle_t *handle, uint32_t reg, uint32_t *freq)
convert the register raw data to the frequency deviation
sx1268_gfsk_packet_type_t
sx1268 gfsk packet type enumeration definition
sx1268_gfsk_addr_filter_t
sx1268 gfsk addr filter enumeration definition
uint8_t sx1268_info(sx1268_info_t *info)
get chip's information
uint8_t sx1268_set_dio3_as_tcxo_ctrl(sx1268_handle_t *handle, sx1268_tcxo_voltage_t voltage, uint32_t delay)
set dio3 as tcxo ctrl
uint8_t sx1268_set_stop_timer_on_preamble(sx1268_handle_t *handle, sx1268_bool_t enable)
stop timer on preamble
uint8_t sx1268_set_regulator_mode(sx1268_handle_t *handle, sx1268_regulator_mode_t mode)
set the regulator_mode
uint8_t sx1268_irq_handler(sx1268_handle_t *handle)
irq handler
uint8_t sx1268_get_instantaneous_rssi(sx1268_handle_t *handle, uint8_t *rssi_inst_raw, float *rssi_inst)
get the instantaneous rssi
uint8_t sx1268_set_dio_irq_params(sx1268_handle_t *handle, uint16_t irq_mask, uint16_t dio1_mask, uint16_t dio2_mask, uint16_t dio3_mask)
set the dio irq params
sx1268_lora_bandwidth_t
sx1268 lora bandwidth enumeration definition
sx1268_lora_cr_t
sx1268 lora coding rate enumeration definition
uint8_t sx1268_set_gfsk_packet_params(sx1268_handle_t *handle, uint16_t preamble_length, sx1268_gfsk_preamble_detector_length_t detector_length, uint8_t sync_word_length, sx1268_gfsk_addr_filter_t filter, sx1268_gfsk_packet_type_t packet_type, uint8_t payload_length, sx1268_gfsk_crc_type_t crc_type, sx1268_bool_t whitening_enable)
set the packet params in GFSK mode
uint8_t sx1268_set_dio2_as_rf_switch_ctrl(sx1268_handle_t *handle, sx1268_bool_t enable)
set dio2 as rf switch ctrl
uint8_t sx1268_reset_stats(sx1268_handle_t *handle, uint16_t pkt_received, uint16_t pkt_crc_error, uint16_t pkt_length_header_error)
reset the stats
sx1268_packet_type_t
sx1268 packet type enumeration definition
uint8_t sx1268_set_calibration(sx1268_handle_t *handle, uint8_t settings)
set the calibration settings
uint8_t sx1268_set_rf_frequency(sx1268_handle_t *handle, uint32_t reg)
set the rf frequency
sx1268_rx_tx_fallback_mode_t
sx1268 rx tx fallback mode enumeration definition
uint8_t sx1268_get_lora_packet_status(sx1268_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
sx1268_calibration_t
sx1268 calibration enumeration definition
uint8_t sx1268_continuous_receive(sx1268_handle_t *handle)
enter to the continuous receive mode
sx1268_gfsk_bandwidth_t
sx1268 gfsk bandwidth enumeration definition
sx1268_fsk_rx_status_t
sx1268 fsk rx status enumeration definition
uint8_t sx1268_set_tx_continuous_wave(sx1268_handle_t *handle)
enter to the tx continuous wave mode
uint8_t sx1268_gfsk_bit_rate_convert_to_register(sx1268_handle_t *handle, uint32_t br, uint32_t *reg)
convert the bit rate to the register raw data
uint8_t sx1268_gfsk_frequency_deviation_convert_to_register(sx1268_handle_t *handle, uint32_t freq, uint32_t *reg)
convert the frequency deviation to the register raw data
uint8_t sx1268_deinit(sx1268_handle_t *handle)
close the chip
uint8_t sx1268_set_tx_infinite_preamble(sx1268_handle_t *handle)
enter to the tx infinite preamble mode
uint8_t sx1268_set_lora_packet_params(sx1268_handle_t *handle, uint16_t preamble_length, sx1268_lora_header_t header_type, uint8_t payload_length, sx1268_lora_crc_type_t crc_type, sx1268_bool_t invert_iq_enable)
set the packet params in LoRa mode
uint8_t sx1268_set_buffer_base_address(sx1268_handle_t *handle, uint8_t tx_base_addr, uint8_t rx_base_addr)
set the buffer base address
uint8_t sx1268_set_pa_config(sx1268_handle_t *handle, uint8_t pa_duty_cycle, uint8_t hp_max)
set the pa config
uint8_t sx1268_write_buffer(sx1268_handle_t *handle, uint8_t offset, uint8_t *buf, uint16_t len)
write the buffer
sx1268_irq_t
sx1268 irq enumeration definition
uint8_t sx1268_get_rx_buffer_status(sx1268_handle_t *handle, uint8_t *payload_length_rx, uint8_t *rx_start_buffer_pointer)
get the rx buffer status
sx1268_lora_cad_exit_mode_t
sx1268 lora cad exit mode enumeration definition
uint8_t sx1268_set_packet_type(sx1268_handle_t *handle, sx1268_packet_type_t type)
set the packet type
sx1268_lora_header_t
sx1268 lora header enumeration definition
@ SX1268_LORA_SF_5
@ SX1268_LORA_SF_7
@ SX1268_LORA_SF_11
@ SX1268_LORA_SF_8
@ SX1268_LORA_SF_9
@ SX1268_LORA_SF_12
@ SX1268_LORA_SF_6
@ SX1268_LORA_SF_10
@ SX1268_TCXO_VOLTAGE_2P4V
@ SX1268_TCXO_VOLTAGE_3P0V
@ SX1268_TCXO_VOLTAGE_1P7V
@ SX1268_TCXO_VOLTAGE_2P2V
@ SX1268_TCXO_VOLTAGE_3P3V
@ SX1268_TCXO_VOLTAGE_2P7V
@ SX1268_TCXO_VOLTAGE_1P8V
@ SX1268_TCXO_VOLTAGE_1P6V
@ SX1268_OP_ERROR_XOSC_START_ERR
@ SX1268_OP_ERROR_ADC_CALIB_ERR
@ SX1268_OP_ERROR_PLL_CALIB_ERR
@ SX1268_OP_ERROR_RC64K_CALIB_ERR
@ SX1268_OP_ERROR_PA_RAMP_ERR
@ SX1268_OP_ERROR_IMG_CALIB_ERR
@ SX1268_OP_ERROR_PLL_LOCK_ERR
@ SX1268_OP_ERROR_RC13M_CALIB_ERR
@ SX1268_BOOL_TRUE
@ SX1268_BOOL_FALSE
@ SX1268_START_MODE_COLD
@ SX1268_START_MODE_WARM
@ SX1268_GFSK_PREAMBLE_DETECTOR_LENGTH_16_BITS
@ SX1268_GFSK_PREAMBLE_DETECTOR_LENGTH_32_BITS
@ SX1268_GFSK_PREAMBLE_DETECTOR_LENGTH_8_BITS
@ SX1268_GFSK_PREAMBLE_DETECTOR_LENGTH_OFF
@ SX1268_GFSK_PREAMBLE_DETECTOR_LENGTH_24_BITS
@ SX1268_LORA_CRC_TYPE_ON
@ SX1268_LORA_CRC_TYPE_OFF
@ SX1268_REGULATOR_MODE_ONLY_LDO
@ SX1268_REGULATOR_MODE_DC_DC_LDO
@ SX1268_CLOCK_SOURCE_XTAL_32MHZ
@ SX1268_CLOCK_SOURCE_RC_13M
@ SX1268_GFSK_CRC_TYPE_2_BYTE
@ SX1268_GFSK_CRC_TYPE_2_BYTE_INV
@ SX1268_GFSK_CRC_TYPE_OFF
@ SX1268_GFSK_CRC_TYPE_1_BYTE
@ SX1268_GFSK_CRC_TYPE_1_BYTE_INV
@ SX1268_LORA_CAD_SYMBOL_NUM_1
@ SX1268_LORA_CAD_SYMBOL_NUM_4
@ SX1268_LORA_CAD_SYMBOL_NUM_16
@ SX1268_LORA_CAD_SYMBOL_NUM_8
@ SX1268_LORA_CAD_SYMBOL_NUM_2
@ SX1268_GFSK_PULSE_SHAPE_GAUSSIAN_BT_0P3
@ SX1268_GFSK_PULSE_SHAPE_NO_FILTER
@ SX1268_GFSK_PULSE_SHAPE_GAUSSIAN_BT_0P7
@ SX1268_GFSK_PULSE_SHAPE_GAUSSIAN_BT_1
@ SX1268_GFSK_PULSE_SHAPE_GAUSSIAN_BT_0P5
@ SX1268_RAMP_TIME_1700US
@ SX1268_RAMP_TIME_3400US
@ SX1268_RAMP_TIME_10US
@ SX1268_RAMP_TIME_800US
@ SX1268_RAMP_TIME_200US
@ SX1268_RAMP_TIME_20US
@ SX1268_RAMP_TIME_40US
@ SX1268_RAMP_TIME_80US
@ SX1268_GFSK_PACKET_TYPE_KNOWN_LENGTH
@ SX1268_GFSK_PACKET_TYPE_VARIABLE_SIZE
@ SX1268_GFSK_ADDR_FILTER_DISABLE
@ SX1268_GFSK_ADDR_FILTER_ACTIVATED_NODE_ADDR
@ SX1268_GFSK_ADDR_FILTER_ACTIVATED_NODE_BROADCAST_ADDR
@ SX1268_LORA_BANDWIDTH_15P63_KHZ
@ SX1268_LORA_BANDWIDTH_62P50_KHZ
@ SX1268_LORA_BANDWIDTH_7P81_KHZ
@ SX1268_LORA_BANDWIDTH_31P25_KHZ
@ SX1268_LORA_BANDWIDTH_500_KHZ
@ SX1268_LORA_BANDWIDTH_20P83_KHZ
@ SX1268_LORA_BANDWIDTH_125_KHZ
@ SX1268_LORA_BANDWIDTH_250_KHZ
@ SX1268_LORA_BANDWIDTH_41P67_KHZ
@ SX1268_LORA_BANDWIDTH_10P42_KHZ
@ SX1268_LORA_CR_4_8
@ SX1268_LORA_CR_4_7
@ SX1268_LORA_CR_4_6
@ SX1268_LORA_CR_4_5
@ SX1268_PACKET_TYPE_LORA
@ SX1268_PACKET_TYPE_GFSK
@ SX1268_RX_TX_FALLBACK_MODE_STDBY_RC
@ SX1268_RX_TX_FALLBACK_MODE_STDBY_XOSC
@ SX1268_RX_TX_FALLBACK_MODE_FS
@ SX1268_CALIBRATION_ADC_BULK_P
@ SX1268_CALIBRATION_ADC_BULK_N
@ SX1268_CALIBRATION_ADC_PULSE
@ SX1268_CALIBRATION_RC64K
@ SX1268_CALIBRATION_RC13M
@ SX1268_CALIBRATION_IMAGE
@ SX1268_CALIBRATION_PLL
@ SX1268_GFSK_BANDWIDTH_4P8_KHZ
@ SX1268_GFSK_BANDWIDTH_7P3_KHZ
@ SX1268_GFSK_BANDWIDTH_46P9_KHZ
@ SX1268_GFSK_BANDWIDTH_9P7_KHZ
@ SX1268_GFSK_BANDWIDTH_232P3_KHZ
@ SX1268_GFSK_BANDWIDTH_29P3_KHZ
@ SX1268_GFSK_BANDWIDTH_467_KHZ
@ SX1268_GFSK_BANDWIDTH_14P6_KHZ
@ SX1268_GFSK_BANDWIDTH_23P4_KHZ
@ SX1268_GFSK_BANDWIDTH_312_KHZ
@ SX1268_GFSK_BANDWIDTH_156P2_KHZ
@ SX1268_GFSK_BANDWIDTH_58P6_KHZ
@ SX1268_GFSK_BANDWIDTH_373P6_KHZ
@ SX1268_GFSK_BANDWIDTH_78P2_KHZ
@ SX1268_GFSK_BANDWIDTH_11P7_KHZ
@ SX1268_GFSK_BANDWIDTH_187P2_KHZ
@ SX1268_GFSK_BANDWIDTH_5P8_KHZ
@ SX1268_GFSK_BANDWIDTH_19P5_KHZ
@ SX1268_GFSK_BANDWIDTH_93P8_KHZ
@ SX1268_GFSK_BANDWIDTH_117P3_KHZ
@ SX1268_GFSK_BANDWIDTH_39_KHZ
@ SX1268_FSK_RX_STATUS_PKT_RECEIVED
@ SX1268_FSK_RX_STATUS_PKT_SEND
@ SX1268_FSK_RX_STATUS_SYNC_ERR
@ SX1268_FSK_RX_STATUS_LENGTH_ERR
@ SX1268_FSK_RX_STATUS_PREAMBLE_ERR
@ SX1268_FSK_RX_STATUS_ABORT_ERR
@ SX1268_FSK_RX_STATUS_CRC_ERR
@ SX1268_FSK_RX_STATUS_ADDR_ERR
@ SX1268_IRQ_CRC_ERR
@ SX1268_IRQ_PREAMBLE_DETECTED
@ SX1268_IRQ_RX_DONE
@ SX1268_IRQ_HEADER_ERR
@ SX1268_IRQ_HEADER_VALID
@ SX1268_IRQ_CAD_DETECTED
@ SX1268_IRQ_SYNC_WORD_VALID
@ SX1268_IRQ_TIMEOUT
@ SX1268_IRQ_CAD_DONE
@ SX1268_IRQ_TX_DONE
@ SX1268_LORA_CAD_EXIT_MODE_ONLY
@ SX1268_LORA_CAD_EXIT_MODE_RX
@ SX1268_LORA_HEADER_EXPLICIT
@ SX1268_LORA_HEADER_IMPLICIT
uint8_t sx1268_write_read_reg(sx1268_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 sx1268_get_tx_modulation(sx1268_handle_t *handle, uint8_t *modulation)
get the tx modulation
uint8_t sx1268_set_tx_modulation(sx1268_handle_t *handle, uint8_t modulation)
set the tx modulation
uint8_t sx1268_get_fsk_crc_polynomial_value(sx1268_handle_t *handle, uint16_t *value)
get the crc polynomial value in FSK mode
uint8_t sx1268_set_event_mask(sx1268_handle_t *handle, uint8_t mask)
set the event mask
uint8_t sx1268_get_ocp(sx1268_handle_t *handle, uint8_t *ocp)
get the ocp
uint8_t sx1268_get_pull_down_control(sx1268_handle_t *handle, uint8_t *control)
get the pull down control
uint8_t sx1268_set_xta_trim(sx1268_handle_t *handle, uint8_t trim)
set the xta trim
uint8_t sx1268_get_xta_trim(sx1268_handle_t *handle, uint8_t *trim)
get the xta trim
uint8_t sx1268_get_fsk_whitening_initial_value(sx1268_handle_t *handle, uint16_t *value)
get the whitening initial value in FSK mode
uint8_t sx1268_get_fsk_crc_initical_value(sx1268_handle_t *handle, uint16_t *value)
get the crc initical value in FSK mode
uint8_t sx1268_get_fsk_node_address(sx1268_handle_t *handle, uint8_t *addr)
get the node address in FSK mode
uint8_t sx1268_set_lora_sync_word(sx1268_handle_t *handle, uint16_t sync_word)
set the lora sync word
uint8_t sx1268_set_fsk_node_address(sx1268_handle_t *handle, uint8_t addr)
set the node address in FSK mode
uint8_t sx1268_set_rtc_control(sx1268_handle_t *handle, uint8_t control)
set the rtc control
uint8_t sx1268_set_ocp(sx1268_handle_t *handle, uint8_t ocp)
set the ocp
uint8_t sx1268_get_pull_up_control(sx1268_handle_t *handle, uint8_t *control)
get the pull up control
uint8_t sx1268_get_event_mask(sx1268_handle_t *handle, uint8_t *mask)
get the event mask
uint8_t sx1268_set_fsk_whitening_initial_value(sx1268_handle_t *handle, uint16_t value)
set the whitening initial value in FSK mode
uint8_t sx1268_set_fsk_broadcast_address(sx1268_handle_t *handle, uint8_t addr)
set the broadcast address in FSK mode
uint8_t sx1268_set_dio_input_enable(sx1268_handle_t *handle, uint8_t enable)
set the dio input enable
uint8_t sx1268_set_fsk_crc_polynomial_value(sx1268_handle_t *handle, uint16_t value)
set the crc polynomial value in FSK mode
uint8_t sx1268_get_random_number(sx1268_handle_t *handle, uint32_t *r)
get the random number
uint8_t sx1268_get_fsk_broadcast_address(sx1268_handle_t *handle, uint8_t *addr)
get the broadcast address in FSK mode
uint8_t sx1268_get_xtb_trim(sx1268_handle_t *handle, uint8_t *trim)
get the xtb trim
uint8_t sx1268_get_rx_gain(sx1268_handle_t *handle, uint8_t *gain)
get the rx gain
uint8_t sx1268_set_dio3_output_control(sx1268_handle_t *handle, uint8_t control)
set the dio3 output
uint8_t sx1268_set_tx_clamp_config(sx1268_handle_t *handle, uint8_t config)
set the tx clamp config
uint8_t sx1268_set_iq_polarity(sx1268_handle_t *handle, uint8_t setup)
set the iq polarity
uint8_t sx1268_get_dio_output_enable(sx1268_handle_t *handle, uint8_t *enable)
get the dio output enable
uint8_t sx1268_get_tx_clamp_config(sx1268_handle_t *handle, uint8_t *config)
get the tx clamp config
uint8_t sx1268_set_rx_gain(sx1268_handle_t *handle, uint8_t gain)
set the rx gain
uint8_t sx1268_get_iq_polarity(sx1268_handle_t *handle, uint8_t *setup)
get the iq polarity
uint8_t sx1268_set_fsk_sync_word(sx1268_handle_t *handle, uint8_t sync_word[8])
set the sync word in FSK mode
uint8_t sx1268_set_pull_up_control(sx1268_handle_t *handle, uint8_t control)
set the pull up control
uint8_t sx1268_get_fsk_sync_word(sx1268_handle_t *handle, uint8_t sync_word[8])
get the sync word in FSK mode
uint8_t sx1268_get_dio_input_enable(sx1268_handle_t *handle, uint8_t *enable)
get the dio input enable
uint8_t sx1268_set_xtb_trim(sx1268_handle_t *handle, uint8_t trim)
set the xtb trim
uint8_t sx1268_set_fsk_crc_initical_value(sx1268_handle_t *handle, uint16_t value)
set the crc initial value in FSK mode
uint8_t sx1268_set_dio_output_enable(sx1268_handle_t *handle, uint8_t enable)
set the dio output enable
uint8_t sx1268_get_rtc_control(sx1268_handle_t *handle, uint8_t *control)
get the rtc control
uint8_t sx1268_get_lora_sync_word(sx1268_handle_t *handle, uint16_t *sync_word)
get the lora sync word
uint8_t sx1268_get_dio3_output_control(sx1268_handle_t *handle, uint8_t *control)
get the dio3 output
uint8_t sx1268_set_pull_down_control(sx1268_handle_t *handle, uint8_t control)
set the pull down control
sx1268 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)
sx1268 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]