#define STM8_FREQ_MHZ 16
#define PWM_FREQUENCY 14000
#define MINIMUM_OFF_TIME 9500 // (unit ns)
static const u16 hArrPwmVal = ((u16)((STM8_FREQ_MHZ * (u32)1000000)/PWM_FREQUENCY));
static const u16 hMaxDutyCnt = hArrPwmVal - (((u32)STM8_FREQ_MHZ * MINIMUM_OFF_TIME)/1000);//PWM信号周期 |