17 #include "stm32w_systick.h"
23 #define CTRL_TICKINT_Set ((u32)0x00000002)
24 #define CTRL_TICKINT_Reset ((u32)0xFFFFFFFD)
43 void SysTick_CLKSourceConfig(u32 SysTick_CLKSource)
46 assert_param(IS_SYSTICK_CLK_SOURCE(SysTick_CLKSource));
48 if (SysTick_CLKSource == SysTick_CLKSource_HCLK)
50 SysTick->CTRL |= SysTick_CLKSource_HCLK;
54 SysTick->CTRL &= SysTick_CLKSource_HCLK_Div8;
66 void SysTick_SetReload(u32 Reload)
69 assert_param(IS_SYSTICK_RELOAD(Reload));
71 SysTick->LOAD = Reload;
85 void SysTick_CounterCmd(u32 SysTick_Counter)
88 assert_param(IS_SYSTICK_COUNTER(SysTick_Counter));
90 if (SysTick_Counter == SysTick_Counter_Enable)
92 SysTick->CTRL |= SysTick_Counter_Enable;
94 else if (SysTick_Counter == SysTick_Counter_Disable)
96 SysTick->CTRL &= SysTick_Counter_Disable;
100 SysTick->VAL = SysTick_Counter_Clear;
112 void SysTick_ITConfig(FunctionalState NewState)
115 assert_param(IS_FUNCTIONAL_STATE(NewState));
117 if (NewState != DISABLE)
119 SysTick->CTRL |= CTRL_TICKINT_Set;
123 SysTick->CTRL &= CTRL_TICKINT_Reset;
134 u32 SysTick_GetCounter(
void)
136 return(SysTick->VAL);
150 FlagStatus SysTick_GetFlagStatus(u8 SysTick_FLAG)
152 u32 statusreg = 0, tmp = 0 ;
153 FlagStatus bitstatus = RESET;
156 assert_param(IS_SYSTICK_FLAG(SysTick_FLAG));
159 tmp = SysTick_FLAG >> 3;
163 statusreg = SysTick->CTRL;
167 statusreg = SysTick->CALIB;
170 if ((statusreg & ((u32)1 << SysTick_FLAG)) != (u32)RESET)