[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

@@ -1,4 +1,5 @@
#include "nfc_worker_i.h"
#include <api-hal.h>
NfcWorker* nfc_worker_alloc(osMessageQueueId_t message_queue) {
NfcWorker* nfc_worker = furi_alloc(sizeof(NfcWorker));
@@ -54,6 +55,8 @@ void nfc_worker_change_state(NfcWorker* nfc_worker, NfcWorkerState state) {
void nfc_worker_task(void* context) {
NfcWorker* nfc_worker = context;
api_hal_timebase_insomnia_enter();
rfalLowPowerModeStop();
if(nfc_worker->state == NfcWorkerStatePoll) {
nfc_worker_poll(nfc_worker);
@@ -66,6 +69,7 @@ void nfc_worker_task(void* context) {
nfc_worker_change_state(nfc_worker, NfcWorkerStateReady);
api_hal_timebase_insomnia_exit();
osThreadExit();
}