You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
485 B
25 lines
485 B
#ifndef PWM_CONTROL_H
|
|
#define PWM_CONTROL_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
// 定义枚举类型来选择不同的PWM输出通道
|
|
typedef enum {
|
|
PWM_PUMP_PUL = 0,
|
|
PWM_LASER,
|
|
PWM_GY
|
|
} PWM_Channel_TypeDef;
|
|
|
|
#include <stdint.h>
|
|
// 初始化定时器和GPIO
|
|
void TIM_PWM_Init(void);
|
|
|
|
// 更新指定通道的PWM频率和占空比
|
|
void Update_PWM(PWM_Channel_TypeDef channel, uint32_t frequency, uint8_t duty_cycle);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|