commit
30c6a7fbba
2 changed files with 16 additions and 22 deletions
|
@ -22,13 +22,22 @@
|
||||||
#define CONSOLE_H
|
#define CONSOLE_H
|
||||||
|
|
||||||
#ifndef GDISP_NEED_CONSOLE
|
#ifndef GDISP_NEED_CONSOLE
|
||||||
#undef GDISP_NEED_CONSOLE
|
#define GDISP_NEED_CONSOLE FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GDISP_NEED_CONSOLE
|
#if GDISP_NEED_CONSOLE
|
||||||
|
|
||||||
#include "gdisp.h"
|
#include "gdisp.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends BaseAsynchronousChannelVMT
|
||||||
|
*
|
||||||
|
* @brief @p GConsole virtual methods table.
|
||||||
|
*/
|
||||||
|
struct GConsoleVMT {
|
||||||
|
_base_asynchronous_channel_methods
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @extends BaseAsynchronousChannel
|
* @extends BaseAsynchronousChannel
|
||||||
*
|
*
|
||||||
|
|
|
@ -24,23 +24,14 @@
|
||||||
|
|
||||||
#if GDISP_NEED_CONSOLE
|
#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
|
* 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);
|
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)ip;
|
||||||
(void)bp;
|
(void)bp;
|
||||||
(void)n;
|
(void)n;
|
||||||
|
@ -48,10 +39,10 @@ static size_t reads(void *ip, uint8_t *bp, size_t n) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static msg_t put(void *ip) {
|
static msg_t put(void *ip, uint8_t b) {
|
||||||
(void)ip;
|
(void)ip;
|
||||||
|
|
||||||
return RDY_OK;
|
return lcdConsolePut((GConsole *)ip, (char)b);
|
||||||
}
|
}
|
||||||
|
|
||||||
static msg_t get(void *ip) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t getflags(void *ip) {
|
|
||||||
_ch_get_and_clear_flags_impl(ip);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct GConsoleVMT vmt = {
|
static const struct GConsoleVMT vmt = {
|
||||||
writes, reads, put, get,
|
write, read, put, get,
|
||||||
putt, gett, writet, readt,
|
putt, gett, writet, readt
|
||||||
getflags
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
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) {
|
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;
|
console->vmt = &vmt;
|
||||||
/* read font, get height & padding */
|
/* read font, get height & padding */
|
||||||
|
|
Loading…
Add table
Reference in a new issue