/** @file stk.h * Module handling the system timer (systick or STK for short) * * The module provides functions to configure and use the system timer embedded * in the cortex m core */ #ifndef _STK_H_ #define _STK_H_ //--includes-------------------------------------------------------------------- #include //--type definitions------------------------------------------------------------ typedef void (*StkCallback)(void); //--functions------------------------------------------------------------------- /** * Configures the system timer to run at the specified period in µs and call the * given callback when said period is reached. Due to the limited configuration * options, 1.8s is the maximum period when running in speed preset (see rcc * module). The maximum period can be substantially increased by reducing the * core clock */ uint32_t stk_configure(uint32_t period_us, StkCallback cb); /** * Resets the system timer configuration, restoring the default configuration * and stopping it */ void stk_reset(void); /** * Starts the system timer. The timer will run until stopped */ void stk_start(void); /** * Stops the system timer */ void stk_stop(void); /** * Read the current value of the timer's counter */ uint32_t stk_read(void); #endif //_STK_H_