aboutsummaryrefslogtreecommitdiff
path: root/kernel/ctrl.c
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2011-07-12 00:54:33 +0000
committerDimitri Sokolyuk <demon@dim13.org>2011-07-12 00:54:33 +0000
commitb4a9b392c57ca8b3f740dd3035b1f43b4ad583b4 (patch)
treeeeda7f987ad9abf16a5954ce250dc51cf0b1ac41 /kernel/ctrl.c
parent42a1324ba256967ca11fa1a81ef3d2ac3d10c491 (diff)
add clock, redesign timer, tweak stack values
Diffstat (limited to 'kernel/ctrl.c')
-rw-r--r--kernel/ctrl.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/kernel/ctrl.c b/kernel/ctrl.c
new file mode 100644
index 0000000..3becb49
--- /dev/null
+++ b/kernel/ctrl.c
@@ -0,0 +1,40 @@
+/* $Id$ */
+/*
+ * Copyright (c) 2011 Dimitri Sokolyuk <demon@dim13.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <inttypes.h>
+#include <avr/io.h>
+#include <stdio.h>
+#include "kernel.h"
+#include "tasks.h"
+
+void
+ctrl(void *arg)
+{
+ struct ctrlarg *a = arg;
+
+ update(0, MSEC(500));
+
+ for (;;) {
+ sprintf(a->lcd->first, "the time is now:");
+ sprintf(a->lcd->second, "%4d:%.2d:%.2d:%.2d",
+ a->clock->d,
+ a->clock->h,
+ a->clock->m,
+ a->clock->s);
+ sleep(SOFT, MSEC(500));
+ }
+}