summaryrefslogtreecommitdiff
path: root/code/ecp/fe310/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'code/ecp/fe310/time.c')
-rw-r--r--code/ecp/fe310/time.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/code/ecp/fe310/time.c b/code/ecp/fe310/time.c
index 2ff98cb..4b8b2a7 100644
--- a/code/ecp/fe310/time.c
+++ b/code/ecp/fe310/time.c
@@ -1,5 +1,7 @@
#include <core.h>
+#include <eos/timer.h>
+
#include "encoding.h"
#include "platform.h"
@@ -10,9 +12,14 @@ static ecp_cts_t t_abstime_ms(ecp_cts_t msec) {
return now_ms + msec;
}
+static void t_timer_set(ecp_cts_t next) {
+ uint32_t tick = next * (uint64_t)RTC_FREQ / 1000;
+ eos_timer_set(tick, 1);
+}
+
int ecp_time_init(ECPTimeIface *t) {
t->init = 1;
t->abstime_ms = t_abstime_ms;
- t->sleep_ms = NULL;
+ t->timer_set = t_timer_set;
return 0;
}