汇集网友智慧,解决技术难题
国产芯片 GD32 timer SD32F103
赞0
评论
2022-12-20
点击图片添加到编辑器内容中
点击文件名将附件添加到文章中
提交
tyw
315个答案
天意无罪
284个答案
xch
206个答案
jjjyufan
197个答案
coody
187个答案
LcwSwust
144个答案
chunyang
135个答案
tpgf
110个答案
赞0
{
rcu_periph_clock_enable(RCU_GPIOA);
rcu_periph_clock_enable(RCU_AF);
rcu_periph_clock_enable(RCU_TIMER1);
}
static void Timer_Gpio_Init(void)
{
gpio_init(GPIOA, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_0);
}
static void Timer_Config(void)
{
timer_parameter_struct timer_initpara;
// timer_ic_parameter_struct timer_icinitpara;
timer_deinit(TIMER1);
/* initialize TIMER init parameter struct */
timer_struct_para_init(&timer_initpara);
/* TIMER1 configuration */
timer_initpara.prescaler = 0;
timer_initpara.alignedmode = TIMER_COUNTER_EDGE;
timer_initpara.counterdirection = TIMER_COUNTER_UP;
timer_initpara.period = 0xffff;
timer_initpara.clockdivision = TIMER_CKDIV_DIV1;
timer_init(TIMER1, &timer_initpara);
/* slave mode selection : TIMER1 */
/* TIMER1 input trigger : external trigger connected to CI0 */
timer_input_trigger_source_select(TIMER1, TIMER_SMCFG_TRGSEL_CI0FE0);
timer_slave_mode_select(TIMER1, TIMER_SLAVE_MODE_EXTERNAL0);
timer_external_clock_mode1_config(TIMER1, TIMER_EXT_TRI_PSC_OFF, TIMER_ETP_RISING, 0);
timer_enable(TIMER1);
}
评论
2022-12-20
您需要登录后才可以回复 登录 | 注册