From de149299ae02d36c8393cbe52ba9025f3ed2de21 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Mon, 2 Nov 2015 21:47:55 +0100 Subject: Adding support for ChibiOS/RT 3.x to console widget streams --- src/gwin/gwin_console.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/gwin') diff --git a/src/gwin/gwin_console.c b/src/gwin/gwin_console.c index e1aed23d..06f7214f 100644 --- a/src/gwin/gwin_console.c +++ b/src/gwin/gwin_console.c @@ -41,6 +41,7 @@ #if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM #define Stream2GWindow(ip) ((GHandle)(((char *)(ip)) - (size_t)(&(((GConsoleObject *)0)->stream)))) +#if CH_KERNEL_MAJOR == 2 static size_t GWinStreamWrite(void *ip, const uint8_t *bp, size_t n) { gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return RDY_OK; } static size_t GWinStreamRead(void *ip, uint8_t *bp, size_t n) { (void)ip; (void)bp; (void)n; return 0; } static msg_t GWinStreamPut(void *ip, uint8_t b) { gwinPutChar(Stream2GWindow(ip), (char)b); return RDY_OK; } @@ -49,6 +50,16 @@ static msg_t GWinStreamGetTimed(void *ip, systime_t timeout) { (void)ip; (void)timeout; return RDY_OK; } static size_t GWinStreamWriteTimed(void *ip, const uint8_t *bp, size_t n, systime_t time) { (void)time; gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return RDY_OK; } static size_t GWinStreamReadTimed(void *ip, uint8_t *bp, size_t n, systime_t time) { (void)ip; (void)bp; (void)n; (void)time; return 0; } +#elif CH_KERNEL_MAJOR == 3 + static size_t GWinStreamWrite(void *ip, const uint8_t *bp, size_t n) { gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return MSG_OK; } + static size_t GWinStreamRead(void *ip, uint8_t *bp, size_t n) { (void)ip; (void)bp; (void)n; return 0; } + static msg_t GWinStreamPut(void *ip, uint8_t b) { gwinPutChar(Stream2GWindow(ip), (char)b); return MSG_OK; } + static msg_t GWinStreamGet(void *ip) {(void)ip; return MSG_OK; } + static msg_t GWinStreamPutTimed(void *ip, uint8_t b, systime_t time) { (void)time; gwinPutChar(Stream2GWindow(ip), (char)b); return MSG_OK; } + static msg_t GWinStreamGetTimed(void *ip, systime_t timeout) { (void)ip; (void)timeout; return MSG_OK; } + static size_t GWinStreamWriteTimed(void *ip, const uint8_t *bp, size_t n, systime_t time) { (void)time; gwinPutCharArray(Stream2GWindow(ip), (const char *)bp, n); return MSG_OK; } + static size_t GWinStreamReadTimed(void *ip, uint8_t *bp, size_t n, systime_t time) { (void)ip; (void)bp; (void)n; (void)time; return 0; } +#endif struct GConsoleWindowVMT_t { _base_asynchronous_channel_methods -- cgit v1.2.3