|
|
|
@ -63,6 +63,7 @@ esp_err_t sx127x_init(const sx127x_config_t *config, sx127x_t **handle_ptr) {
@@ -63,6 +63,7 @@ esp_err_t sx127x_init(const sx127x_config_t *config, sx127x_t **handle_ptr) {
|
|
|
|
|
SX127X_CHECK(hndl != NULL, "malloc error", ESP_ERR_NO_MEM); |
|
|
|
|
*handle_ptr = hndl; |
|
|
|
|
|
|
|
|
|
hndl->spi_mutex = xSemaphoreCreateMutex(); |
|
|
|
|
hndl->task_handle = NULL; |
|
|
|
|
atomic_init(&hndl->task_state, SX127X_TASK_STOPPED); |
|
|
|
|
memcpy(&hndl->config, config, sizeof(sx127x_config_t)); |
|
|
|
@ -76,8 +77,6 @@ esp_err_t sx127x_init(const sx127x_config_t *config, sx127x_t **handle_ptr) {
@@ -76,8 +77,6 @@ esp_err_t sx127x_init(const sx127x_config_t *config, sx127x_t **handle_ptr) {
|
|
|
|
|
gpio_set_level(config->rst_io_num, 1); |
|
|
|
|
vTaskDelay(SX127X_RESET_DELAY); |
|
|
|
|
|
|
|
|
|
hndl->spi_mutex = xSemaphoreCreateMutex(); |
|
|
|
|
|
|
|
|
|
spi_bus_config_t bus_config = { |
|
|
|
|
.mosi_io_num = config->mosi_io_num, |
|
|
|
|
.miso_io_num = config->miso_io_num, |
|
|
|
|