From 1140aa9a1926668b52324d567176278e019247ca Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Mon, 25 Mar 2024 13:29:34 +0800 Subject: [PATCH] 1.8uA at open state and 20 uA at closed for a few seconds --- Core/Src/stm32_lpm_if.c | 4 +++- LoRaWAN/App/lora_app.c | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Core/Src/stm32_lpm_if.c b/Core/Src/stm32_lpm_if.c index f174631..2b3bfd4 100644 --- a/Core/Src/stm32_lpm_if.c +++ b/Core/Src/stm32_lpm_if.c @@ -96,7 +96,8 @@ void PWR_EnterStopMode(void) /* USER CODE END EnterStopMode_1 */ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_All, GPIO_PIN_RESET); //HAL_GPIO_WritePin(GPIOC, GPIO_PIN_All, GPIO_PIN_RESET); - HAL_GPIO_WritePin(GPIOA, ~GPIO_PIN_0, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOA, GPIO_PIN_All, GPIO_PIN_RESET); + HAL_GPIO_DeInit(GPIOA,GPIO_PIN_0); HAL_SuspendTick(); /* Clear Status Flag before entering STOP/STANDBY Mode */ LL_PWR_ClearFlag_C1STOP_C1STB(); @@ -123,6 +124,7 @@ void PWR_ExitStopMode(void) SRAM ctrls, DMAx, DMAMux, AES, RNG, HSEM */ /* Resume not retained USARTx and DMA */ + MX_GPIO_Init(); vcom_Resume(); /* USER CODE BEGIN ExitStopMode_2 */ diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index 49697fb..e584b2d 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -36,7 +36,7 @@ #include "flash_if.h" /* USER CODE BEGIN Includes */ - +#include "gpio.h" /* USER CODE END Includes */ /* External variables ---------------------------------------------------------*/ @@ -700,9 +700,10 @@ static void OnTxTimerEvent(void *context) UTIL_TIMER_Start(&TxTimer); } #endif + MX_GPIO_Init(); door_status = HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_0); - door_changed_flag = 0; - if (door_status != door_previous_status) + //door_changed_flag = 0; + //if (door_status != door_previous_status) { door_previous_status = door_status;