stm32 系统嘀嗒(SysTick) 定时器
void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource)
位于 misc.c 文件中
然后在core_cm3.h 文件中,定义了一个内联函数,完成定时配置,中断开启,定时器开启的功能。
/* ################################## SysTick function ############################################ */
#if (!defined (__Vendor_SysTickConfig)) || (__Vendor_SysTickConfig == 0)
/* SysTick constants */
#define SYSTICK_ENABLE 0 /* Config-Bit to start or stop the SysTick Timer */
#define SYSTICK_TICKINT 1 /* Config-Bit to enable or disable the SysTick interrupt */
#define SYSTICK_CLKSOURCE 2 /* Clocksource has the offset 2 in SysTick Control and Status Register */
#define SYSTICK_MAXCOUNT ((1<24) -1) /* SysTick MaxCount */
/**
* @brief Initialize and start the SysTick counter and its interrupt.
*
* @param uint32_t ticks is the number of ticks between two interrupts
* @return none
*
* Initialise the system tick timer and its interrupt and start the
* system tick timer / counter in free running mode to generate
* periodical interrupts.
*/
static __INLINE uint32_t SysTick_Config(uint32_t ticks)
{
if (ticks > SYSTICK_MAXCOUNT) return (1); /* Reload value impossible */
SysTick->LOAD = (ticks & SYSTICK_MAXCOUNT) - 1; /* set reload register */
NVIC_SetPriority (SysTick_IRQn, (1<__NVIC_PRIO_BITS) - 1); /* set Priority for Cortex-M0 System Interrupts */
SysTick->VAL = (0x00); /* Load the SysTick Counter Value */
SysTick->CTRL = (1 < SYSTICK_CLKSOURCE) | (1 return (0); /* Function successful */ } #endif
老的库文件的是6个函数
1.void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource)
下面的这几个的功能都已经被SysTick_Config() 所替代
2.voidSysTick_SetReload(void)
3.voidSysTick_CounterCmd(void)
4.voidSysTick_ITConfig(void)
5.voidSysTick_GetCounter(void)
6.voidSysTick_GetFlagStatus(void)
stm32SysTick定时 相关文章:
- STM32--SYSTICK超简易定时器(12-03)
- STM32学习之路(四)——Sys Tick定时器(12-02)
- STM32学习笔记——使用SysTick定时器做延时(11-28)
- stm32 系统嘀嗒(SysTick) 定时器 (2)-解决时钟分频问题(11-17)
- stm32 学习笔记 systick定时器(11-13)
- Windows CE 进程、线程和内存管理(11-09)