Add method to clear the systick value, that is undefined at startup.
This commit is contained in:
@@ -46,6 +46,10 @@
|
||||
* The counter is set to the reload value when the counter starts and after it
|
||||
* reaches zero.
|
||||
*
|
||||
* @note The systick counter value might be undefined upon startup. To get
|
||||
* predictable behavior, it is a good idea to set or clear the counter after
|
||||
* set reload. @seealso systick_clear
|
||||
*
|
||||
* @param[in] value uint32_t. 24 bit reload value.
|
||||
*/
|
||||
|
||||
@@ -175,6 +179,17 @@ uint8_t systick_get_countflag(void)
|
||||
return (STK_CSR & STK_CSR_COUNTFLAG) ? 1 : 0;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @brief SysTick Clear counter Value.
|
||||
*
|
||||
* The counter value is cleared. Useful for well defined startup.
|
||||
*/
|
||||
|
||||
void systick_clear(void)
|
||||
{
|
||||
STK_CVR = 0;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @brief SysTick Get Calibration Value
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user