Skip to content

Commit

Permalink
fix some code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
dernasherbrezon committed Nov 3, 2024
1 parent 3f575c2 commit 2f7ccb0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions include/sx127x.h
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ int sx127x_lora_tx_set_for_transmission(const uint8_t *data, uint8_t data_length
* - SX127X_ERR_INVALID_ARG if parameter is invalid
* - SX127X_OK on success
*/
int sx127x_fsk_ook_tx_set_for_transmission(uint8_t *data, uint16_t data_length, sx127x *device);
int sx127x_fsk_ook_tx_set_for_transmission(const uint8_t *data, uint16_t data_length, sx127x *device);

/**
* @brief Write packet into sx127x's FIFO for transmittion. Once packet is written, set opmod to TX.
Expand All @@ -698,7 +698,7 @@ int sx127x_fsk_ook_tx_set_for_transmission(uint8_t *data, uint16_t data_length,
* - SX127X_ERR_INVALID_ARG if parameter is invalid
* - SX127X_OK on success
*/
int sx127x_fsk_ook_tx_set_for_transmission_with_address(uint8_t *data, uint16_t data_length, uint8_t address_to, sx127x *device);
int sx127x_fsk_ook_tx_set_for_transmission_with_address(const uint8_t *data, uint16_t data_length, uint8_t address_to, sx127x *device);

/**
* @brief Start transmitting periodic beacon using FSK/OOK modulation. Packet format must be configured as SX127X_FIXED.
Expand All @@ -712,7 +712,7 @@ int sx127x_fsk_ook_tx_set_for_transmission_with_address(uint8_t *data, uint16_t
* - SX127X_ERR_INVALID_STATE if configured packet format is not SX127X_FIXED or selected modem is not FSK/OOK
* - SX127X_OK on success
*/
int sx127x_fsk_ook_tx_start_beacon(uint8_t *data, uint8_t data_length, uint32_t interval_ms, sx127x *device);
int sx127x_fsk_ook_tx_start_beacon(const uint8_t *data, uint8_t data_length, uint32_t interval_ms, sx127x *device);

/**
* @brief Stop transmitting periodic beacon.
Expand Down Expand Up @@ -764,7 +764,7 @@ int sx127x_fsk_set_fdev(float frequency_deviation, sx127x *device);
* - SX127X_ERR_INVALID_ARG if parameter is invalid
* - SX127X_OK on success
*/
int sx127x_fsk_ook_set_syncword(uint8_t *syncword, uint8_t syncword_length, sx127x *device);
int sx127x_fsk_ook_set_syncword(const uint8_t *syncword, uint8_t syncword_length, sx127x *device);

/**
* @brief Set data whitening or scrambling is widely used for randomizing the user data before radio transmission. Scrambling can improve bit synchronizer accuracy.
Expand Down
8 changes: 4 additions & 4 deletions src/sx127x.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ int sx127x_fsk_ook_tx_set_for_transmission_with_remaining(uint16_t data_length,
return sx127x_shadow_spi_write_buffer(REGFIFO, device->packet, to_send, &device->spi_device);
}

int sx127x_fsk_ook_tx_set_for_transmission(uint8_t *data, uint16_t data_length, sx127x *device) {
int sx127x_fsk_ook_tx_set_for_transmission(const uint8_t *data, uint16_t data_length, sx127x *device) {
CHECK_FSK_OOK_MODULATION(device);
if (device->fsk_ook_format == SX127X_VARIABLE && data_length > MAX_PACKET_SIZE) {
return SX127X_ERR_INVALID_ARG;
Expand All @@ -941,7 +941,7 @@ int sx127x_fsk_ook_tx_set_for_transmission(uint8_t *data, uint16_t data_length,
return sx127x_fsk_ook_tx_set_for_transmission_with_remaining(data_length, device);
}

int sx127x_fsk_ook_tx_set_for_transmission_with_address(uint8_t *data, uint16_t data_length, uint8_t address_to, sx127x *device) {
int sx127x_fsk_ook_tx_set_for_transmission_with_address(const uint8_t *data, uint16_t data_length, uint8_t address_to, sx127x *device) {
CHECK_FSK_OOK_MODULATION(device);
if (device->fsk_ook_format == SX127X_VARIABLE && data_length > (MAX_PACKET_SIZE - 1)) {
return SX127X_ERR_INVALID_ARG;
Expand All @@ -962,7 +962,7 @@ int sx127x_fsk_ook_tx_set_for_transmission_with_address(uint8_t *data, uint16_t
return sx127x_fsk_ook_tx_set_for_transmission_with_remaining(packet_length, device);
}

int sx127x_fsk_ook_tx_start_beacon(uint8_t *data, uint8_t data_length, uint32_t interval_ms, sx127x *device) {
int sx127x_fsk_ook_tx_start_beacon(const uint8_t *data, uint8_t data_length, uint32_t interval_ms, sx127x *device) {
CHECK_FSK_OOK_MODULATION(device);
if (device->fsk_ook_format != SX127X_FIXED) {
return SX127X_ERR_INVALID_STATE;
Expand Down Expand Up @@ -1161,7 +1161,7 @@ int sx127x_fsk_ook_rx_set_trigger(sx127x_rx_trigger_t trigger, sx127x *device) {
return sx127x_append_register(REGRXCONFIG, trigger, 0b11111000, &device->spi_device);
}

int sx127x_fsk_ook_set_syncword(uint8_t *syncword, uint8_t syncword_length, sx127x *device) {
int sx127x_fsk_ook_set_syncword(const uint8_t *syncword, uint8_t syncword_length, sx127x *device) {
CHECK_FSK_OOK_MODULATION(device);
if (syncword_length == 0 || syncword_length > 8) {
return SX127X_ERR_INVALID_ARG;
Expand Down

0 comments on commit 2f7ccb0

Please sign in to comment.