Api Symbols: replace asserts with checks

merge ofw commit
This commit is contained in:
MX
2024-03-25 13:53:32 +03:00
parent 81a16e5a28
commit 585b7f963d
565 changed files with 3544 additions and 2691 deletions

View File

@@ -98,7 +98,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;
@@ -232,7 +232,7 @@ bool subghz_device_cc1101_ext_alloc(SubGhzDeviceConf* conf) {
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);
@@ -248,11 +248,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
@@ -268,7 +268,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);
@@ -283,7 +283,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",
@@ -348,19 +348,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(
@@ -376,7 +376,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(
@@ -395,14 +395,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);
@@ -413,7 +413,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
@@ -425,7 +425,7 @@ void subghz_device_cc1101_ext_idle() {
}
}
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
@@ -437,7 +437,7 @@ void subghz_device_cc1101_ext_rx() {
}
}
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);
@@ -451,7 +451,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);
@@ -466,7 +466,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(
@@ -525,7 +525,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(
@@ -538,7 +538,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(
@@ -620,7 +620,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;
@@ -858,13 +858,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

View File

@@ -29,7 +29,7 @@ void subghz_device_cc1101_ext_set_async_mirror_pin(const GpioPin* pin);
*
* @return pointer to the gpio pin structure
*/
const GpioPin* subghz_device_cc1101_ext_get_data_gpio();
const GpioPin* subghz_device_cc1101_ext_get_data_gpio(void);
/** Initialize device
*
@@ -39,21 +39,21 @@ bool subghz_device_cc1101_ext_alloc(SubGhzDeviceConf* conf);
/** Deinitialize device
*/
void subghz_device_cc1101_ext_free();
void subghz_device_cc1101_ext_free(void);
/** Check and switch to power save mode Used by internal API-HAL
* initialization routine Can be used to reinitialize device to safe state and
* send it to sleep
*/
bool subghz_device_cc1101_ext_is_connect();
bool subghz_device_cc1101_ext_is_connect(void);
/** Send device to sleep mode
*/
void subghz_device_cc1101_ext_sleep();
void subghz_device_cc1101_ext_sleep(void);
/** Dump info to stdout
*/
void subghz_device_cc1101_ext_dump_state();
void subghz_device_cc1101_ext_dump_state(void);
/** Load custom registers from preset
*
@@ -84,13 +84,13 @@ void subghz_device_cc1101_ext_write_packet(const uint8_t* data, uint8_t size);
*
* @return true if not empty
*/
bool subghz_device_cc1101_ext_rx_pipe_not_empty();
bool subghz_device_cc1101_ext_rx_pipe_not_empty(void);
/** Check if received data crc is valid
*
* @return true if valid
*/
bool subghz_device_cc1101_ext_is_rx_data_crc_valid();
bool subghz_device_cc1101_ext_is_rx_data_crc_valid(void);
/** Read packet from FIFO
*
@@ -101,47 +101,47 @@ void subghz_device_cc1101_ext_read_packet(uint8_t* data, uint8_t* size);
/** Flush rx FIFO buffer
*/
void subghz_device_cc1101_ext_flush_rx();
void subghz_device_cc1101_ext_flush_rx(void);
/** Flush tx FIFO buffer
*/
void subghz_device_cc1101_ext_flush_tx();
void subghz_device_cc1101_ext_flush_tx(void);
/** Shutdown Issue SPWD command
* @warning registers content will be lost
*/
void subghz_device_cc1101_ext_shutdown();
void subghz_device_cc1101_ext_shutdown(void);
/** Reset Issue reset command
* @warning registers content will be lost
*/
void subghz_device_cc1101_ext_reset();
void subghz_device_cc1101_ext_reset(void);
/** Switch to Idle
*/
void subghz_device_cc1101_ext_idle();
void subghz_device_cc1101_ext_idle(void);
/** Switch to Receive
*/
void subghz_device_cc1101_ext_rx();
void subghz_device_cc1101_ext_rx(void);
/** Switch to Transmit
*
* @return true if the transfer is allowed by belonging to the region
*/
bool subghz_device_cc1101_ext_tx();
bool subghz_device_cc1101_ext_tx(void);
/** Get RSSI value in dBm
*
* @return RSSI value
*/
float subghz_device_cc1101_ext_get_rssi();
float subghz_device_cc1101_ext_get_rssi(void);
/** Get LQI
*
* @return LQI value
*/
uint8_t subghz_device_cc1101_ext_get_lqi();
uint8_t subghz_device_cc1101_ext_get_lqi(void);
/** Check if frequency is in valid range
*
@@ -175,7 +175,7 @@ void subghz_device_cc1101_ext_start_async_rx(
/** Disable signal timings capture Resets GPIO and TIM2
*/
void subghz_device_cc1101_ext_stop_async_rx();
void subghz_device_cc1101_ext_stop_async_rx(void);
/** Async TX callback type
* @param context callback context
@@ -196,11 +196,11 @@ bool subghz_device_cc1101_ext_start_async_tx(SubGhzDeviceCC1101ExtCallback callb
*
* @return true if TX complete
*/
bool subghz_device_cc1101_ext_is_async_tx_complete();
bool subghz_device_cc1101_ext_is_async_tx_complete(void);
/** Stop async transmission and cleanup resources Resets GPIO, TIM2, and DMA1
*/
void subghz_device_cc1101_ext_stop_async_tx();
void subghz_device_cc1101_ext_stop_async_tx(void);
#ifdef __cplusplus
}

View File

@@ -105,6 +105,6 @@ static const FlipperAppPluginDescriptor subghz_device_cc1101_ext_descriptor = {
.entry_point = &subghz_device_cc1101_ext,
};
const FlipperAppPluginDescriptor* subghz_device_cc1101_ext_ep() {
const FlipperAppPluginDescriptor* subghz_device_cc1101_ext_ep(void) {
return &subghz_device_cc1101_ext_descriptor;
}

View File

@@ -5,4 +5,4 @@
typedef struct SubGhzDeviceCC1101Ext SubGhzDeviceCC1101Ext;
const FlipperAppPluginDescriptor* subghz_device_cc1101_ext_ep();
const FlipperAppPluginDescriptor* subghz_device_cc1101_ext_ep(void);