mirror of
https://github.com/flipperdevices/flipperzero-firmware.git
synced 2025-12-12 12:51:22 +04:00
Status output !TX/RX on the GDO2 CC1101 pin (#3571)
* Status output !TX/RX on the GDO2 CC1101 pin\ * Fix PVS warnings Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -177,6 +177,14 @@ static bool subghz_device_cc1101_ext_check_init(void) {
|
|||||||
furi_hal_gpio_init(
|
furi_hal_gpio_init(
|
||||||
subghz_device_cc1101_ext->g0_pin, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
|
subghz_device_cc1101_ext->g0_pin, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
|
||||||
|
|
||||||
|
// Reset GDO2 (!TX/RX) to floating state
|
||||||
|
cc1101_status = cc1101_write_reg(
|
||||||
|
subghz_device_cc1101_ext->spi_bus_handle, CC1101_IOCFG2, CC1101IocfgHighImpedance);
|
||||||
|
if(cc1101_status.CHIP_RDYn != 0) {
|
||||||
|
//timeout or error
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Go to sleep
|
// Go to sleep
|
||||||
cc1101_status = cc1101_shutdown(subghz_device_cc1101_ext->spi_bus_handle);
|
cc1101_status = cc1101_shutdown(subghz_device_cc1101_ext->spi_bus_handle);
|
||||||
if(cc1101_status.CHIP_RDYn != 0) {
|
if(cc1101_status.CHIP_RDYn != 0) {
|
||||||
@@ -385,6 +393,9 @@ void subghz_device_cc1101_ext_reset(void) {
|
|||||||
// Warning: push pull cc1101 clock output on GD0
|
// Warning: push pull cc1101 clock output on GD0
|
||||||
cc1101_write_reg(
|
cc1101_write_reg(
|
||||||
subghz_device_cc1101_ext->spi_bus_handle, CC1101_IOCFG0, CC1101IocfgHighImpedance);
|
subghz_device_cc1101_ext->spi_bus_handle, CC1101_IOCFG0, CC1101IocfgHighImpedance);
|
||||||
|
// Reset GDO2 (!TX/RX) to floating state
|
||||||
|
cc1101_write_reg(
|
||||||
|
subghz_device_cc1101_ext->spi_bus_handle, CC1101_IOCFG2, CC1101IocfgHighImpedance);
|
||||||
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
|
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,6 +405,9 @@ void subghz_device_cc1101_ext_idle(void) {
|
|||||||
//waiting for the chip to switch to IDLE mode
|
//waiting for the chip to switch to IDLE mode
|
||||||
furi_check(cc1101_wait_status_state(
|
furi_check(cc1101_wait_status_state(
|
||||||
subghz_device_cc1101_ext->spi_bus_handle, CC1101StateIDLE, 10000));
|
subghz_device_cc1101_ext->spi_bus_handle, CC1101StateIDLE, 10000));
|
||||||
|
// Reset GDO2 (!TX/RX) to floating state
|
||||||
|
cc1101_write_reg(
|
||||||
|
subghz_device_cc1101_ext->spi_bus_handle, CC1101_IOCFG2, CC1101IocfgHighImpedance);
|
||||||
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
|
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,6 +417,10 @@ void subghz_device_cc1101_ext_rx(void) {
|
|||||||
//waiting for the chip to switch to Rx mode
|
//waiting for the chip to switch to Rx mode
|
||||||
furi_check(
|
furi_check(
|
||||||
cc1101_wait_status_state(subghz_device_cc1101_ext->spi_bus_handle, CC1101StateRX, 10000));
|
cc1101_wait_status_state(subghz_device_cc1101_ext->spi_bus_handle, CC1101StateRX, 10000));
|
||||||
|
// Go GDO2 (!TX/RX) to high (RX state)
|
||||||
|
cc1101_write_reg(
|
||||||
|
subghz_device_cc1101_ext->spi_bus_handle, CC1101_IOCFG2, CC1101IocfgHW | CC1101_IOCFG_INV);
|
||||||
|
|
||||||
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
|
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,6 +431,8 @@ bool subghz_device_cc1101_ext_tx(void) {
|
|||||||
//waiting for the chip to switch to Tx mode
|
//waiting for the chip to switch to Tx mode
|
||||||
furi_check(
|
furi_check(
|
||||||
cc1101_wait_status_state(subghz_device_cc1101_ext->spi_bus_handle, CC1101StateTX, 10000));
|
cc1101_wait_status_state(subghz_device_cc1101_ext->spi_bus_handle, CC1101StateTX, 10000));
|
||||||
|
// Go GDO2 (!TX/RX) to low (TX state)
|
||||||
|
cc1101_write_reg(subghz_device_cc1101_ext->spi_bus_handle, CC1101_IOCFG2, CC1101IocfgHW);
|
||||||
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
|
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ void loader_start_detached_with_gui_error(Loader* loader, const char* name, cons
|
|||||||
|
|
||||||
LoaderMessage message = {
|
LoaderMessage message = {
|
||||||
.type = LoaderMessageTypeStartByNameDetachedWithGuiError,
|
.type = LoaderMessageTypeStartByNameDetachedWithGuiError,
|
||||||
.start.name = name ? strdup(name) : NULL,
|
.start.name = strdup(name),
|
||||||
.start.args = args ? strdup(args) : NULL,
|
.start.args = args ? strdup(args) : NULL,
|
||||||
};
|
};
|
||||||
furi_message_queue_put(loader->queue, &message, FuriWaitForever);
|
furi_message_queue_put(loader->queue, &message, FuriWaitForever);
|
||||||
|
|||||||
Reference in New Issue
Block a user