最近使用GD32L233xxxx开发项目,使用基本定时器创建一个timerbase的方法,以类的形式总结如下:
timer base basic functions is as follow:
static void cnt_timer_init() {
timer_oc_parameter_struct timer_ocinitpara;
timer_parameter_struct timer_initpara;
timer_ic_parameter_struct timer_icinitpara;
nvic_irq_enable(timer_dev.cnt_tim_irq, timer_dev.cnt_tim_priority);
rcu_periph_clock_enable(timer_dev.cnt_tim_rcu);
/* deinit a TIMER */
timer_deinit(timer_dev.cnt_tim_pre);
/* initialize TIMER init parameter struct */
timer_struct_para_init(&timer_initpara);
/* TIMER1 configuration */
timer_initpara.prescaler = timer_dev.cnt_tim_prescaler;
timer_initpara.alignedmode = TIMER_COUNTER_EDGE;
timer_initpara.count