ADD STANDBY code

This commit is contained in:
Yunhorn 2024-03-07 12:33:51 +08:00
parent e52d64708d
commit 617f7d4701
3 changed files with 7 additions and 5 deletions

View File

@ -47,12 +47,12 @@ extern "C" {
/** /**
* @brief Verbose level for all trace logs * @brief Verbose level for all trace logs
*/ */
#define VERBOSE_LEVEL VLEVEL_OFF #define VERBOSE_LEVEL VLEVEL_H
/** /**
* @brief Enable trace logs * @brief Enable trace logs
*/ */
#define APP_LOG_ENABLED 0 #define APP_LOG_ENABLED 1
/** /**
* @brief Activate monitoring (probes) of some internal RF signals for debug purpose * @brief Activate monitoring (probes) of some internal RF signals for debug purpose
@ -75,7 +75,7 @@ extern "C" {
* @brief Enable/Disable MCU Debugger pins (dbg serial wires) * @brief Enable/Disable MCU Debugger pins (dbg serial wires)
* @note by HW serial wires are ON by default, need to put them OFF to save power * @note by HW serial wires are ON by default, need to put them OFF to save power
*/ */
#define DEBUGGER_ENABLED 0 #define DEBUGGER_ENABLED 1
/** /**
* @brief Disable Low Power mode * @brief Disable Low Power mode

View File

@ -80,6 +80,7 @@ void PWR_EnterOffMode(void)
/* USER CODE BEGIN EnterOffMode_1 */ /* USER CODE BEGIN EnterOffMode_1 */
/* USER CODE END EnterOffMode_1 */ /* USER CODE END EnterOffMode_1 */
HAL_SuspendTick();
//HAL_PWREx_EnableGPIOPullUp(PWR_GPIO_A, PWR_GPIO_BIT_0); //HAL_PWREx_EnableGPIOPullUp(PWR_GPIO_A, PWR_GPIO_BIT_0);
//HAL_PWREx_EnablePullUpPullDownConfig(); //HAL_PWREx_EnablePullUpPullDownConfig();
/* USER CODE BEGIN EnterOffMode_2 */ /* USER CODE BEGIN EnterOffMode_2 */
@ -89,13 +90,14 @@ void PWR_EnterOffMode(void)
/* USER CODE BEGIN EnterOffMode_3 */ /* USER CODE BEGIN EnterOffMode_3 */
//HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1_LOW); //HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1_LOW);
//__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); //__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
//HAL_PWR_EnterSTANDBYMode(); HAL_PWR_EnterSTANDBYMode();
/* USER CODE END EnterOffMode_3 */ /* USER CODE END EnterOffMode_3 */
} }
void PWR_ExitOffMode(void) void PWR_ExitOffMode(void)
{ {
/* USER CODE BEGIN ExitOffMode_1 */ /* USER CODE BEGIN ExitOffMode_1 */
HAL_ResumeTick();
//__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB); //__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
/* USER CODE END ExitOffMode_1 */ /* USER CODE END ExitOffMode_1 */
} }

View File

@ -121,7 +121,7 @@ void SystemApp_Init(void)
/*Init low power manager*/ /*Init low power manager*/
UTIL_LPM_Init(); UTIL_LPM_Init();
/* Disable Stand-by mode */ /* Disable Stand-by mode */
UTIL_LPM_SetOffMode((1 << CFG_LPM_APPLI_Id), UTIL_LPM_DISABLE); //UTIL_LPM_SetOffMode((1 << CFG_LPM_APPLI_Id), UTIL_LPM_DISABLE);
//UTIL_LPM_SetOffMode((1 << CFG_LPM_APPLI_Id), UTIL_LPM_ENABLE); //UTIL_LPM_SetOffMode((1 << CFG_LPM_APPLI_Id), UTIL_LPM_ENABLE);
#if defined (LOW_POWER_DISABLE) && (LOW_POWER_DISABLE == 1) #if defined (LOW_POWER_DISABLE) && (LOW_POWER_DISABLE == 1)