高中生
最后登录1970-1-1
在线时间 小时
注册时间2019-1-10
|
[mw_shl_code=c,true]static __INLINE uint32_t SysTick_Config(uint32_t ticks)
{
if (ticks > SysTick_LOAD_RELOAD_Msk) return (1); /* Reload value impossible */
SysTick->LOAD = (ticks & SysTick_LOAD_RELOAD_Msk) - 1; /* set reload register */
NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority for Cortex-M0 System Interrupts */
SysTick->VAL = 0; /* Load the SysTick Counter Value */
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
SysTick_CTRL_TICKINT_Msk |
SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
return (0); /* Function successful */
}[/mw_shl_code]
今天在看SysTick的内容,想请问一下各位,为什么设置重载寄存器时,要[mw_shl_code=c,true](ticks & SysTick_LOAD_RELOAD_Msk) - 1[/mw_shl_code],不能直接[mw_shl_code=c,true]ticks - 1[/mw_shl_code]吗?
|
|