summaryrefslogtreecommitdiff
path: root/src/app/posix-text-to-ss1306
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-11-22 22:30:08 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-11-22 22:30:08 +0100
commit7c52c7ea67f6e9633ca43315176f3f303ae868ad (patch)
treede6fb6a9cb7386cc31e5b8e2aaa5023ef89f5ab5 /src/app/posix-text-to-ss1306
parent7ec9a3d7e0bd3e3c65617cccfb4c1f11dab4f645 (diff)
add posix stdin → ssd1306 app
Diffstat (limited to 'src/app/posix-text-to-ss1306')
-rw-r--r--src/app/posix-text-to-ss1306/Kconfig6
-rw-r--r--src/app/posix-text-to-ss1306/Makefile.inc14
-rw-r--r--src/app/posix-text-to-ss1306/main.cc42
3 files changed, 62 insertions, 0 deletions
diff --git a/src/app/posix-text-to-ss1306/Kconfig b/src/app/posix-text-to-ss1306/Kconfig
new file mode 100644
index 0000000..c103631
--- /dev/null
+++ b/src/app/posix-text-to-ss1306/Kconfig
@@ -0,0 +1,6 @@
+# Copyright 2021 Daniel Friesel
+#
+# SPDX-License-Identifier: CC0-1.0
+
+prompt "POSIX stdin to SSD1306"
+depends on arch_posix && driver_ssd1306
diff --git a/src/app/posix-text-to-ss1306/Makefile.inc b/src/app/posix-text-to-ss1306/Makefile.inc
new file mode 100644
index 0000000..8c4936b
--- /dev/null
+++ b/src/app/posix-text-to-ss1306/Makefile.inc
@@ -0,0 +1,14 @@
+# vim:ft=make
+#
+# Copyright 2021 Daniel Friesel
+#
+# SPDX-License-Identifier: CC0-1.0
+
+ifdef app
+ loop = 1
+ override arch_drivers += ,i2c
+ CONFIG_driver_ssd1306 = y
+ COMMON_FLAGS += -DCONFIG_driver_ssd1306
+ CONFIG_driver_ssd1306_width = 128
+ CONFIG_driver_ssd1306_height = 64
+endif
diff --git a/src/app/posix-text-to-ss1306/main.cc b/src/app/posix-text-to-ss1306/main.cc
new file mode 100644
index 0000000..a3fd085
--- /dev/null
+++ b/src/app/posix-text-to-ss1306/main.cc
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2021 Daniel Friesel
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+#include "arch.h"
+#include "driver/stdout.h"
+#if defined(MULTIPASS_ARCH_HAS_I2C) && !defined(CONFIG_driver_softi2c)
+#include "driver/i2c.h"
+#else
+#include "driver/soft_i2c.h"
+#endif
+#include "driver/ssd1306.h"
+#include "object/framebuffer.h"
+#include "lib/pixelfont/pixeloperator_mirrored.h"
+
+#include <stdio.h>
+
+char buf[32];
+
+void loop()
+{
+}
+
+int main(void)
+{
+ arch.setup();
+ kout.setup();
+ i2c.setup();
+ ssd1306.init();
+
+ fb.clear();
+ ssd1306.showImage(fb.data, fb.width * fb.height / 8);
+ fb.setFont(pixeloperator_mirrored);
+
+ while (fgets(buf, 32, stdin)) {
+ fb << buf;
+ ssd1306.showImage(fb.data, fb.width * fb.height / 8);
+ }
+
+ return 0;
+}