buzzer problem not ok

This commit is contained in:
TuxMonkey
2025-11-11 21:46:38 +08:00
parent 82f21f7d35
commit 9f205d6252
8 changed files with 107 additions and 113 deletions

View File

@@ -26,6 +26,14 @@
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "ws2812status.h"
#include "buzzer.h"
// #include "remoteTask.h"
//
// #include "bsp_dwt.h"
// // #include "ins_task.h"
// #include "bsp_log.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/

View File

@@ -32,6 +32,9 @@
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "buzzer.h"
#include "delayticks.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@@ -127,7 +130,7 @@ int main(void)
MX_TIM3_Init();
MX_SPI6_Init();
/* USER CODE BEGIN 2 */
systemstart_song();
/* USER CODE END 2 */
/* Init scheduler */

View File

@@ -241,7 +241,7 @@ void MX_USART3_UART_Init(void)
huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1;
huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_RXOVERRUNDISABLE_INIT;
huart3.AdvancedInit.OverrunDisable = UART_ADVFEATURE_OVERRUN_DISABLE;
if (HAL_RS485Ex_Init(&huart3, UART_DE_POLARITY_HIGH, 0, 0) != HAL_OK)
if (HAL_UART_Init(&huart3) != HAL_OK)
{
Error_Handler();
}
@@ -601,20 +601,11 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
/* USART3 clock enable */
__HAL_RCC_USART3_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
/**USART3 GPIO Configuration
PB14 ------> USART3_DE
PD8 ------> USART3_TX
PD9 ------> USART3_RX
*/
GPIO_InitStruct.Pin = GPIO_PIN_14;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF7_USART3;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
@@ -858,12 +849,9 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
__HAL_RCC_USART3_CLK_DISABLE();
/**USART3 GPIO Configuration
PB14 ------> USART3_DE
PD8 ------> USART3_TX
PD9 ------> USART3_RX
*/
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_14);
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_8|GPIO_PIN_9);
/* USART3 DMA DeInit */