在uni_hal_pwm.h里看到了,不过一般都是用user接口,你用hal的也行,
extern PWM_ERROR_CODE uni_hal_pwm_init(TIMER_INDEX TimerIdx,uint8_t PwmIoSel,PWM_StructInit *PWMParam);
typedef struct __PWM_StructInit
{
uint8_t CounterMode; //PWM计数模式,参数取值范围 #PWM_COUNTER_MODE
uint8_t OutputType; //PWM输出类型,参数取值为#PWM_OUTPUT_TYPE
uint32_t FreqDiv; //PWM频率与系统时钟的分频比,取值范围[1, PWM_MAX_FREQ_DIV_VALUE]
uint16_t Duty; //占空比,取值范围[0~100]对应占空比为[0%~100%]
bool DMAReqEnable; //是否使能DMA从Mem搬运占空比到外设中,参数取值: 1 -- 使能DMA请求; 0 -- 禁能DMA请求
}PWM_StructInit;
/**
* @brief PWM输出类型定义
*/
typedef enum __PWM_OUTPUT_TYPE
{
PWM_OUTPUT_FORCE_LOW = 4, //强制输出低电平
PWM_OUTPUT_FORCE_HIGH = 5, //强制输出高电平
PWM_OUTPUT_SINGLE_1 = 6, //标准输出:Duty为高脉冲占空比
PWM_OUTPUT_SINGLE_2 = 7, //标准输出:Duty为负脉冲占空比
PWM_OUTPUT_ONE_PULSE = 8 //输出一个脉冲后结束
}PWM_OUTPUT_TYPE;
|