- 在tim.h中声明TIM1句柄和初始化函数 - 在tim.c中实现TIM1 PWM初始化配置,用于生成ADC采样时钟 - 在main.c中初始化TIM1并启动PWM输出 - 更新STM32CubeMX项目文件(.ioc),添加TIM1配置 🐛 fix(gpio): 修复GPIO配置错误 - 修正gpio.c中ADC_SYNC引脚的GPIO端口配置,使用正确的端口宏 - 移除对PA8引脚的错误配置,PA8现在用于TIM1 PWM输出 ♻️ refactor(main): 重构ADC采样触发逻辑 - 移除使用GPIO手动触发ADC采样的代码 - 注释掉TIM2中断回调中控制PA8的代码,该引脚现在用于时钟输出
58 lines
1.4 KiB
C
58 lines
1.4 KiB
C
/* USER CODE BEGIN Header */
|
|
/**
|
|
******************************************************************************
|
|
* @file tim.h
|
|
* @brief This file contains all the function prototypes for
|
|
* the tim.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 __TIM_H__
|
|
#define __TIM_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "main.h"
|
|
|
|
/* USER CODE BEGIN Includes */
|
|
|
|
/* USER CODE END Includes */
|
|
|
|
extern TIM_HandleTypeDef htim1;
|
|
|
|
extern TIM_HandleTypeDef htim2;
|
|
|
|
/* USER CODE BEGIN Private defines */
|
|
|
|
/* USER CODE END Private defines */
|
|
|
|
void MX_TIM1_Init(void);
|
|
void MX_TIM2_Init(void);
|
|
|
|
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
|
|
|
|
/* USER CODE BEGIN Prototypes */
|
|
|
|
/* USER CODE END Prototypes */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __TIM_H__ */
|
|
|