renamed console fuctions to gfx
This commit is contained in:
parent
30c6a7fbba
commit
a8c9db2709
3 changed files with 12 additions and 12 deletions
|
@ -47,7 +47,7 @@ int main(void) {
|
||||||
gdispInit();
|
gdispInit();
|
||||||
gdispClear(Lime);
|
gdispClear(Lime);
|
||||||
|
|
||||||
lcdConsoleInit(&CON1, 0, 0, gdispGetWidth(), gdispGetHeight(), &fontLarger, Black, White);
|
gfxConsoleInit(&CON1, 0, 0, gdispGetWidth(), gdispGetHeight(), &fontLarger, Black, White);
|
||||||
chprintf((BaseSequentialStream *)&CON1, "Hello the time is %d\nGoodbye.", chTimeNow());
|
chprintf((BaseSequentialStream *)&CON1, "Hello the time is %d\nGoodbye.", chTimeNow());
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,9 +70,9 @@ typedef struct _GConsole {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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 gfxConsoleInit(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 lcdConsolePut(GConsole *console, char c);
|
msg_t gfxConsolePut(GConsole *console, char c);
|
||||||
msg_t lcdConsoleWrite(GConsole *console, const uint8_t *bp, size_t n);
|
msg_t gfxConsoleWrite(GConsole *console, const uint8_t *bp, size_t n);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
* Interface implementation. The interface is write only
|
* Interface implementation. The interface is write only
|
||||||
*/
|
*/
|
||||||
static size_t write(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 gfxConsoleWrite((GConsole *)ip, bp, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t read(void *ip, uint8_t *bp, size_t n) {
|
static size_t read(void *ip, uint8_t *bp, size_t n) {
|
||||||
|
@ -42,7 +42,7 @@ static size_t read(void *ip, uint8_t *bp, size_t n) {
|
||||||
static msg_t put(void *ip, uint8_t b) {
|
static msg_t put(void *ip, uint8_t b) {
|
||||||
(void)ip;
|
(void)ip;
|
||||||
|
|
||||||
return lcdConsolePut((GConsole *)ip, (char)b);
|
return gfxConsolePut((GConsole *)ip, (char)b);
|
||||||
}
|
}
|
||||||
|
|
||||||
static msg_t get(void *ip) {
|
static msg_t get(void *ip) {
|
||||||
|
@ -56,7 +56,7 @@ static msg_t putt(void *ip, uint8_t b, systime_t timeout) {
|
||||||
|
|
||||||
/* TODO: handle timeout */
|
/* TODO: handle timeout */
|
||||||
|
|
||||||
return lcdConsolePut((GConsole *)ip, (char)b);
|
return gfxConsolePut((GConsole *)ip, (char)b);
|
||||||
}
|
}
|
||||||
|
|
||||||
static msg_t gett(void *ip, systime_t timeout) {
|
static msg_t gett(void *ip, systime_t timeout) {
|
||||||
|
@ -69,7 +69,7 @@ static msg_t gett(void *ip, systime_t timeout) {
|
||||||
static size_t writet(void *ip, const uint8_t *bp, size_t n, systime_t time) {
|
static size_t writet(void *ip, const uint8_t *bp, size_t n, systime_t time) {
|
||||||
(void)time;
|
(void)time;
|
||||||
|
|
||||||
return lcdConsoleWrite((GConsole *)ip, bp, n);
|
return gfxConsoleWrite((GConsole *)ip, bp, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t readt(void *ip, uint8_t *bp, size_t n, systime_t time) {
|
static size_t readt(void *ip, uint8_t *bp, size_t n, systime_t time) {
|
||||||
|
@ -86,7 +86,7 @@ static const struct GConsoleVMT vmt = {
|
||||||
putt, gett, writet, readt
|
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) {
|
msg_t gfxConsoleInit(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 */
|
||||||
console->fy = gdispGetFontMetric(font, fontHeight);
|
console->fy = gdispGetFontMetric(font, fontHeight);
|
||||||
|
@ -110,7 +110,7 @@ msg_t lcdConsoleInit(GConsole *console, coord_t x0, coord_t y0, coord_t width, c
|
||||||
return RDY_OK;
|
return RDY_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t lcdConsolePut(GConsole *console, char c) {
|
msg_t gfxConsolePut(GConsole *console, char c) {
|
||||||
uint8_t width;
|
uint8_t width;
|
||||||
|
|
||||||
if(c == '\n') {
|
if(c == '\n') {
|
||||||
|
@ -164,10 +164,10 @@ msg_t lcdConsolePut(GConsole *console, char c) {
|
||||||
return RDY_OK;
|
return RDY_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_t lcdConsoleWrite(GConsole *console, const uint8_t *bp, size_t n) {
|
msg_t gfxConsoleWrite(GConsole *console, const uint8_t *bp, size_t n) {
|
||||||
size_t i;
|
size_t i;
|
||||||
for(i = 0; i < n; i++)
|
for(i = 0; i < n; i++)
|
||||||
lcdConsolePut(console, bp[i]);
|
gfxConsolePut(console, bp[i]);
|
||||||
|
|
||||||
return RDY_OK;
|
return RDY_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue