23 lines
459 B
C
23 lines
459 B
C
|
|
#ifndef TIMER_H
|
||
|
|
#define TIMER_H
|
||
|
|
#include <stdint.h>
|
||
|
|
|
||
|
|
extern _Atomic uint64_t sys_ticks;
|
||
|
|
extern const uint64_t tick_delta;
|
||
|
|
|
||
|
|
// Initialize timer (1ms ticks)
|
||
|
|
void timer_init();
|
||
|
|
|
||
|
|
// Increment the system tick counter
|
||
|
|
void timer_tick();
|
||
|
|
|
||
|
|
// Get current time in milliseconds
|
||
|
|
uint64_t timer_get_ms();
|
||
|
|
|
||
|
|
// Delay for 'ms' milliseconds (blocking)
|
||
|
|
void delay_ms(uint64_t ms);
|
||
|
|
|
||
|
|
// Sleep for 'ms' milliseconds (non-blocking, if possible)
|
||
|
|
void sleep_ms(uint64_t ms);
|
||
|
|
|
||
|
|
#endif
|