From 25e6afd831b94b9735cc6691ee19c8edc921aca7 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 8 Apr 2018 01:14:30 +0100 Subject: working decoding --- app/abs.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 app/abs.c (limited to 'app/abs.c') 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(); +} -- cgit v1.2.3