[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

@@ -21,6 +21,8 @@
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32wbxx_it.h"
#include "FreeRTOS.h"
#include "task.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
@@ -62,8 +64,6 @@ extern COMP_HandleTypeDef hcomp1;
extern RTC_HandleTypeDef hrtc;
extern TIM_HandleTypeDef htim1;
extern TIM_HandleTypeDef htim2;
extern TIM_HandleTypeDef htim17;
/* USER CODE BEGIN EV */
/* USER CODE END EV */
@@ -160,6 +160,19 @@ void DebugMon_Handler(void)
/* USER CODE END DebugMonitor_IRQn 1 */
}
/**
* @brief This function handles System tick timer.
*/
void SysTick_Handler(void)
{
/* USER CODE BEGIN SysTick_IRQn 0 */
/* USER CODE END SysTick_IRQn 0 */
/* USER CODE BEGIN SysTick_IRQn 1 */
HAL_IncTick();
/* USER CODE END SysTick_IRQn 1 */
}
/******************************************************************************/
/* STM32WBxx Peripheral Interrupt Handlers */
/* Add here the Interrupt Handlers for the used peripherals. */
@@ -288,7 +301,6 @@ void TIM1_TRG_COM_TIM17_IRQHandler(void)
/* USER CODE END TIM1_TRG_COM_TIM17_IRQn 0 */
HAL_TIM_IRQHandler(&htim1);
HAL_TIM_IRQHandler(&htim17);
/* USER CODE BEGIN TIM1_TRG_COM_TIM17_IRQn 1 */
/* USER CODE END TIM1_TRG_COM_TIM17_IRQn 1 */