aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/console.h11
-rw-r--r--src/console.c27
2 files changed, 16 insertions, 22 deletions
diff --git a/include/console.h b/include/console.h
index 0cb62cdd..e0bf7de6 100644
--- a/include/console.h
+++ b/include/console.h
@@ -22,13 +22,22 @@
#define CONSOLE_H
#ifndef GDISP_NEED_CONSOLE
- #undef GDISP_NEED_CONSOLE
+ #define GDISP_NEED_CONSOLE FALSE
#endif
#if GDISP_NEED_CONSOLE
#include "gdisp.h"
+ /**
+ * @extends BaseAsynchronousChannelVMT
+ *
+ * @brief @p GConsole virtual methods table.
+ */
+struct GConsoleVMT {
+ _base_asynchronous_channel_methods
+};
+
/**
* @extends BaseAsynchronousChannel
*
diff --git a/src/console.c b/src/console.c
index 6b76d96e..ba94e640 100644
--- a/src/console.c
+++ b/src/console.c
@@ -24,23 +24,14 @@
#if GDISP_NEED_CONSOLE
-/**
- * @extends BaseAsynchronousChannelVMT
- *
- * @brief @p GConsole virtual methods table.
- */
-struct GConsoleVMT {
- _base_asynchronous_channel_methods
-};
-
/*
* Interface implementation. The interface is write only
*/
-static size_t writes(void *ip, const uint8_t *bp, size_t n) {
+static size_t write(void *ip, const uint8_t *bp, size_t n) {
return lcdConsoleWrite((GConsole *)ip, bp, n);
}
-static size_t reads(void *ip, uint8_t *bp, size_t n) {
+static size_t read(void *ip, uint8_t *bp, size_t n) {
(void)ip;
(void)bp;
(void)n;
@@ -48,10 +39,10 @@ static size_t reads(void *ip, uint8_t *bp, size_t n) {
return 0;
}
-static msg_t put(void *ip) {
+static msg_t put(void *ip, uint8_t b) {
(void)ip;
- return RDY_OK;
+ return lcdConsolePut((GConsole *)ip, (char)b);
}
static msg_t get(void *ip) {
@@ -90,17 +81,11 @@ static size_t readt(void *ip, uint8_t *bp, size_t n, systime_t time) {
return 0;
}
-static uint32_t getflags(void *ip) {
- _ch_get_and_clear_flags_impl(ip);
-}
-
static const struct GConsoleVMT vmt = {
- writes, reads, put, get,
- putt, gett, writet, readt,
- getflags
+ write, read, put, get,
+ putt, gett, writet, readt
};
-
msg_t lcdConsoleInit(GConsole *console, coord_t x0, coord_t y0, coord_t width, coord_t height, font_t font, pixel_t bkcolor, pixel_t color) {
console->vmt = &vmt;
/* read font, get height & padding */