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

@@ -1,52 +0,0 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file adc.h
* @brief This file contains all the function prototypes for
* the adc.c file
******************************************************************************
* @attention
*
* Copyright (c) 2026 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __ADC_H__
#define __ADC_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
extern ADC_HandleTypeDef hadc1;
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
void MX_ADC1_Init(void);
/* USER CODE BEGIN Prototypes */
/* USER CODE END Prototypes */
#ifdef __cplusplus
}
#endif
#endif /* __ADC_H__ */

View File

@@ -59,8 +59,6 @@ void Error_Handler(void);
/* Private defines -----------------------------------------------------------*/
#define RUN_LED_Pin GPIO_PIN_13
#define RUN_LED_GPIO_Port GPIOC
#define HC_SR04_Pin GPIO_PIN_0
#define HC_SR04_GPIO_Port GPIOA
#define M4_W_Pin GPIO_PIN_2
#define M4_W_GPIO_Port GPIOA
#define M4_S_Pin GPIO_PIN_3
@@ -102,6 +100,10 @@ void Error_Handler(void);
#define H1_GPIO_Port GPIOD
#define LED_Pin GPIO_PIN_15
#define LED_GPIO_Port GPIOD
#define ECHO_Pin GPIO_PIN_8
#define ECHO_GPIO_Port GPIOC
#define TRIG_Pin GPIO_PIN_9
#define TRIG_GPIO_Port GPIOC
#define M3_W_Pin GPIO_PIN_15
#define M3_W_GPIO_Port GPIOA
#define M3_S_Pin GPIO_PIN_3

View File

@@ -34,7 +34,7 @@
*/
#define HAL_MODULE_ENABLED
#define HAL_ADC_MODULE_ENABLED
/*#define HAL_ADC_MODULE_ENABLED */
/*#define HAL_CRYP_MODULE_ENABLED */
/*#define HAL_CAN_MODULE_ENABLED */
/*#define HAL_CAN_LEGACY_MODULE_ENABLED */