#include #include #include "ycdef.h" #include "yc11xx.h" #include "yc11xx_gpio.h" #include "yc11xx_pwm.h" #include "yc11xx_uart.h" #include "system.h" void PWM_Config(GPIO_NUM gpio, PWM_ChxTypeDef pwm_channel, uint16_t pcnt,uint16_t ncnt, PWM_ClkdivDef clk_div,START_TypeDef LEVEL, PWM_SwitchDef SWITCH); void PWM_Test(); void PWM_Config(GPIO_NUM gpio, PWM_ChxTypeDef pwm_channel, uint16_t pcnt,uint16_t ncnt, PWM_ClkdivDef clk_div,START_TypeDef LEVEL, PWM_SwitchDef SWITCH) { PWM_InitTypeDef PWM_InitStruct; PWM_InitStruct.pwm_gpio = gpio; PWM_InitStruct.PWM_Channel = pwm_channel; PWM_InitStruct.HighLevelPeriod = pcnt; PWM_InitStruct.LowLevelPeriod = ncnt; PWM_InitStruct.pwm_ctrl.clk_div = clk_div; PWM_InitStruct.pwm_ctrl.StartLevel = LEVEL; PWM_InitStruct.pwm_ctrl.pwm_switch = SWITCH; PWM_Init(&PWM_InitStruct); } int hcnt=0x3000; int lcnt = 0x3000; void PWM_Test() { MyPrintf("\r\n*********************this is 11XX PWM TEST DEMO***********************\r\n "); PWM_Config(GPIO_19,PWM_CHANNEL_0,hcnt,lcnt,PWM_CLK_DIVISION_0,OutputLow,PWM_ENABLE); } //void _assert_handler(const char* file, int line,const char* func) //{ // while(1); //} int main(void) { printport_init(); PWM_Test(); while(1); }