diff options
author | あく <alleteam@gmail.com> | 2021-10-04 10:01:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-04 10:01:41 +0300 |
commit | 832fb1b795ddb4ca15068bc090b1db86ae984aba (patch) | |
tree | 2bee727385468034072feeddebd47c648174675c /applications/subghz | |
parent | a7edebce69039ba65b31a18b57062c29bc39c867 (diff) |
[FL-1228] FuriHal: add charge suppress API. (#743)
* FuriHal: add charge suppress API.
* FuriHal: add guards to insomnia and charge suppress routines.
* FuriHal: proper API for scheduler in power.
* FuriHal: move charging control from critical section, fix deadlock.
* Gui: use FreeRTOS native timers controls for IconAnimation, fix crash on animation start stop
Diffstat (limited to 'applications/subghz')
-rw-r--r-- | applications/subghz/subghz.c | 4 | ||||
-rw-r--r-- | applications/subghz/subghz_cli.c | 17 |
2 files changed, 21 insertions, 0 deletions
diff --git a/applications/subghz/subghz.c b/applications/subghz/subghz.c index 02da799d..38145697 100644 --- a/applications/subghz/subghz.c +++ b/applications/subghz/subghz.c @@ -260,8 +260,12 @@ int32_t subghz_app(void* p) { scene_manager_next_scene(subghz->scene_manager, SubGhzSceneStart); } + furi_hal_power_suppress_charge_enter(); + view_dispatcher_run(subghz->view_dispatcher); + furi_hal_power_suppress_charge_exit(); + subghz_free(subghz); return 0; diff --git a/applications/subghz/subghz_cli.c b/applications/subghz/subghz_cli.c index 1a33beab..94c2cd03 100644 --- a/applications/subghz/subghz_cli.c +++ b/applications/subghz/subghz_cli.c @@ -48,6 +48,8 @@ void subghz_cli_command_tx_carrier(Cli* cli, string_t args, void* context) { hal_gpio_init(&gpio_cc1101_g0, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow); hal_gpio_write(&gpio_cc1101_g0, true); + furi_hal_power_suppress_charge_enter(); + if(furi_hal_subghz_tx()) { printf("Transmitting at frequency %lu Hz\r\n", frequency); printf("Press CTRL+C to stop\r\n"); @@ -60,6 +62,8 @@ void subghz_cli_command_tx_carrier(Cli* cli, string_t args, void* context) { furi_hal_subghz_set_path(FuriHalSubGhzPathIsolate); furi_hal_subghz_sleep(); + + furi_hal_power_suppress_charge_exit(); } void subghz_cli_command_rx_carrier(Cli* cli, string_t args, void* context) { @@ -86,6 +90,8 @@ void subghz_cli_command_rx_carrier(Cli* cli, string_t args, void* context) { printf("Receiving at frequency %lu Hz\r\n", frequency); printf("Press CTRL+C to stop\r\n"); + furi_hal_power_suppress_charge_enter(); + furi_hal_subghz_rx(); while(!cli_cmd_interrupt_received(cli)) { @@ -94,6 +100,8 @@ void subghz_cli_command_rx_carrier(Cli* cli, string_t args, void* context) { fflush(stdout); } + furi_hal_power_suppress_charge_exit(); + furi_hal_subghz_set_path(FuriHalSubGhzPathIsolate); furi_hal_subghz_sleep(); } @@ -143,6 +151,9 @@ void subghz_cli_command_tx(Cli* cli, string_t args, void* context) { furi_hal_subghz_reset(); furi_hal_subghz_load_preset(FuriHalSubGhzPresetOok650Async); frequency = furi_hal_subghz_set_frequency_and_path(frequency); + + furi_hal_power_suppress_charge_enter(); + furi_hal_subghz_start_async_tx(subghz_protocol_encoder_common_yield, encoder); while(!(furi_hal_subghz_is_async_tx_complete() || cli_cmd_interrupt_received(cli))) { @@ -153,6 +164,8 @@ void subghz_cli_command_tx(Cli* cli, string_t args, void* context) { furi_hal_subghz_stop_async_tx(); furi_hal_subghz_sleep(); + furi_hal_power_suppress_charge_exit(); + subghz_decoder_princeton_free(protocol); subghz_protocol_encoder_common_free(encoder); } @@ -218,6 +231,8 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) { frequency = furi_hal_subghz_set_frequency_and_path(frequency); hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow); + furi_hal_power_suppress_charge_enter(); + // Prepare and start RX furi_hal_subghz_start_async_rx(subghz_cli_command_rx_callback, instance); @@ -243,6 +258,8 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) { furi_hal_subghz_stop_async_rx(); furi_hal_subghz_sleep(); + furi_hal_power_suppress_charge_exit(); + printf("\r\nPackets recieved %u\r\n", instance->packet_count); // Cleanup |