14 lines
476 B
C
14 lines
476 B
C
|
#ifndef SYSTICK_H
|
||
|
#define SYSTICK_H
|
||
|
#include <stdint.h>
|
||
|
#define SYSTICK_FREQUENCY 10000
|
||
|
|
||
|
static inline uint32_t us_ticks(uint32_t us) { return us * SYSTICK_FREQUENCY / 1000000; }
|
||
|
static inline uint32_t ms_ticks(uint32_t ms) { return ms * SYSTICK_FREQUENCY / 1000; }
|
||
|
static inline uint32_t s_ticks(uint32_t s) { return s * SYSTICK_FREQUENCY; }
|
||
|
static inline uint32_t ticks_ms(uint32_t ticks) { return ticks * 1000 / SYSTICK_FREQUENCY; }
|
||
|
|
||
|
extern volatile uint32_t tick;
|
||
|
|
||
|
#endif
|