~ruther/qmk_firmware

ref: af71f9b3f68cbf56fd536cbb389771afe8b6a22e qmk_firmware/platforms/arm_atsam/timer.c -rw-r--r-- 593 bytes
af71f9b3 — Rutherther feat: add some shift symbols to symbol layer 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#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);
}
Do not follow this link