From dbb729a6055832f985fd61dfbebc407db815ef52 Mon Sep 17 00:00:00 2001 From: YunHorn Technology Date: Tue, 7 May 2024 15:25:01 +0800 Subject: [PATCH] try switch PB3/PB5 --- Core/Inc/main.h | 4 ++-- Core/Inc/stm32wlxx_it.h | 1 + Core/Src/acc_hal_integration_a111.c | 1 + Core/Src/gpio.c | 10 +++++----- Core/Src/main.c | 5 +++++ Core/Src/yunhorn_sts_presence_sensor.c | 1 + STM32CubeIDE/.cproject | 2 +- STM32CubeIDE/Release/STS_O7.bin | Bin 254496 -> 254536 bytes 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Core/Inc/main.h b/Core/Inc/main.h index 66ec458..6db0482 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -79,8 +79,8 @@ void Error_Handler(void); #define MEMS_RESET_Pin GPIO_PIN_4 #define MEMS_RESET_GPIO_Port GPIOB -#define PME_ON HAL_GPIO_WritePin(MEMS_RESET_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_SET ) -#define PME_OFF HAL_GPIO_WritePin(MEMS_RESET_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_RESET ) +#define PME_ON HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_SET ) +#define PME_OFF HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_RESET ) #ifdef STS_O7 diff --git a/Core/Inc/stm32wlxx_it.h b/Core/Inc/stm32wlxx_it.h index f61f202..ff22d7c 100644 --- a/Core/Inc/stm32wlxx_it.h +++ b/Core/Inc/stm32wlxx_it.h @@ -58,6 +58,7 @@ void SysTick_Handler(void); void TAMP_STAMP_LSECSS_SSRU_IRQHandler(void); void EXTI0_IRQHandler(void); void EXTI1_IRQHandler(void); +void EXTI3_IRQHandler(void); void DMA1_Channel1_IRQHandler(void); void DMA1_Channel5_IRQHandler(void); void EXTI9_5_IRQHandler(void); diff --git a/Core/Src/acc_hal_integration_a111.c b/Core/Src/acc_hal_integration_a111.c index 38dd51e..0bcdf24 100644 --- a/Core/Src/acc_hal_integration_a111.c +++ b/Core/Src/acc_hal_integration_a111.c @@ -122,6 +122,7 @@ static void acc_hal_integration_sensor_transfer(acc_sensor_id_t sensor_id, uint8 static void acc_hal_integration_sensor_power_on(acc_sensor_id_t sensor_id) { (void)sensor_id; // Ignore parameter sensor_id + HAL_GPIO_WritePin(A111_ENABLE_GPIO_Port, A111_ENABLE_Pin, GPIO_PIN_SET); HAL_GPIO_WritePin(A111_CS_N_GPIO_Port, A111_CS_N_Pin, GPIO_PIN_SET); diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c index 92da7ad..6047302 100644 --- a/Core/Src/gpio.c +++ b/Core/Src/gpio.c @@ -63,14 +63,14 @@ void MX_GPIO_Init(void) GPIO_InitStruct.Pin = MEMS_POWER_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.Pull = GPIO_PULLDOWN; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(MEMS_POWER_GPIO_Port, &GPIO_InitStruct); /*Configure GPIO pin : PtPin */ GPIO_InitStruct.Pin = A111_ENABLE_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Pull = GPIO_PULLDOWN; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(A111_ENABLE_GPIO_Port, &GPIO_InitStruct); @@ -130,13 +130,13 @@ void MX_GPIO_Init(void) HAL_NVIC_SetPriority(EXTI1_IRQn, 0, 0); HAL_NVIC_EnableIRQ(EXTI1_IRQn); -#endif + HAL_NVIC_SetPriority(EXTI9_5_IRQn, 0, 0); HAL_NVIC_EnableIRQ(EXTI9_5_IRQn); HAL_NVIC_SetPriority(EXTI3_IRQn, 0, 0); HAL_NVIC_EnableIRQ(EXTI3_IRQn); - +#endif } /* USER CODE BEGIN 2 */ diff --git a/Core/Src/main.c b/Core/Src/main.c index 9c671ef..0608242 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -102,6 +102,11 @@ int main(void) MX_LoRaWAN_Init(); + do + { + STS_SENSOR_Function_Test_Process(); + } while(0); + STS_Lamp_Bar_Self_Test_Simple(); /* USER CODE BEGIN 2 */ diff --git a/Core/Src/yunhorn_sts_presence_sensor.c b/Core/Src/yunhorn_sts_presence_sensor.c index b367b8b..7d6afa4 100644 --- a/Core/Src/yunhorn_sts_presence_sensor.c +++ b/Core/Src/yunhorn_sts_presence_sensor.c @@ -517,6 +517,7 @@ uint8_t STS_SENSOR_MEMS_Get_ID(uint8_t *devID) { devID[0] = scanned_id[0]; devID[1] = scanned_id[1]; + APP_LOG(TS_OFF, VLEVEL_H,"\r\n--------------devID = %02x %02x \r\n",devID[0], devID[1]); return true; } else diff --git a/STM32CubeIDE/.cproject b/STM32CubeIDE/.cproject index 698de9c..0ceadee 100644 --- a/STM32CubeIDE/.cproject +++ b/STM32CubeIDE/.cproject @@ -153,7 +153,7 @@