44 lines
938 B
C
44 lines
938 B
C
#ifndef __SYSTICK_H__
|
|
#define __SYSTICK_H__
|
|
|
|
#include <stdint.h>
|
|
|
|
/**
|
|
* @brief Reload value for the systick timer.
|
|
*
|
|
* This value has to be configured to set the systick to a one milliscond tick interval
|
|
* The default value is 168000, which results in a 1ms tick for 168 MHz CPU speed
|
|
*/
|
|
#define SYSTICK_RELOAD (168000UL)
|
|
|
|
/**
|
|
* @brief Variable used by the systick_wait_ms function
|
|
*/
|
|
extern volatile uint32_t wait_tick_ms;
|
|
|
|
/**
|
|
* @brief Systemclock in milliseconds.
|
|
*
|
|
* This value must not be reset during the whole runtime.
|
|
*
|
|
*/
|
|
extern volatile uint64_t global_tick_ms;
|
|
|
|
/**
|
|
* @brief Setup the Systick timer to generate a 1 ms tick
|
|
*/
|
|
void systick_setup(void);
|
|
|
|
/**
|
|
* @brief Wait for x milliseconds
|
|
*
|
|
* This function is not reentrant and must not be called from an interrupt
|
|
*
|
|
* @warning Do not use in interrupt context
|
|
* @param ms wait time in ms
|
|
*/
|
|
void systick_wait_ms(uint32_t ms);
|
|
|
|
|
|
#endif /* __SYSTICK_H__ */
|