diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c index cac9987..f321bae 100644 --- a/Core/Src/gpio.c +++ b/Core/Src/gpio.c @@ -51,6 +51,15 @@ void MX_GPIO_Init(void) __HAL_RCC_GPIOB_CLK_ENABLE(); __HAL_RCC_GPIOC_CLK_ENABLE(); + GPIO_InitStruct.Pin = GPIO_PIN_All; + GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; + GPIO_InitStruct.Pull = GPIO_NOPULL; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); + HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); + + __HAL_RCC_GPIOC_CLK_DISABLE(); + /*Configure GPIO pin Output Level */ #if defined(STM32WL55xx) HAL_GPIO_WritePin(GPIOB, LED1_Pin|LED2_Pin|PROB2_Pin|PROB1_Pin @@ -81,12 +90,13 @@ void MX_GPIO_Init(void) GPIO_InitStruct.Pull = GPIO_PULLUP; HAL_GPIO_Init(BUT3_GPIO_Port, &GPIO_InitStruct); #endif +#if 0 /*Configure GPIO pin : PtPin */ GPIO_InitStruct.Pin = BUT2_Pin; GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING; GPIO_InitStruct.Pull = GPIO_PULLUP; HAL_GPIO_Init(BUT2_GPIO_Port, &GPIO_InitStruct); - +#endif /*Configure GPIO pin : PtPin */ GPIO_InitStruct.Pin = BUT1_Pin; GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING; @@ -142,14 +152,14 @@ void MX_GPIO_Init(void) HAL_GPIO_Init(TOF_R_XSHUT_GPIO_Port, &GPIO_InitStruct); #endif - +#ifdef LED_ONBOARD /*Configure GPIO pins : PBPin PBPin PBPin */ GPIO_InitStruct.Pin = LED1_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(LED1_GPIO_Port, &GPIO_InitStruct); - +#endif #if defined(SOAP_LEVEL_SENSOR) /* ============== SOAP LEVEL DETECTION ========================= */ @@ -176,9 +186,10 @@ HAL_GPIO_Init(SOAP_SWITCH_GPIO_Port, &GPIO_InitStruct); /* EXTI interrupt init*/ HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0); HAL_NVIC_EnableIRQ(EXTI0_IRQn); - +#if 0 HAL_NVIC_SetPriority(EXTI1_IRQn, 0, 0); HAL_NVIC_EnableIRQ(EXTI1_IRQn); +#endif #if defined(TOF_1) HAL_NVIC_SetPriority(TOF_C_INT_EXTI_IRQn, 0, 0); HAL_NVIC_EnableIRQ(TOF_C_INT_EXTI_IRQn); diff --git a/Core/Src/stm32_lpm_if.c b/Core/Src/stm32_lpm_if.c index bfa47d5..20e3377 100644 --- a/Core/Src/stm32_lpm_if.c +++ b/Core/Src/stm32_lpm_if.c @@ -97,6 +97,9 @@ void PWR_EnterStopMode(void) /* USER CODE BEGIN EnterStopMode_1 */ /* USER CODE END EnterStopMode_1 */ + HAL_GPIO_WritePin(GPIOA,GPIO_PIN_All, GPIO_PIN_RESET); + HAL_GPIO_WritePin(GPIOB,GPIO_PIN_All, GPIO_PIN_RESET); + HAL_SuspendTick(); /* Clear Status Flag before entering STOP/STANDBY Mode */ LL_PWR_ClearFlag_C1STOP_C1STB(); diff --git a/Core/Src/stm32wlxx_it.c b/Core/Src/stm32wlxx_it.c index d3a33e3..8ff30f5 100644 --- a/Core/Src/stm32wlxx_it.c +++ b/Core/Src/stm32wlxx_it.c @@ -249,7 +249,7 @@ void EXTI0_IRQHandler(void) /* USER CODE END EXTI0_IRQn 1 */ } - +#if 0 /** * @brief This function handles EXTI Line 1 Interrupt. */ @@ -263,7 +263,7 @@ void EXTI1_IRQHandler(void) /* USER CODE END EXTI1_IRQn 1 */ } - +#endif /** * @brief This function handles DMA1 Channel 2 Interrupt. diff --git a/Core/Src/usart.c b/Core/Src/usart.c index 9cdb66e..666b2d4 100644 --- a/Core/Src/usart.c +++ b/Core/Src/usart.c @@ -105,13 +105,19 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle) PA3 ------> USART2_RX PA2 ------> USART2_TX */ - GPIO_InitStruct.Pin = USARTx_RX_Pin|USARTx_TX_Pin; + GPIO_InitStruct.Pin = USARTx_TX_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF7_USART2; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + GPIO_InitStruct.Pin = USARTx_RX_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; + GPIO_InitStruct.Pull = GPIO_NOPULL; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + /* USART2 DMA Init */ /* USART2_TX Init */ hdma_usart2_tx.Instance = DMA1_Channel7;