revised with lower power
This commit is contained in:
parent
e2a0f3c384
commit
cf3a92f937
|
@ -25,7 +25,7 @@
|
|||
#include "usart_if.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
#include "gpio.h"
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* External variables ---------------------------------------------------------*/
|
||||
|
@ -94,11 +94,10 @@ void PWR_EnterStopMode(void)
|
|||
/* USER CODE BEGIN EnterStopMode_1 */
|
||||
|
||||
/* USER CODE END EnterStopMode_1 */
|
||||
HAL_GPIO_DeInit(GPIOA,GPIO_PIN_0);
|
||||
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_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();
|
||||
|
|
|
@ -446,9 +446,19 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
|||
{
|
||||
case BUT1_Pin:
|
||||
/* Note: when "EventType == TX_ON_TIMER" this GPIO is not initialized */
|
||||
|
||||
HAL_Delay(10); //eliminate bouncing back 5ms
|
||||
door_status = HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_0);
|
||||
|
||||
if (door_status != door_previous_status)
|
||||
{
|
||||
door_changed_flag = 1;
|
||||
door_previous_status = door_status;
|
||||
}
|
||||
|
||||
//if (EventType == TX_ON_EVENT)
|
||||
{
|
||||
door_changed_flag =1;
|
||||
// door_changed_flag =1;
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||
}
|
||||
break;
|
||||
|
@ -558,13 +568,7 @@ static void SendTxData(void)
|
|||
sensor_t sensor_data;
|
||||
UTIL_TIMER_Time_t nextTxIn = 0;
|
||||
|
||||
HAL_Delay(10); //eliminate bouncing back 5ms
|
||||
door_status = HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_0);
|
||||
door_changed_flag = 0;
|
||||
if (door_status != door_previous_status)
|
||||
{
|
||||
door_previous_status = door_status;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
if (door_changed_flag ==1 )
|
||||
|
@ -702,11 +706,12 @@ static void OnTxTimerEvent(void *context)
|
|||
}
|
||||
#endif
|
||||
MX_GPIO_Init();
|
||||
//door_status = HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_0);
|
||||
//door_changed_flag = 0;
|
||||
//if (door_status != door_previous_status)
|
||||
door_status = HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_0);
|
||||
|
||||
if (door_status != door_previous_status)
|
||||
{
|
||||
//door_previous_status = door_status;
|
||||
door_changed_flag = 1;
|
||||
door_previous_status = door_status;
|
||||
|
||||
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||
|
|
Loading…
Reference in New Issue