1.CH32定时器驱动更新。
2.文档修正。
This commit is contained in:
@@ -175,6 +175,13 @@ static int drv_timer_configure(struct mr_timer *timer, int state)
|
||||
/* Update timer clock(MHz) */
|
||||
timer->info->clk = pclk / 1000000;
|
||||
|
||||
/* Configure timer */
|
||||
TIM_TimeBaseInitStructure.TIM_Period = 0;
|
||||
TIM_TimeBaseInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;
|
||||
TIM_TimeBaseInitStructure.TIM_RepetitionCounter = 0;
|
||||
TIM_TimeBaseInitStructure.TIM_CounterMode = TIM_CounterMode_Up;
|
||||
TIM_TimeBaseInit(timer_data->instance, &TIM_TimeBaseInitStructure);
|
||||
|
||||
/* Configure NVIC */
|
||||
NVIC_InitStructure.NVIC_IRQChannel = timer_data->irq;
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
|
||||
@@ -182,13 +189,6 @@ static int drv_timer_configure(struct mr_timer *timer, int state)
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = state;
|
||||
NVIC_Init(&NVIC_InitStructure);
|
||||
TIM_ITConfig(timer_data->instance, TIM_IT_Update, state);
|
||||
|
||||
/* Configure timer */
|
||||
TIM_TimeBaseInitStructure.TIM_Period = 0;
|
||||
TIM_TimeBaseInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;
|
||||
TIM_TimeBaseInitStructure.TIM_RepetitionCounter = 0;
|
||||
TIM_TimeBaseInitStructure.TIM_CounterMode = TIM_CounterMode_Up;
|
||||
TIM_TimeBaseInit(timer_data->instance, &TIM_TimeBaseInitStructure);
|
||||
return MR_EOK;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,8 +84,7 @@ int mr_dev_ioctl(int desc, int cmd, void *args);
|
||||
|
||||
```c
|
||||
/* 定义引脚编号 */
|
||||
#define
|
||||
PIN_NUMBER 45
|
||||
#define PIN_NUMBER 45
|
||||
|
||||
/* 设置引脚编号 */
|
||||
mr_dev_ioctl(ds, MR_CTL_PIN_SET_NUMBER, mr_make_local(int, PIN_NUMBER));
|
||||
@@ -118,8 +117,7 @@ mr_dev_ioctl(ds, MR_CTL_PIN_GET_NUMBER, &number);
|
||||
|
||||
```c
|
||||
/* 定义引脚模式 */
|
||||
#define
|
||||
PIN_MODE MR_PIN_MODE_OUTPUT
|
||||
#define PIN_MODE MR_PIN_MODE_OUTPUT
|
||||
|
||||
/* 设置引脚模式 */
|
||||
mr_dev_ioctl(ds, MR_CTL_PIN_SET_MODE, mr_make_local(int, PIN_MODE));
|
||||
|
||||
Reference in New Issue
Block a user