feat: 集成循迹与超声波驱动并优化控制任务节拍

- 新增 HC-SR04 驱动与测距接口(bsp_sr04)

- 增加循迹状态读取与输出,完善任务内日志

- 调整 CarCtrl 闭环更新周期,匹配霍尔测速周期,降低抖动

- 同步更新 CubeMX/CMake 生成配置与相关引脚定义
This commit is contained in:
2026-04-14 21:59:49 +08:00
parent 91151c250a
commit 65478d9f02
15 changed files with 267 additions and 279 deletions

View File

@@ -19,7 +19,6 @@
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "cmsis_os.h"
#include "adc.h"
#include "dma.h"
#include "spi.h"
#include "tim.h"
@@ -94,7 +93,6 @@ int main(void)
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_DMA_Init();
MX_ADC1_Init();
MX_SPI1_Init();
MX_TIM1_Init();
MX_TIM2_Init();
@@ -135,7 +133,6 @@ void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
@@ -165,12 +162,6 @@ void SystemClock_Config(void)
{
Error_Handler();
}
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC;
PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
Error_Handler();
}
}
/* USER CODE BEGIN 4 */