2015-08-13 12:56:50 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-08-14 13:55:12 +00:00
|
|
|
typedef uint32_t time_t;
|
|
|
|
|
2015-08-13 12:56:50 +00:00
|
|
|
/**
|
|
|
|
* @brief Initializes the hardware timer.
|
|
|
|
*/
|
|
|
|
void timer_init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Gets the number of ticks the timer has ticked.
|
|
|
|
* @return
|
|
|
|
*/
|
2015-08-14 13:55:12 +00:00
|
|
|
time_t __cdecl timer_get();
|
2015-08-13 12:56:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets the timer to a given value.
|
|
|
|
* @param time The number of ticks the timer should have now.
|
|
|
|
*/
|
2015-08-14 13:55:12 +00:00
|
|
|
void __cdecl timer_set(time_t time);
|
2015-08-13 12:56:50 +00:00
|
|
|
|
2015-08-15 22:45:12 +00:00
|
|
|
/**
|
|
|
|
* @brief Adds a callback to the timer.
|
|
|
|
* @param interval The period time when the callback is called.
|
|
|
|
* @param callback The callback that is called.
|
|
|
|
*/
|
|
|
|
void __cdecl timer_add_callback(time_t interval, void (*callback)(time_t));
|
|
|
|
|
2015-08-13 12:56:50 +00:00
|
|
|
/**
|
|
|
|
* @brief Waits until a certain time elapsed.
|
|
|
|
* @param ticks The number of ticks to wait
|
|
|
|
*/
|
2015-08-14 13:55:12 +00:00
|
|
|
void __cdecl sleep(time_t ticks);
|
2015-08-13 12:56:50 +00:00
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|