Add method to clear the systick value, that is undefined at startup.

This commit is contained in:
Frantisek Burian 2014-01-10 18:25:30 +01:00
parent 3c6e9fd56d
commit 5ba8b10428
2 changed files with 16 additions and 0 deletions

View File

@ -123,6 +123,7 @@ void systick_interrupt_disable(void);
void systick_counter_enable(void);
void systick_counter_disable(void);
uint8_t systick_get_countflag(void);
void systick_clear(void);
uint32_t systick_get_calib(void);

View File

@ -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
*