diff options
author | Joel Challis <git@zvecr.com> | 2021-11-19 18:41:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-19 10:41:02 -0800 |
commit | 2728603fe6d73e805a539d337fd01051c46ca806 (patch) | |
tree | 5c83ffc7efa112da870bd5d8502a9d91d4792f35 /platforms/arm_atsam/timer.c | |
parent | 43b9e23bae12916d5161f03700c9bfe46737324b (diff) |
Move tmk_core/common/<plat> (#13918)
Diffstat (limited to 'platforms/arm_atsam/timer.c')
-rw-r--r-- | platforms/arm_atsam/timer.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/platforms/arm_atsam/timer.c b/platforms/arm_atsam/timer.c new file mode 100644 index 0000000000..b835dd5e75 --- /dev/null +++ b/platforms/arm_atsam/timer.c @@ -0,0 +1,19 @@ +#include "samd51j18a.h" +#include "timer.h" +#include "tmk_core/protocol/arm_atsam/clks.h" + +void set_time(uint64_t tset) { ms_clk = tset; } + +void timer_init(void) { timer_clear(); } + +uint16_t timer_read(void) { return (uint16_t)ms_clk; } + +uint32_t timer_read32(void) { return (uint32_t)ms_clk; } + +uint64_t timer_read64(void) { return ms_clk; } + +uint16_t timer_elapsed(uint16_t tlast) { return TIMER_DIFF_16(timer_read(), tlast); } + +uint32_t timer_elapsed32(uint32_t tlast) { return TIMER_DIFF_32(timer_read32(), tlast); } + +void timer_clear(void) { set_time(0); } |