You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
902 B
40 lines
902 B
#pragma once |
|
|
|
#include "driver/spi_master.h" |
|
|
|
const char *SX127X_TAG; |
|
|
|
#define SX127X_MAX_TRANSFER (1024) |
|
|
|
#define SX127X_CONFIG_DEFAULT \ |
|
sx127x_config_t \ |
|
{ \ |
|
.spi_host = VSPI_HOST, \ |
|
.mosi_io_num = 19, \ |
|
.miso_io_num = 27, \ |
|
.sck_io_num = 5, \ |
|
.cs_io_num = 18, \ |
|
.rst_io_num = 14, \ |
|
.irq_io_num = 26 \ |
|
} |
|
|
|
typedef struct sx127x_config |
|
{ |
|
spi_host_device_t spi_host; |
|
gpio_num_t mosi_io_num; |
|
gpio_num_t miso_io_num; |
|
gpio_num_t sck_io_num; |
|
gpio_num_t cs_io_num; |
|
gpio_num_t rst_io_num; |
|
gpio_num_t irq_io_num; |
|
} sx127x_config_t; |
|
|
|
typedef struct sx127x |
|
{ |
|
sx127x_config_t config; |
|
spi_device_handle_t device_handle; |
|
} sx127x_t; |
|
|
|
esp_err_t sx127x_init(sx127x_config_t *config, sx127x_t *handle); |
|
|
|
esp_err_t sx127x_free(sx127x_t *handle);
|
|
|