[FL-667] Power saving: deep sleep in tickless state (#300)

* SYSTEM: tickless mode with deep sleep.
* Move FreeRTOS ticks to lptim2.
* API: move all sumbodules init routines to one place.
* Timebase: working lptim2 at tick source.
* API Timebase: lp-timer routines, timer access safe zones prediction and synchronization. 
* FreeRTOS: adjust configuration for tickless mode.
* NFC: support for tickless mode.
* API Timebase: improve tick error handling in IRQ. 
* Apploader: use insomnia mode to run applications.
* BLE: prevent sleep while core2 starting.
* HAL: nap while in insomnia mode.

Co-authored-by: coreglitch <mail@s3f.ru>
This commit is contained in:
あく
2021-01-18 18:08:58 +03:00
committed by GitHub
parent c3a8af8448
commit c8aca9ef48
44 changed files with 395 additions and 200 deletions

View File

@@ -5,6 +5,7 @@
#include "menu/menu_item.h"
#include "applications.h"
#include <assets_icons.h>
#include <api-hal.h>
typedef struct {
FuriApp* handler;
@@ -37,6 +38,7 @@ static void input_callback(InputEvent* input_event, void* _ctx) {
if(input_event->state && input_event->input == InputBack) {
furiac_kill(ctx->handler);
widget_enabled_set(ctx->widget, false);
api_hal_timebase_insomnia_exit();
}
}
@@ -49,6 +51,7 @@ static void handle_menu(void* _ctx) {
// TODO how to call this?
// furiac_wait_libs(&FLIPPER_STARTUP[i].libs);
api_hal_timebase_insomnia_enter();
ctx->state->current_app = ctx->app;
ctx->state->handler = furiac_start(ctx->app->app, ctx->app->name, NULL);