|
- /**
- * @file time.h
- * @author zhangcheng
- * @brief 定时器及PWM输出接口文件
- * @version v0.1
- * @date 2025-08-06
- *
- * @copyright Copyright (c) 2025
- */
-
-
- #ifndef _time_H
- #define _time_H
-
- #include "stm32f4xx.h"
-
-
- /**
- * @brief 定时器数据结构
- * @details
- * @note
- * @attention
- */
- typedef struct TIM
- {
- TIM_TypeDef *TIM;
- int8_t (*init)(struct TIM *tim, uint16_t psc, uint32_t per);
- void (*deInit)(struct TIM *tim);
- void (*setPsc)(struct TIM *tim, uint16_t psc);
- void (*setPer)(struct TIM *tim, uint32_t per);
- void (*open)(struct TIM *tim);
- void (*close)(struct TIM *tim);
- void (*openIrq)(struct TIM *tim);
- void (*closeIrq)(struct TIM *tim);
- void (*registerIrq)(struct TIM *tim, void (*registerFunc)(void *pArg),
- void *pArg);
- void (*pwmInit)(struct TIM *tim);
- void (*pwmDeInit)(struct TIM *tim);
- void (*pwmSetPulse)(struct TIM *tim, uint32_t pulse);
- } TIM_OBJ;
-
-
- /**
- * @brief 获取定时器
- * @details
- *
- * @param[in] *timName 定时器名称
- *
- * @param[out] *timObj 接收定时器参数地址
- *
- * @return int8_t 返回结果
- * @retval 0 成功
- * @retval -1 失败
- *
- * @note *timName "timx" x : 10、11、13、14
- */
- int8_t GetTimObj(char *timName, TIM_OBJ *timObj);
-
- #endif
|