summaryrefslogtreecommitdiffstats
path: root/app/alarm.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/alarm.c')
-rw-r--r--app/alarm.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/app/alarm.c b/app/alarm.c
new file mode 100644
index 0000000..ed503db
--- /dev/null
+++ b/app/alarm.c
@@ -0,0 +1,35 @@
+#include "project.h"
+
+#define ALARM_LENGTH 30
+
+EPOCH alarm;
+
+static void alarm_off (void)
+{
+ led5_set (0);
+}
+
+
+static void alarm_on (void)
+{
+ led5_set (1);
+}
+
+
+
+void alarm_dispatch (void)
+{
+ uint64_t abs = ref_get();
+ EPOCH d, e = ref_decompose (abs);
+
+ d = time_epoch_sub (e, alarm);
+
+ if ((d.s < 0) || (d.s > ALARM_LENGTH)) alarm_off();
+ else alarm_on();
+}
+
+
+
+
+
+