Api Symbols: replace asserts with checks (#3507)

* Api Symbols: replace asserts with checks
* Api Symbols: replace asserts with checks part 2
* Update no args function signatures with void, to help compiler to track incorrect usage
* More unavoidable void
* Update PVS config and code to make it happy
* Format sources
* nfc: fix checks
* dead code cleanup & include fixes

Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: hedger <hedger@users.noreply.github.com>
Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
あく
2024-03-19 23:43:52 +09:00
committed by GitHub
parent a09ec4d976
commit acc39a4bc0
571 changed files with 3565 additions and 2704 deletions

View File

@@ -93,7 +93,7 @@ typedef struct {
static SubGhzDeviceCC1101Ext* subghz_device_cc1101_ext = NULL;
static bool subghz_device_cc1101_ext_check_init() {
static bool subghz_device_cc1101_ext_check_init(void) {
furi_assert(subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateInit);
subghz_device_cc1101_ext->state = SubGhzDeviceCC1101ExtStateIdle;
@@ -198,7 +198,7 @@ static bool subghz_device_cc1101_ext_check_init() {
return ret;
}
bool subghz_device_cc1101_ext_alloc() {
bool subghz_device_cc1101_ext_alloc(void) {
furi_assert(subghz_device_cc1101_ext == NULL);
subghz_device_cc1101_ext = malloc(sizeof(SubGhzDeviceCC1101Ext));
subghz_device_cc1101_ext->state = SubGhzDeviceCC1101ExtStateInit;
@@ -213,7 +213,7 @@ bool subghz_device_cc1101_ext_alloc() {
return subghz_device_cc1101_ext_check_init();
}
void subghz_device_cc1101_ext_free() {
void subghz_device_cc1101_ext_free(void) {
furi_assert(subghz_device_cc1101_ext != NULL);
furi_hal_spi_bus_handle_deinit(subghz_device_cc1101_ext->spi_bus_handle);
free(subghz_device_cc1101_ext);
@@ -224,11 +224,11 @@ void subghz_device_cc1101_ext_set_async_mirror_pin(const GpioPin* pin) {
subghz_device_cc1101_ext->async_mirror_pin = pin;
}
const GpioPin* subghz_device_cc1101_ext_get_data_gpio() {
const GpioPin* subghz_device_cc1101_ext_get_data_gpio(void) {
return subghz_device_cc1101_ext->g0_pin;
}
bool subghz_device_cc1101_ext_is_connect() {
bool subghz_device_cc1101_ext_is_connect(void) {
bool ret = false;
if(subghz_device_cc1101_ext == NULL) { // not initialized
@@ -244,7 +244,7 @@ bool subghz_device_cc1101_ext_is_connect() {
return ret;
}
void subghz_device_cc1101_ext_sleep() {
void subghz_device_cc1101_ext_sleep(void) {
furi_assert(subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateIdle);
furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle);
@@ -259,7 +259,7 @@ void subghz_device_cc1101_ext_sleep() {
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
}
void subghz_device_cc1101_ext_dump_state() {
void subghz_device_cc1101_ext_dump_state(void) {
furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle);
printf(
"[subghz_device_cc1101_ext] cc1101 chip %d, version %d\r\n",
@@ -324,19 +324,19 @@ void subghz_device_cc1101_ext_write_packet(const uint8_t* data, uint8_t size) {
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
}
void subghz_device_cc1101_ext_flush_rx() {
void subghz_device_cc1101_ext_flush_rx(void) {
furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle);
cc1101_flush_rx(subghz_device_cc1101_ext->spi_bus_handle);
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
}
void subghz_device_cc1101_ext_flush_tx() {
void subghz_device_cc1101_ext_flush_tx(void) {
furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle);
cc1101_flush_tx(subghz_device_cc1101_ext->spi_bus_handle);
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
}
bool subghz_device_cc1101_ext_rx_pipe_not_empty() {
bool subghz_device_cc1101_ext_rx_pipe_not_empty(void) {
CC1101RxBytes status[1];
furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle);
cc1101_read_reg(
@@ -351,7 +351,7 @@ bool subghz_device_cc1101_ext_rx_pipe_not_empty() {
}
}
bool subghz_device_cc1101_ext_is_rx_data_crc_valid() {
bool subghz_device_cc1101_ext_is_rx_data_crc_valid(void) {
furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle);
uint8_t data[1];
cc1101_read_reg(
@@ -370,14 +370,14 @@ void subghz_device_cc1101_ext_read_packet(uint8_t* data, uint8_t* size) {
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
}
void subghz_device_cc1101_ext_shutdown() {
void subghz_device_cc1101_ext_shutdown(void) {
furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle);
// Reset and shutdown
cc1101_shutdown(subghz_device_cc1101_ext->spi_bus_handle);
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
}
void subghz_device_cc1101_ext_reset() {
void subghz_device_cc1101_ext_reset(void) {
furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle);
furi_hal_gpio_init(subghz_device_cc1101_ext->g0_pin, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
cc1101_switch_to_idle(subghz_device_cc1101_ext->spi_bus_handle);
@@ -388,7 +388,7 @@ void subghz_device_cc1101_ext_reset() {
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
}
void subghz_device_cc1101_ext_idle() {
void subghz_device_cc1101_ext_idle(void) {
furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle);
cc1101_switch_to_idle(subghz_device_cc1101_ext->spi_bus_handle);
//waiting for the chip to switch to IDLE mode
@@ -397,7 +397,7 @@ void subghz_device_cc1101_ext_idle() {
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
}
void subghz_device_cc1101_ext_rx() {
void subghz_device_cc1101_ext_rx(void) {
furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle);
cc1101_switch_to_rx(subghz_device_cc1101_ext->spi_bus_handle);
//waiting for the chip to switch to Rx mode
@@ -406,7 +406,7 @@ void subghz_device_cc1101_ext_rx() {
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
}
bool subghz_device_cc1101_ext_tx() {
bool subghz_device_cc1101_ext_tx(void) {
if(subghz_device_cc1101_ext->regulation != SubGhzDeviceCC1101ExtRegulationTxRx) return false;
furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle);
cc1101_switch_to_tx(subghz_device_cc1101_ext->spi_bus_handle);
@@ -417,7 +417,7 @@ bool subghz_device_cc1101_ext_tx() {
return true;
}
float subghz_device_cc1101_ext_get_rssi() {
float subghz_device_cc1101_ext_get_rssi(void) {
furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle);
int32_t rssi_dec = cc1101_get_rssi(subghz_device_cc1101_ext->spi_bus_handle);
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
@@ -432,7 +432,7 @@ float subghz_device_cc1101_ext_get_rssi() {
return rssi;
}
uint8_t subghz_device_cc1101_ext_get_lqi() {
uint8_t subghz_device_cc1101_ext_get_lqi(void) {
furi_hal_spi_acquire(subghz_device_cc1101_ext->spi_bus_handle);
uint8_t data[1];
cc1101_read_reg(
@@ -472,7 +472,7 @@ uint32_t subghz_device_cc1101_ext_set_frequency(uint32_t value) {
return real_frequency;
}
static bool subghz_device_cc1101_ext_start_debug() {
static bool subghz_device_cc1101_ext_start_debug(void) {
bool ret = false;
if(subghz_device_cc1101_ext->async_mirror_pin != NULL) {
furi_hal_gpio_init(
@@ -485,7 +485,7 @@ static bool subghz_device_cc1101_ext_start_debug() {
return ret;
}
static bool subghz_device_cc1101_ext_stop_debug() {
static bool subghz_device_cc1101_ext_stop_debug(void) {
bool ret = false;
if(subghz_device_cc1101_ext->async_mirror_pin != NULL) {
furi_hal_gpio_init(
@@ -567,7 +567,7 @@ void subghz_device_cc1101_ext_start_async_rx(
subghz_device_cc1101_ext->async_rx.capture_delta_duration = 0;
}
void subghz_device_cc1101_ext_stop_async_rx() {
void subghz_device_cc1101_ext_stop_async_rx(void) {
furi_assert(subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateAsyncRx);
subghz_device_cc1101_ext->state = SubGhzDeviceCC1101ExtStateIdle;
@@ -805,13 +805,13 @@ bool subghz_device_cc1101_ext_start_async_tx(SubGhzDeviceCC1101ExtCallback callb
return true;
}
bool subghz_device_cc1101_ext_is_async_tx_complete() {
bool subghz_device_cc1101_ext_is_async_tx_complete(void) {
return (
(subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateAsyncTx) &&
(LL_TIM_GetAutoReload(TIM17) == 0));
}
void subghz_device_cc1101_ext_stop_async_tx() {
void subghz_device_cc1101_ext_stop_async_tx(void) {
furi_assert(subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateAsyncTx);
// Shutdown radio