[FL-2399, FL-2261] Tickless sleep shenanigans (#1168)
* Disable USART in sleep * Restore UART state on suspend/resume * FuriHal: Enable stop mode and add insomnia to I2C and SPI * Remove IDLE interrupt * FuriHal: add FPU isr and disable all FPU interrupt, add core2 stop mode configuration on deep sleep * FuriHal: tie stop mode debug with debug rtc flag * FuriHal: adjust flash latency on clock switch, tie mcu debug with RTC debug flag * FuriHal: move resource init to early stage * Add EXTI pending check, enable debug traps with compile-time flag * Wrap sleep debug functions in conditional compilation * Remove erroneous changed * Do not use CSS, remove it from everywhere * Enable/disable USB on VBUS connect (prototype) * FuriHal: add LPMS and DEEPSLEEP magic, workaround state inconsistency between cores * FuriHal: honor c1 LMPS * USB mode switch fix * Applications: add flags and insomnia bypass system * Correct spelling * FuriHal: cleanup insomnia usage, reset sleep flags on wakeup, add shutdown api * FuriHal: extra check on reinit request * FuriHal: rename gpio_display_rst pin to gpio_display_rst_n * FuriHal: add debug HAL * FuriHal: add some magic to core2 reload procedure, fix issue with crash on ble keyboard exit * FuriHal: cleanup ble glue, add BLE_GLUE_DEBUG flag * FuriHal: ble reinit API, move os timer to LPTIM1 for deep sleep capability, shutdown that works * FuriHal: take insomnia while shutdown * Remove USB switch on/off on VBUS change * Better tick skew handling * Improve tick consistency under load * Add USB_HP dummy IRQ handler * Move interrupt check closer to sleep * Clean up includes * Re-enable Insomnia globally * FuriHal: enable CSS * FuriHal: remove questionable core2 clock shenanigans * FuriHal: use core1 RCC registers in idle timer config * FuriHal: return back CSS handlers, add lptim isr dispatching Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com> Co-authored-by: nminaylov <nm29719@gmail.com>
This commit is contained in:
@@ -32,7 +32,6 @@ void AccessorApp::run(void) {
|
||||
}
|
||||
|
||||
AccessorApp::AccessorApp() {
|
||||
furi_hal_power_insomnia_enter();
|
||||
notification = static_cast<NotificationApp*>(furi_record_open("notification"));
|
||||
onewire_host = onewire_host_alloc();
|
||||
furi_hal_power_enable_otg();
|
||||
@@ -42,7 +41,6 @@ AccessorApp::~AccessorApp() {
|
||||
furi_hal_power_disable_otg();
|
||||
furi_record_close("notification");
|
||||
onewire_host_free(onewire_host);
|
||||
furi_hal_power_insomnia_exit();
|
||||
}
|
||||
|
||||
AccessorAppViewManager* AccessorApp::get_view_manager() {
|
||||
@@ -139,4 +137,4 @@ WIEGAND* AccessorApp::get_wiegand() {
|
||||
|
||||
OneWireHost* AccessorApp::get_one_wire() {
|
||||
return onewire_host;
|
||||
}
|
||||
}
|
||||
|
@@ -74,61 +74,113 @@ extern int32_t system_settings_app(void* p);
|
||||
const FlipperApplication FLIPPER_SERVICES[] = {
|
||||
/* Services */
|
||||
#ifdef SRV_RPC
|
||||
{.app = rpc_srv, .name = "RpcSrv", .stack_size = 1024 * 4, .icon = NULL},
|
||||
{.app = rpc_srv,
|
||||
.name = "RpcSrv",
|
||||
.stack_size = 1024 * 4,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_BT
|
||||
{.app = bt_srv, .name = "BtSrv", .stack_size = 1024, .icon = NULL},
|
||||
{.app = bt_srv,
|
||||
.name = "BtSrv",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_CLI
|
||||
{.app = cli_srv, .name = "CliSrv", .stack_size = 4096, .icon = NULL},
|
||||
{.app = cli_srv,
|
||||
.name = "CliSrv",
|
||||
.stack_size = 4096,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_DIALOGS
|
||||
{.app = dialogs_srv, .name = "DialogsSrv", .stack_size = 1024, .icon = NULL},
|
||||
{.app = dialogs_srv,
|
||||
.name = "DialogsSrv",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_DOLPHIN
|
||||
{.app = dolphin_srv, .name = "DolphinSrv", .stack_size = 1024, .icon = NULL},
|
||||
{.app = dolphin_srv,
|
||||
.name = "DolphinSrv",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_DESKTOP
|
||||
#ifdef SRV_UPDATER
|
||||
#error SRV_UPDATER and SRV_DESKTOP are mutually exclusive!
|
||||
#endif
|
||||
{.app = desktop_srv, .name = "DesktopSrv", .stack_size = 2048, .icon = NULL},
|
||||
{.app = desktop_srv,
|
||||
.name = "DesktopSrv",
|
||||
.stack_size = 2048,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_GUI
|
||||
{.app = gui_srv, .name = "GuiSrv", .stack_size = 2048, .icon = NULL},
|
||||
{.app = gui_srv,
|
||||
.name = "GuiSrv",
|
||||
.stack_size = 2048,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_INPUT
|
||||
{.app = input_srv, .name = "InputSrv", .stack_size = 1024, .icon = NULL},
|
||||
{.app = input_srv,
|
||||
.name = "InputSrv",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_LOADER
|
||||
{.app = loader_srv, .name = "LoaderSrv", .stack_size = 1024, .icon = NULL},
|
||||
{.app = loader_srv,
|
||||
.name = "LoaderSrv",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_NOTIFICATION
|
||||
{.app = notification_srv, .name = "NotificationSrv", .stack_size = 1536, .icon = NULL},
|
||||
{.app = notification_srv,
|
||||
.name = "NotificationSrv",
|
||||
.stack_size = 1536,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_POWER
|
||||
{.app = power_srv, .name = "PowerSrv", .stack_size = 1024, .icon = NULL},
|
||||
{.app = power_srv,
|
||||
.name = "PowerSrv",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_STORAGE
|
||||
{.app = storage_srv, .name = "StorageSrv", .stack_size = 3072, .icon = NULL},
|
||||
{.app = storage_srv,
|
||||
.name = "StorageSrv",
|
||||
.stack_size = 3072,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_UPDATER
|
||||
#ifdef SRV_DESKTOP
|
||||
#error SRV_UPDATER and SRV_DESKTOP are mutually exclusive!
|
||||
#endif
|
||||
{.app = updater_srv, .name = "UpdaterSrv", .stack_size = 2048, .icon = NULL},
|
||||
{.app = updater_srv,
|
||||
.name = "UpdaterSrv",
|
||||
.stack_size = 2048,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -139,7 +191,11 @@ const FlipperApplication FLIPPER_SYSTEM_APPS[] = {
|
||||
#ifdef SRV_UPDATER
|
||||
#error APP_UPDATER and SRV_UPDATER are mutually exclusive!
|
||||
#endif
|
||||
{.app = updater_srv, .name = "UpdaterApp", .stack_size = 2048, .icon = NULL},
|
||||
{.app = updater_srv,
|
||||
.name = "UpdaterApp",
|
||||
.stack_size = 2048,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -149,35 +205,67 @@ const size_t FLIPPER_SYSTEM_APPS_COUNT = COUNT_OF(FLIPPER_SYSTEM_APPS);
|
||||
const FlipperApplication FLIPPER_APPS[] = {
|
||||
|
||||
#ifdef APP_SUBGHZ
|
||||
{.app = subghz_app, .name = "Sub-GHz", .stack_size = 2048, .icon = &A_Sub1ghz_14},
|
||||
{.app = subghz_app,
|
||||
.name = "Sub-GHz",
|
||||
.stack_size = 2048,
|
||||
.icon = &A_Sub1ghz_14,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_LF_RFID
|
||||
{.app = lfrfid_app, .name = "125 kHz RFID", .stack_size = 2048, .icon = &A_125khz_14},
|
||||
{.app = lfrfid_app,
|
||||
.name = "125 kHz RFID",
|
||||
.stack_size = 2048,
|
||||
.icon = &A_125khz_14,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_NFC
|
||||
{.app = nfc_app, .name = "NFC", .stack_size = 4096, .icon = &A_NFC_14},
|
||||
{.app = nfc_app,
|
||||
.name = "NFC",
|
||||
.stack_size = 4096,
|
||||
.icon = &A_NFC_14,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_INFRARED
|
||||
{.app = infrared_app, .name = "Infrared", .stack_size = 1024 * 3, .icon = &A_Infrared_14},
|
||||
{.app = infrared_app,
|
||||
.name = "Infrared",
|
||||
.stack_size = 1024 * 3,
|
||||
.icon = &A_Infrared_14,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_GPIO
|
||||
{.app = gpio_app, .name = "GPIO", .stack_size = 1024, .icon = &A_GPIO_14},
|
||||
{.app = gpio_app,
|
||||
.name = "GPIO",
|
||||
.stack_size = 1024,
|
||||
.icon = &A_GPIO_14,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_IBUTTON
|
||||
{.app = ibutton_app, .name = "iButton", .stack_size = 2048, .icon = &A_iButton_14},
|
||||
{.app = ibutton_app,
|
||||
.name = "iButton",
|
||||
.stack_size = 2048,
|
||||
.icon = &A_iButton_14,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_BAD_USB
|
||||
{.app = bad_usb_app, .name = "Bad USB", .stack_size = 2048, .icon = &A_BadUsb_14},
|
||||
{.app = bad_usb_app,
|
||||
.name = "Bad USB",
|
||||
.stack_size = 2048,
|
||||
.icon = &A_BadUsb_14,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_U2F
|
||||
{.app = u2f_app, .name = "U2F", .stack_size = 2048, .icon = &A_U2F_14},
|
||||
{.app = u2f_app,
|
||||
.name = "U2F",
|
||||
.stack_size = 2048,
|
||||
.icon = &A_U2F_14,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
};
|
||||
@@ -234,15 +322,27 @@ const size_t FLIPPER_ON_SYSTEM_START_COUNT = COUNT_OF(FLIPPER_ON_SYSTEM_START);
|
||||
// Plugin menu
|
||||
const FlipperApplication FLIPPER_PLUGINS[] = {
|
||||
#ifdef APP_BLE_HID
|
||||
{.app = bt_hid_app, .name = "Bluetooth Remote", .stack_size = 1024, .icon = NULL},
|
||||
{.app = bt_hid_app,
|
||||
.name = "Bluetooth Remote",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_MUSIC_PLAYER
|
||||
{.app = music_player_app, .name = "Music Player", .stack_size = 1024, .icon = &A_Plugins_14},
|
||||
{.app = music_player_app,
|
||||
.name = "Music Player",
|
||||
.stack_size = 1024,
|
||||
.icon = &A_Plugins_14,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_SNAKE_GAME
|
||||
{.app = snake_game_app, .name = "Snake Game", .stack_size = 1024, .icon = &A_Plugins_14},
|
||||
{.app = snake_game_app,
|
||||
.name = "Snake Game",
|
||||
.stack_size = 1024,
|
||||
.icon = &A_Plugins_14,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -251,108 +351,201 @@ const size_t FLIPPER_PLUGINS_COUNT = COUNT_OF(FLIPPER_PLUGINS);
|
||||
// Plugin menu
|
||||
const FlipperApplication FLIPPER_DEBUG_APPS[] = {
|
||||
#ifdef APP_BLINK
|
||||
{.app = blink_test_app, .name = "Blink Test", .stack_size = 1024, .icon = NULL},
|
||||
{.app = blink_test_app,
|
||||
.name = "Blink Test",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_VIBRO_TEST
|
||||
{.app = vibro_test_app, .name = "Vibro Test", .stack_size = 1024, .icon = NULL},
|
||||
{.app = vibro_test_app,
|
||||
.name = "Vibro Test",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_KEYPAD_TEST
|
||||
{.app = keypad_test_app, .name = "Keypad Test", .stack_size = 1024, .icon = NULL},
|
||||
{.app = keypad_test_app,
|
||||
.name = "Keypad Test",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_ACCESSOR
|
||||
{.app = accessor_app, .name = "Accessor", .stack_size = 4096, .icon = NULL},
|
||||
{.app = accessor_app,
|
||||
.name = "Accessor",
|
||||
.stack_size = 4096,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_USB_TEST
|
||||
{.app = usb_test_app, .name = "USB Test", .stack_size = 1024, .icon = NULL},
|
||||
{.app = usb_test_app,
|
||||
.name = "USB Test",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_USB_MOUSE
|
||||
{.app = usb_mouse_app, .name = "USB Mouse Demo", .stack_size = 1024, .icon = NULL},
|
||||
{.app = usb_mouse_app,
|
||||
.name = "USB Mouse Demo",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_UART_ECHO
|
||||
{.app = uart_echo_app, .name = "Uart Echo", .stack_size = 2048, .icon = NULL},
|
||||
{.app = uart_echo_app,
|
||||
.name = "Uart Echo",
|
||||
.stack_size = 2048,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_INFRARED_MONITOR
|
||||
{.app = infrared_monitor_app, .name = "Infrared Monitor", .stack_size = 1024, .icon = NULL},
|
||||
{.app = infrared_monitor_app,
|
||||
.name = "Infrared Monitor",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_SCENED
|
||||
{.app = scened_app, .name = "Templated Scene", .stack_size = 1024, .icon = NULL},
|
||||
{.app = scened_app,
|
||||
.name = "Templated Scene",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_LF_RFID
|
||||
{.app = lfrfid_debug_app, .name = "LF-RFID Debug", .stack_size = 1024, .icon = NULL},
|
||||
{.app = lfrfid_debug_app,
|
||||
.name = "LF-RFID Debug",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_BT
|
||||
{.app = bt_debug_app, .name = "Bluetooth Debug", .stack_size = 1024, .icon = NULL},
|
||||
{.app = bt_debug_app,
|
||||
.name = "Bluetooth Debug",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_UNIT_TESTS
|
||||
{.app = delay_test_app, .name = "Delay Test", .stack_size = 1024, .icon = NULL},
|
||||
{.app = delay_test_app,
|
||||
.name = "Delay Test",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_DISPLAY_TEST
|
||||
{.app = display_test_app, .name = "Display Test", .stack_size = 1024, .icon = NULL},
|
||||
{.app = display_test_app,
|
||||
.name = "Display Test",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_BATTERY_TEST
|
||||
{.app = battery_test_app, .name = "Battery Test", .stack_size = 1024, .icon = NULL},
|
||||
{.app = battery_test_app,
|
||||
.name = "Battery Test",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_TEXT_BOX_TEST
|
||||
{.app = text_box_test_app, .name = "Text Box Test", .stack_size = 1024, .icon = NULL},
|
||||
{.app = text_box_test_app,
|
||||
.name = "Text Box Test",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
};
|
||||
|
||||
const size_t FLIPPER_DEBUG_APPS_COUNT = COUNT_OF(FLIPPER_DEBUG_APPS);
|
||||
|
||||
#ifdef APP_ARCHIVE
|
||||
const FlipperApplication FLIPPER_ARCHIVE =
|
||||
{.app = archive_app, .name = "Archive", .stack_size = 4096, .icon = &A_FileManager_14};
|
||||
const FlipperApplication FLIPPER_ARCHIVE = {
|
||||
.app = archive_app,
|
||||
.name = "Archive",
|
||||
.stack_size = 4096,
|
||||
.icon = &A_FileManager_14,
|
||||
.flags = FlipperApplicationFlagDefault};
|
||||
#endif
|
||||
|
||||
// Settings menu
|
||||
const FlipperApplication FLIPPER_SETTINGS_APPS[] = {
|
||||
#ifdef SRV_BT
|
||||
{.app = bt_settings_app, .name = "Bluetooth", .stack_size = 1024, .icon = NULL},
|
||||
{.app = bt_settings_app,
|
||||
.name = "Bluetooth",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_NOTIFICATION
|
||||
{.app = notification_settings_app,
|
||||
.name = "LCD and Notifications",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL},
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_STORAGE
|
||||
{.app = storage_settings_app, .name = "Storage", .stack_size = 2048, .icon = NULL},
|
||||
{.app = storage_settings_app,
|
||||
.name = "Storage",
|
||||
.stack_size = 2048,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_POWER
|
||||
{.app = power_settings_app, .name = "Power", .stack_size = 1024, .icon = NULL},
|
||||
{.app = power_settings_app,
|
||||
.name = "Power",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagInsomniaSafe},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_DESKTOP
|
||||
{.app = desktop_settings_app, .name = "Desktop", .stack_size = 1024, .icon = NULL},
|
||||
{.app = desktop_settings_app,
|
||||
.name = "Desktop",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_PASSPORT
|
||||
{.app = passport_app, .name = "Passport", .stack_size = 1024, .icon = NULL},
|
||||
{.app = passport_app,
|
||||
.name = "Passport",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef SRV_GUI
|
||||
{.app = system_settings_app, .name = "System", .stack_size = 1024, .icon = NULL},
|
||||
{.app = system_settings_app,
|
||||
.name = "System",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
|
||||
#ifdef APP_ABOUT
|
||||
{.app = about_settings_app, .name = "About", .stack_size = 1024, .icon = NULL},
|
||||
{.app = about_settings_app,
|
||||
.name = "About",
|
||||
.stack_size = 1024,
|
||||
.icon = NULL,
|
||||
.flags = FlipperApplicationFlagDefault},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@@ -3,11 +3,17 @@
|
||||
#include <furi.h>
|
||||
#include <gui/icon.h>
|
||||
|
||||
typedef enum {
|
||||
FlipperApplicationFlagDefault = 0,
|
||||
FlipperApplicationFlagInsomniaSafe = (1 << 0),
|
||||
} FlipperApplicationFlag;
|
||||
|
||||
typedef struct {
|
||||
const FuriThreadCallback app;
|
||||
const char* name;
|
||||
const size_t stack_size;
|
||||
const Icon* icon;
|
||||
const FlipperApplicationFlag flags;
|
||||
} FlipperApplication;
|
||||
|
||||
typedef void (*FlipperOnStartHook)(void);
|
||||
|
@@ -17,8 +17,6 @@ const CanvasFontParameters canvas_font_params[FontTotalNumber] = {
|
||||
Canvas* canvas_init() {
|
||||
Canvas* canvas = malloc(sizeof(Canvas));
|
||||
|
||||
furi_hal_power_insomnia_enter();
|
||||
|
||||
// Setup u8g2
|
||||
u8g2_Setup_st756x_flipper(&canvas->fb, U8G2_R0, u8x8_hw_spi_stm32, u8g2_gpio_and_delay_stm32);
|
||||
canvas->orientation = CanvasOrientationHorizontal;
|
||||
@@ -31,8 +29,6 @@ Canvas* canvas_init() {
|
||||
canvas_clear(canvas);
|
||||
canvas_commit(canvas);
|
||||
|
||||
furi_hal_power_insomnia_exit();
|
||||
|
||||
return canvas;
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,6 @@ iButtonApp::iButtonApp()
|
||||
: notification{"notification"}
|
||||
, storage{"storage"}
|
||||
, dialogs{"dialogs"} {
|
||||
furi_hal_power_insomnia_enter();
|
||||
key = ibutton_key_alloc();
|
||||
key_worker = ibutton_worker_alloc();
|
||||
ibutton_worker_start_thread(key_worker);
|
||||
@@ -56,8 +55,6 @@ iButtonApp::~iButtonApp() {
|
||||
ibutton_worker_stop_thread(key_worker);
|
||||
ibutton_worker_free(key_worker);
|
||||
ibutton_key_free(key);
|
||||
|
||||
furi_hal_power_insomnia_exit();
|
||||
}
|
||||
|
||||
iButtonAppViewManager* iButtonApp::get_view_manager() {
|
||||
@@ -342,4 +339,4 @@ void iButtonApp::make_app_folder() {
|
||||
if(!storage_simply_mkdir(storage, app_folder)) {
|
||||
dialog_message_show_storage_error(dialogs, "Cannot create\napp folder");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -31,11 +31,9 @@ LfRfidApp::LfRfidApp()
|
||||
, storage{"storage"}
|
||||
, dialogs{"dialogs"}
|
||||
, text_store(40) {
|
||||
furi_hal_power_insomnia_enter();
|
||||
}
|
||||
|
||||
LfRfidApp::~LfRfidApp() {
|
||||
furi_hal_power_insomnia_exit();
|
||||
}
|
||||
|
||||
void LfRfidApp::run(void* _args) {
|
||||
@@ -201,4 +199,4 @@ void LfRfidApp::make_app_folder() {
|
||||
if(!storage_simply_mkdir(storage, app_folder)) {
|
||||
dialog_message_show_storage_error(dialogs, "Cannot create\napp folder");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -238,7 +238,10 @@ static void loader_thread_state_callback(FuriThreadState thread_state, void* con
|
||||
if(thread_state == FuriThreadStateRunning) {
|
||||
event.type = LoaderEventTypeApplicationStarted;
|
||||
furi_pubsub_publish(loader_instance->pubsub, &event);
|
||||
furi_hal_power_insomnia_enter();
|
||||
|
||||
if(!loader_instance->application->flags & FlipperApplicationFlagInsomniaSafe) {
|
||||
furi_hal_power_insomnia_enter();
|
||||
}
|
||||
} else if(thread_state == FuriThreadStateStopped) {
|
||||
FURI_LOG_I(
|
||||
TAG,
|
||||
@@ -251,7 +254,9 @@ static void loader_thread_state_callback(FuriThreadState thread_state, void* con
|
||||
loader_instance->application_arguments = NULL;
|
||||
}
|
||||
|
||||
furi_hal_power_insomnia_exit();
|
||||
if(!loader_instance->application->flags & FlipperApplicationFlagInsomniaSafe) {
|
||||
furi_hal_power_insomnia_exit();
|
||||
}
|
||||
loader_unlock(instance);
|
||||
|
||||
event.type = LoaderEventTypeApplicationStopped;
|
||||
|
@@ -86,7 +86,6 @@ void nfc_worker_change_state(NfcWorker* nfc_worker, NfcWorkerState state) {
|
||||
int32_t nfc_worker_task(void* context) {
|
||||
NfcWorker* nfc_worker = context;
|
||||
|
||||
furi_hal_power_insomnia_enter();
|
||||
furi_hal_nfc_exit_sleep();
|
||||
|
||||
if(nfc_worker->state == NfcWorkerStateDetect) {
|
||||
@@ -110,7 +109,6 @@ int32_t nfc_worker_task(void* context) {
|
||||
}
|
||||
furi_hal_nfc_sleep();
|
||||
nfc_worker_change_state(nfc_worker, NfcWorkerStateReady);
|
||||
furi_hal_power_insomnia_exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -39,12 +39,10 @@ void storage_data_init(StorageData* storage) {
|
||||
}
|
||||
|
||||
bool storage_data_lock(StorageData* storage) {
|
||||
furi_hal_power_insomnia_enter();
|
||||
return (osMutexAcquire(storage->mutex, osWaitForever) == osOK);
|
||||
}
|
||||
|
||||
bool storage_data_unlock(StorageData* storage) {
|
||||
furi_hal_power_insomnia_exit();
|
||||
return (osMutexRelease(storage->mutex) == osOK);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user