Skip to content

Commit

Permalink
fix compilation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dernasherbrezon committed Feb 8, 2024
1 parent 2011ff1 commit 17c90a6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/sx127x.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions include/sx127x_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion src/sx127x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/sx127x_esp_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/sx127x_linux_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 17c90a6

Please sign in to comment.