Initial port to the bitbox.
Uses the conio driver with a few tweaks to look a little less ugly.
Still not as good as the VNC one, but we don't have a 4 color textmode
(yet?). Some more custom chars and palette efforts like in the VNC
driver could make it look better, still.
TODO
- Embed more apps (but most of them are network related)
- Mouse support (USB)
- Network support (ENC28J60 or other)
- Filesystem on SD card + add the "directory" app
- Dynamic loader is not really needed, we can easily fit all apps in
flash (more easily than in RAM, actually).
diff --git a/contiki-bitbox/ctk/ctk-arch.c b/contiki-bitbox/ctk/ctk-arch.c
new file mode 100644
index 0000000..dae9818
--- /dev/null
+++ b/contiki-bitbox/ctk/ctk-arch.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2017, Adrien Destugues, pulkomandy@pulkomandy.tk
+ * Distributed under terms of the MIT license.
+ */
+
+
+#include "ctk-arch.h"
+
+#include "lib/textmode/textmode.h"
+
+struct event e = {0};
+
+ctk_arch_key_t
+ctk_arch_getkey(void)
+{
+ while (e.type != evt_keyboard_press || e.kbd.sym < 8)
+ {
+ events_poll();
+ e = event_get();
+ }
+
+ return e.kbd.sym;
+}
+
+unsigned char kbhit(void)
+{
+ events_poll();
+ e = event_get();
+ return e.type == evt_keyboard_press && e.kbd.sym >= 8;
+}
+
+void
+ctk_arch_draw_char(char c,
+ unsigned char x, unsigned char y,
+ unsigned char reversed,
+ unsigned char color)
+{
+ vram[y][x] = c;
+ vram_attr[y][x] = color;
+}