new try of low power, not good, no startup with battery
This commit is contained in:
parent
82f2fe1dce
commit
d68623f77e
|
@ -106,6 +106,9 @@ void MX_TIM2_Init(void);
|
|||
#define USARTx_TX_GPIO_Port GPIOA
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
#define MEMS_POWER_Pin GPIO_PIN_4
|
||||
#define MEMS_POWER_GPIO_Port GPIOB
|
||||
|
||||
#define MEMS_EXTI1_Pin BUT1_Pin
|
||||
#define MEMS_EXTI1_Port BUT1_GPIO_Port
|
||||
#define MEMS_EXTI2_Pin BUT2_Pin
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
#ifdef YUNHORN_STS_M7_ENABLED
|
||||
#define MajorVer 24U
|
||||
#define MinorVer 05U
|
||||
#define SubMinorVer 22U
|
||||
#define SubMinorVer 28U
|
||||
#define FirmwareVersion 3U
|
||||
/*
|
||||
#define YUNHORN_STS_M7_NVM_CFG_SIZE 3U
|
||||
|
@ -94,11 +94,6 @@
|
|||
|
||||
#define NVM_CFG_PARAMETER_SIZE YUNHORN_STS_M7_NVM_CFG_SIZE
|
||||
#define CFG_CMD_PARAMETER_SIZE YUNHORN_STS_M7_CFG_CMD_SIZE
|
||||
#define MEMS_POWER_Pin GPIO_PIN_4
|
||||
#define MEMS_POWER_GPIO_Port GPIOB
|
||||
|
||||
#define MEMS_RESET_Pin GPIO_PIN_4
|
||||
#define MEMS_RESET_GPIO_Port GPIOB
|
||||
|
||||
#define MOTION_SENSOR_TIM_HANDLE htim2
|
||||
#define MOTION_SENSOR_I2C_HANDLE hi2c1
|
||||
|
|
|
@ -49,6 +49,7 @@ void MX_GPIO_Init(void)
|
|||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
|
||||
#if 0
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_All;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
|
@ -58,13 +59,13 @@ void MX_GPIO_Init(void)
|
|||
|
||||
__HAL_RCC_GPIOB_CLK_DISABLE();
|
||||
__HAL_RCC_GPIOC_CLK_DISABLE();
|
||||
|
||||
#endif
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
|
||||
HAL_GPIO_WritePin(GPIOB, LED1_Pin|LED2_Pin|PROB2_Pin|PROB1_Pin
|
||||
|LED3_Pin, GPIO_PIN_RESET);
|
||||
#if 0
|
||||
#if 1
|
||||
/*Configure GPIO pins : PBPin PBPin PBPin */
|
||||
GPIO_InitStruct.Pin = LED1_Pin|LED2_Pin|LED3_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
|
@ -78,7 +79,7 @@ void MX_GPIO_Init(void)
|
|||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
/*Configure GPIO pins : PBPin PBPin */
|
||||
GPIO_InitStruct.Pin = PROB2_Pin|PROB1_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
|
@ -102,10 +103,16 @@ void MX_GPIO_Init(void)
|
|||
|
||||
#elif defined(USE_STM32WLE5)
|
||||
/*Configure GPIO pins : PAPin PAPin */
|
||||
GPIO_InitStruct.Pin = MEMS_EXTI1_Pin; //MEMS_INT1_PIN MODE=RISING, PULL DOWN
|
||||
GPIO_InitStruct.Pin = MEMS_EXTI1_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
||||
HAL_GPIO_Init(MEMS_EXTI1_Port, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = MEMS_POWER_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(MEMS_POWER_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
// NO BUT3_Pin and Port
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "stm32_lpm.h"
|
||||
#include "stm32_lpm_if.h"
|
||||
#include "usart_if.h"
|
||||
#include "gpio.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
|
@ -95,9 +96,9 @@ void PWR_EnterStopMode(void)
|
|||
/* USER CODE BEGIN EnterStopMode_1 */
|
||||
|
||||
/* 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_1), GPIO_PIN_RESET);
|
||||
//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_1), GPIO_PIN_RESET);
|
||||
HAL_SuspendTick();
|
||||
/* Clear Status Flag before entering STOP/STANDBY Mode */
|
||||
LL_PWR_ClearFlag_C1STOP_C1STB();
|
||||
|
@ -128,6 +129,7 @@ void PWR_ExitStopMode(void)
|
|||
/* USER CODE BEGIN ExitStopMode_2 */
|
||||
#ifdef YUNHORN_STS_M7_ENABLED
|
||||
MX_I2C1_Init();
|
||||
MX_GPIO_Init();
|
||||
MX_TIM2_Init();
|
||||
#ifdef USE_OLED_SSD1306
|
||||
HAL_I2C_Init(&SSD1306_I2C_HANDLE);
|
||||
|
|
|
@ -445,7 +445,7 @@ void STS_SENSOR_MEMS_Reset(uint8_t cnt)
|
|||
case 1:
|
||||
case 2:
|
||||
#ifdef YUNHORN_STS_M7_ENABLED
|
||||
HAL_GPIO_WritePin(MEMS_RESET_GPIO_Port, MEMS_RESET_Pin, GPIO_PIN_SET);
|
||||
HAL_GPIO_TogglePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -34,7 +34,7 @@ extern uint32_t freq_at_spectrumPeak_x,freq_at_spectrumPeak_y,freq_at_spectrumP
|
|||
extern uint32_t bin_at_spectrumPeak_x,bin_at_spectrumPeak_y,bin_at_spectrumPeak_z;
|
||||
|
||||
extern volatile uint16_t TIM2_Counter, ggx,ggy,ggz;
|
||||
volatile uint8_t act_threshold=6, inact_threshold=3, inact_duration=3, do_fft_flag=0;
|
||||
volatile uint8_t act_threshold=6, inact_threshold=3, inact_duration=3, do_fft_flag=1;
|
||||
extern I2C_HandleTypeDef MOTION_SENSOR_I2C_HANDLE;
|
||||
extern TIM_HandleTypeDef htim2;
|
||||
/******************************************************************************/
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
/* USER CODE BEGIN EV */
|
||||
volatile uint8_t mems_int1_detected = 0;
|
||||
volatile uint32_t periodicity_length=0;
|
||||
volatile uint8_t sts_service_mask;
|
||||
volatile uint8_t sts_service_mask=0;
|
||||
volatile uint32_t rfac_timer=0;
|
||||
extern hmac_result_t hmac_result;
|
||||
volatile uint8_t sts_work_mode =0;
|
||||
|
@ -695,7 +695,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
|||
OnSystemReset();
|
||||
} else if ((char)tlv_buf[CFG_CMD3] == 'S') { // Self Function Testing "YZS"
|
||||
i=0;
|
||||
memset(outbuf,0x30,sizeof(outbuf));
|
||||
memset(outbuf,0x0,sizeof(outbuf));
|
||||
|
||||
STS_SENSOR_Function_Test_Process();
|
||||
|
||||
|
@ -754,7 +754,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
|||
uint8_t cfg_in_nvm[YUNHORN_STS_MAX_NVM_CFG_SIZE]={0x0};
|
||||
OnRestoreSTSCFGContextRequest((uint8_t *)cfg_in_nvm);
|
||||
i = 0;
|
||||
memset(outbuf,0x30,sizeof(outbuf));
|
||||
memset(outbuf,0x0,sizeof(outbuf));
|
||||
outbuf[i++] = (uint8_t) 'C';
|
||||
outbuf[i++] = (uint8_t) cfg_in_nvm[NVM_MTM1]; //MTM Code
|
||||
outbuf[i++] = (uint8_t) cfg_in_nvm[NVM_MTM2]; //MTM Code
|
||||
|
@ -1302,6 +1302,8 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams)
|
|||
APP_LOG(TS_OFF, VLEVEL_M, "\r\n###### = JOIN FAILED\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
heart_beat_timer =1;
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||
/* USER CODE END OnJoinRequest_1 */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue