diff options
author | root <root@lab.panaceas.james.local> | 2018-04-08 01:14:30 +0100 |
---|---|---|
committer | root <root@lab.panaceas.james.local> | 2018-04-08 01:14:30 +0100 |
commit | 25e6afd831b94b9735cc6691ee19c8edc921aca7 (patch) | |
tree | cc194e7cb067c929b3e8bc9c03552d2d300c301b /app/abs.c | |
download | clock-25e6afd831b94b9735cc6691ee19c8edc921aca7.tar.gz clock-25e6afd831b94b9735cc6691ee19c8edc921aca7.tar.bz2 clock-25e6afd831b94b9735cc6691ee19c8edc921aca7.zip |
working decoding
Diffstat (limited to 'app/abs.c')
-rw-r--r-- | app/abs.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/app/abs.c b/app/abs.c new file mode 100644 index 0000000..769da7a --- /dev/null +++ b/app/abs.c @@ -0,0 +1,41 @@ +#include "project.h" + + +static uint32_t high_tick; + + +uint64_t abs_extend (uint32_t now) +{ + static uint32_t then; + + + uint64_t ret; + + + if (now < then) + high_tick++; + + then = now; + + + ret = high_tick; + ret <<= 32; + ret |= now; + + return ret; +} + + + + +uint64_t abs_get (void) +{ + uint32_t now = SCS_DWT_CYCCNT; + return abs_extend (now); +} + + +void abs_slow_tick() +{ + abs_get(); +} |