aboutsummaryrefslogtreecommitdiff
path: root/kernel/main.c
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2011-03-11 01:28:00 +0000
committerDimitri Sokolyuk <demon@dim13.org>2011-03-11 01:28:00 +0000
commitb8335062ae7d19bd27e6131fadcd7d3a116c4992 (patch)
tree3bd226885fb6f2ca24ee300a44d7b51ffb8d2706 /kernel/main.c
DimOS RT
Diffstat (limited to 'kernel/main.c')
-rw-r--r--kernel/main.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/kernel/main.c b/kernel/main.c
new file mode 100644
index 0000000..3a1921c
--- /dev/null
+++ b/kernel/main.c
@@ -0,0 +1,52 @@
+/* $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 "kernel.h"
+#include "tasks.h"
+
+uint8_t red, green, blue;
+
+struct rgbarg rgbargs[] = {
+ { &red, &green, &blue }
+};
+
+struct pwmarg pwmargs[] = {
+ { &red, PB2, 0, 0 },
+ { &green, PB3, 0, 0 },
+ { &blue, PB4, 0, 0 },
+};
+
+int
+main()
+{
+ init(STACK);
+
+ init_uart();
+
+ task(heartbeat, STACK, SEC(0), MSEC(10), 0);
+ task(rgb, STACK, SEC(0), MSEC(10), &rgbargs[0]);
+ task(pwm, STACK, SEC(0), MSEC(10), &pwmargs[0]);
+ task(pwm, STACK, SEC(0), MSEC(10), &pwmargs[1]);
+ task(pwm, STACK, SEC(0), MSEC(10), &pwmargs[2]);
+ task(lcd, STACK, MSEC(40), SEC(1), 0);
+
+ for (;;);
+
+ return 0;
+}