-
-
Save MayaPosch/62653ebd97f8c0e84d9c225844445cf4 to your computer and use it in GitHub Desktop.
STM32 Timer SysTick init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Timer::Timer() { | |
// Set reload register to generate an interrupt every millisecond. | |
SysTick->LOAD = (uint32_t)((SystemCoreClock / 1000) - 1); | |
// Reset the SysTick counter value. | |
SysTick->VAL = 0UL; | |
// Set SysTick source and IRQ. | |
SysTick->CTRL = (SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_TICKINT_Msk); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment