Browse Source

fix stack smashing issue

ugv_io
Alex Mikhalev 6 years ago
parent
commit
ff669ed8e6
  1. 2
      components/sx127x_driver/sx127x_driver.c
  2. 8
      components/sx127x_driver/sx127x_registers.c
  3. 2
      components/sx127x_driver/sx127x_registers.h

2
components/sx127x_driver/sx127x_driver.c

@ -146,7 +146,7 @@ esp_err_t sx127x_free(sx127x_t *handle) { @@ -146,7 +146,7 @@ esp_err_t sx127x_free(sx127x_t *handle) {
void IRAM_ATTR sx127x_isr(void *arg) {
sx127x_t *handle = (sx127x_t *)arg;
ESP_LOGV(SX127X_TAG, "sx127x_isr");
ESP_LOGI(SX127X_TAG, "sx127x_isr");
BaseType_t hpTaskWoken;
xSemaphoreGiveFromISR(handle->intr_semaphore, &hpTaskWoken);
if (hpTaskWoken) {

8
components/sx127x_driver/sx127x_registers.c

@ -204,14 +204,16 @@ esp_err_t sx127x_set_crc(sx127x_t *handle, sx127x_crc_t crc) { @@ -204,14 +204,16 @@ esp_err_t sx127x_set_crc(sx127x_t *handle, sx127x_crc_t crc) {
return ESP_OK;
}
esp_err_t sx127x_write_fifo(sx127x_t *handle, char *data, size_t data_len) {
esp_err_t sx127x_write_fifo(sx127x_t *handle, const char *data,
size_t data_len) {
spi_transaction_t trans;
memset(&trans, 0, sizeof(trans));
trans.flags = SPI_TRANS_USE_RXDATA;
trans.flags = 0;
trans.addr = REG_FIFO;
trans.length = 8 * data_len;
trans.rxlength = 0;
trans.tx_buffer = data;
trans.rxlength = 0;
trans.rx_buffer = NULL;
esp_err_t ret = spi_device_transmit(handle->device_handle, &trans);
SX127X_ERROR_CHECK2(ret, spi_device_transmit);

2
components/sx127x_driver/sx127x_registers.h

@ -26,6 +26,6 @@ esp_err_t sx127x_set_sync_word(sx127x_t *handle, uint8_t sync_word); @@ -26,6 +26,6 @@ esp_err_t sx127x_set_sync_word(sx127x_t *handle, uint8_t sync_word);
esp_err_t sx127x_set_crc(sx127x_t *handle, sx127x_crc_t crc);
esp_err_t sx127x_write_fifo(sx127x_t *handle, char *data, size_t data_len);
esp_err_t sx127x_write_fifo(sx127x_t *handle, const char *data, size_t data_len);
esp_err_t sx127x_read_fifo(sx127x_t *handle, char *data_out,
size_t *data_len_out);

Loading…
Cancel
Save