diff --git a/include/sx127x.h b/include/sx127x.h index 9e772d7..913a02b 100644 --- a/include/sx127x.h +++ b/include/sx127x.h @@ -602,7 +602,7 @@ void sx127x_tx_set_callback(void (*tx_callback)(sx127x *), sx127x *device); * - SX127X_ERR_INVALID_ARG if parameter is invalid * - SX127X_OK on success */ -int sx127x_lora_tx_set_for_transmission(uint8_t *data, uint8_t data_length, sx127x *device); +int sx127x_lora_tx_set_for_transmission(const uint8_t *data, uint8_t data_length, sx127x *device); /** * @brief Write packet into sx127x's FIFO for transmittion. Once packet is written, set opmod to TX. diff --git a/include/sx127x_spi.h b/include/sx127x_spi.h index 978fa4c..ff57166 100644 --- a/include/sx127x_spi.h +++ b/include/sx127x_spi.h @@ -58,7 +58,7 @@ int sx127x_spi_read_buffer(int reg, uint8_t *buffer, size_t buffer_length, void * - SX127X_ERR_INVALID_ARG if parameter is invalid * - SX127X_OK on success */ -int sx127x_spi_write_register(int reg, uint8_t *data, size_t data_length, void *spi_device); +int sx127x_spi_write_register(int reg, const uint8_t *data, size_t data_length, void *spi_device); /** * @brief Write data_length bytes into the register @@ -71,7 +71,7 @@ int sx127x_spi_write_register(int reg, uint8_t *data, size_t data_length, void * * - SX127X_ERR_INVALID_ARG if parameter is invalid * - SX127X_OK on success */ -int sx127x_spi_write_buffer(int reg, uint8_t *buffer, size_t buffer_length, void *spi_device); +int sx127x_spi_write_buffer(int reg, const uint8_t *buffer, size_t buffer_length, void *spi_device); #ifdef __cplusplus } diff --git a/src/sx127x.c b/src/sx127x.c index 38a74e3..c839ad7 100644 --- a/src/sx127x.c +++ b/src/sx127x.c @@ -837,7 +837,7 @@ int sx127x_lora_tx_set_explicit_header(sx127x_tx_header_t *header, sx127x *devic return sx127x_append_register(REG_MODEM_CONFIG_2, value, 0b11111011, device->spi_device); } -int sx127x_lora_tx_set_for_transmission(uint8_t *data, uint8_t data_length, sx127x *device) { +int sx127x_lora_tx_set_for_transmission(const uint8_t *data, uint8_t data_length, sx127x *device) { CHECK_MODULATION(device, SX127x_MODULATION_LORA); // uint8_t can't be more than MAX_PACKET_SIZE if (data_length == 0) { diff --git a/src/sx127x_esp_spi.c b/src/sx127x_esp_spi.c index a5e0798..a648e81 100644 --- a/src/sx127x_esp_spi.c +++ b/src/sx127x_esp_spi.c @@ -48,7 +48,7 @@ int sx127x_spi_read_buffer(int reg, uint8_t *buffer, size_t buffer_length, void return spi_device_polling_transmit(spi_device, &t); } -int sx127x_spi_write_register(int reg, uint8_t *data, size_t data_length, void *spi_device) { +int sx127x_spi_write_register(int reg, const uint8_t *data, size_t data_length, void *spi_device) { if (data_length == 0 || data_length > 4) { return ESP_ERR_INVALID_ARG; } @@ -65,7 +65,7 @@ int sx127x_spi_write_register(int reg, uint8_t *data, size_t data_length, void * return spi_device_polling_transmit(spi_device, &t); } -int sx127x_spi_write_buffer(int reg, uint8_t *buffer, size_t buffer_length, void *spi_device) { +int sx127x_spi_write_buffer(int reg, const uint8_t *buffer, size_t buffer_length, void *spi_device) { spi_transaction_t t = { .addr = reg | 0x80, .rx_buffer = NULL, diff --git a/src/sx127x_linux_spi.c b/src/sx127x_linux_spi.c index 1de595f..c7b4c0f 100644 --- a/src/sx127x_linux_spi.c +++ b/src/sx127x_linux_spi.c @@ -52,7 +52,7 @@ int sx127x_spi_read_buffer(int reg, uint8_t *buffer, size_t buffer_length, void return 0; } -int sx127x_spi_write_register(int reg, uint8_t *data, size_t data_length, void *spi_device) { +int sx127x_spi_write_register(int reg, const uint8_t *data, size_t data_length, void *spi_device) { struct spi_ioc_transfer tr[2]; memset(&tr, 0, sizeof(tr)); reg = reg | 0x80; @@ -67,7 +67,7 @@ int sx127x_spi_write_register(int reg, uint8_t *data, size_t data_length, void * return 0; } -int sx127x_spi_write_buffer(int reg, uint8_t *buffer, size_t buffer_length, void *spi_device) { +int sx127x_spi_write_buffer(int reg, const uint8_t *buffer, size_t buffer_length, void *spi_device) { struct spi_ioc_transfer tr[2]; memset(&tr, 0, sizeof(tr)); reg = reg | 0x80;