|
6 | 6 | * All rights reserved.
|
7 | 7 | */
|
8 | 8 |
|
| 9 | +/** |
| 10 | + * This is an extremely simple POC code of a LCD text console with part of the screen |
| 11 | + * scrolling as the text is added. It understands some basic ANSI escape sequences to |
| 12 | + * set bold and normal font and also some colors. Other than that, it most probably |
| 13 | + * won't work for anything useful. There is a bunch of things which need to be |
| 14 | + * addressed before considering this code at least alpha quality: |
| 15 | + * |
| 16 | + * - font rendering needs to be moved to a separate library, probably plumcore-grlib |
| 17 | + * - basic geometric shapes too (drawing frames, "windows", buttons, etc.) |
| 18 | + * - picture displaying too |
| 19 | + * - tool for converting pictures to C arrays needs to be made more generic |
| 20 | + * - making console header configurable and optional, it must be possible to |
| 21 | + * display custom text and logo |
| 22 | + * - scroll are configurable |
| 23 | + * - display size configurable (atm it only works with a 240x160 px display) |
| 24 | + * - Fb mode agnostic (now it works only in 2bpp G2 mode) |
| 25 | + */ |
| 26 | + |
9 | 27 | #include <stdint.h>
|
10 | 28 | #include <stdlib.h>
|
11 | 29 | #include <string.h>
|
@@ -64,7 +82,6 @@ const struct imdata im_plum = {
|
64 | 82 | * Stream interface API
|
65 | 83 | ***************************************************************************************************/
|
66 | 84 |
|
67 |
| - |
68 | 85 | static stream_ret_t stream_write(Stream *self, const void *buf, size_t size) {
|
69 | 86 | if (u_assert(self != NULL) ||
|
70 | 87 | u_assert(buf != NULL)) {
|
@@ -240,6 +257,11 @@ fb_console_ret_t fb_console_scroll(FbConsole *self, size_t r_start, size_t r_end
|
240 | 257 | }
|
241 | 258 |
|
242 | 259 |
|
| 260 | +/** |
| 261 | + * @brief Render simple text on a framebuffer device |
| 262 | + * |
| 263 | + * @todo move to plumcore-grlib library |
| 264 | + */ |
243 | 265 | fb_ret_t fb_text(Fb *self, const char *text, size_t posx, size_t posy, size_t *advance, uint8_t color, const struct small_char *font) {
|
244 | 266 | /** @todo handle the width properly */
|
245 | 267 |
|
@@ -269,6 +291,11 @@ fb_ret_t fb_text(Fb *self, const char *text, size_t posx, size_t posy, size_t *a
|
269 | 291 | }
|
270 | 292 |
|
271 | 293 |
|
| 294 | +/** |
| 295 | + * @brief Render simple uncompressed image on a framebuffer device |
| 296 | + * |
| 297 | + * @todo move to the plumcore-grlib library |
| 298 | + */ |
272 | 299 | fb_ret_t fb_image(Fb *self, size_t posx, size_t posy, const struct imdata *data) {
|
273 | 300 | for (size_t y = 0; y < data->h; y++) {
|
274 | 301 | uint8_t d[60];
|
|
0 commit comments