Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • card10/firmware
  • annejan/firmware
  • astro/firmware
  • fpletz/firmware
  • gerd/firmware
  • fleur/firmware
  • swym/firmware
  • l/firmware
  • uberardy/firmware
  • wink/firmware
  • madonius/firmware
  • mot/firmware
  • filid/firmware
  • q3k/firmware
  • hauke/firmware
  • Woazboat/firmware
  • pink/firmware
  • mossmann/firmware
  • omniskop/firmware
  • zenox/firmware
  • trilader/firmware
  • Danukeru/firmware
  • shoragan/firmware
  • zlatko/firmware
  • sistason/firmware
  • datenwolf/firmware
  • bene/firmware
  • amedee/firmware
  • martinling/firmware
  • griffon/firmware
  • chris007/firmware
  • adisbladis/firmware
  • dbrgn/firmware
  • jelly/firmware
  • rnestler/firmware
  • mh/firmware
  • ln/firmware
  • penguineer/firmware
  • monkeydom/firmware
  • jens/firmware
  • jnaulty/firmware
  • jeffmakes/firmware
  • marekventur/firmware
  • pete/firmware
  • h2obrain/firmware
  • DooMMasteR/firmware
  • jackie/firmware
  • prof_r/firmware
  • Draradech/firmware
  • Kartoffel/firmware
  • hinerk/firmware
  • abbradar/firmware
  • JustTB/firmware
  • LuKaRo/firmware
  • iggy/firmware
  • ente/firmware
  • flgr/firmware
  • Lorphos/firmware
  • matejo/firmware
  • ceddral7/firmware
  • danb/firmware
  • joshi/firmware
  • melle/firmware
  • fitch/firmware
  • deurknop/firmware
  • sargon/firmware
  • markus/firmware
  • kloenk/firmware
  • lucaswerkmeister/firmware
  • derf/firmware
  • meh/firmware
  • dx/card10-firmware
  • torben/firmware
  • yuvadm/firmware
  • AndyBS/firmware
  • klausdieter1/firmware
  • katzenparadoxon/firmware
  • xiretza/firmware
  • ole/firmware
  • techy/firmware
  • thor77/firmware
  • TilCreator/firmware
  • fuchsi/firmware
  • dos/firmware
  • yrlf/firmware
  • PetePriority/firmware
  • SuperVirus/firmware
  • sur5r/firmware
  • tazz/firmware
  • Alienmaster/firmware
  • flo_h/firmware
  • baldo/firmware
  • mmu_man/firmware
  • Foaly/firmware
  • sodoku/firmware
  • Guinness/firmware
  • ssp/firmware
  • led02/firmware
  • Stormwind/firmware
  • arist/firmware
  • coon/firmware
  • mdik/firmware
  • pippin/firmware
  • royrobotiks/firmware
  • zigot83/firmware
  • mo_k/firmware
106 results
Select Git revision
Show changes
Commits on Source (2)
......@@ -51,6 +51,12 @@ typedef _Bool bool;
#define API_DISP_CIRC 0x27
#define API_DISP_PIXEL 0x28
#define API_DISP_FRAMEBUFFER 0x29
#define API_DISP_TXT_UPDATE 0x2A
#define API_DISP_TXT_CLEAR 0x2B
#define API_DISP_TXT_PRINT 0x2C
#define API_DISP_TXT_SET_COLOR 0x2D
#define API_DISP_TXT_SET_CURSOR 0x2E
#define API_DISP_TXT_SET_AUTOUPDATE 0x2F
#define API_FILE_OPEN 0x40
#define API_FILE_CLOSE 0x41
......@@ -695,6 +701,57 @@ API(API_DISP_CIRC,
*/
API(API_DISP_FRAMEBUFFER, int epic_disp_framebuffer(union disp_framebuffer *fb));
/**
* Redraw the framebuffer
*
* :return: ``0`` on success, can't fail
*/
API(API_DISP_TXT_UPDATE, int epic_disp_txt_update());
/**
* Fills the framebuffer with ' ' characters. Does not update the framebuffer.
*
* :return: ``0`` on success, can't fail
*/
API(API_DISP_TXT_CLEAR, int epic_disp_txt_clear());
/**
* Puts the string on the buffer. Updates the cursor. Does not update the
* framebuffer.
*
* :param string: A null-terminated ASCII string.
* :return: ``0`` on success, can't fail
*/
API(API_DISP_TXT_PRINT, int epic_disp_txt_print(const char *string));
/**
* Updates the active background and foreground colors.
*
* :param fg: The display-encoded foreground color
* :param bg: The display-encoded background color
* :return: ``0`` on success, can't fail
*/
API(API_DISP_TXT_SET_COLOR, int epic_disp_txt_set_color(uint16_t fg, uint16_t bg));
/**
* Sets cursor location within the textbuffer space.
*
* :param x: new cursor column
* :param x: new cursor row
* :param draw_cursor: specifies whether the cursor should be drawn
* :return: ``0`` on success, can't fail
*/
API(API_DISP_TXT_SET_CURSOR, int epic_disp_txt_set_cursor(uint16_t x, uint16_t y, uint16_t draw_cursor));
/**
* Enables/disables automatic framebuffer updates. Automatic updates occur
* with every character written to the buffer - epic_disp_txt_update() is
* implicitly called.
*
* :param enabled: if not zero, textbuffer will be updated automatically
* :return: ``0`` on success, can't fail
*/
API(API_DISP_TXT_SET_AUTOUPDATE, int epic_disp_txt_set_autoupdate(uint16_t enabled));
/**
* Start continuous readout of the light sensor. Will read light level
......
......@@ -194,6 +194,73 @@ int epic_disp_close()
}
}
int epic_disp_txt_update()
{
int cl = check_lock();
if (cl < 0) {
return cl;
}
txt_update(&display_textb, 1);
return 0;
}
int epic_disp_txt_clear()
{
int cl = check_lock();
if (cl < 0) {
return cl;
}
txt_clear(&display_textb);
return 0;
}
int epic_disp_txt_print(const char *string)
{
int cl = check_lock();
if (cl < 0) {
return cl;
}
txt_puts(&display_textb, string);
return 0;
}
int epic_disp_txt_set_color(uint16_t fg, uint16_t bg)
{
int cl = check_lock();
if (cl < 0) {
return cl;
}
txt_set_color(&display_textb, TEXT_FOREGROUND, (Color)(fg));
txt_set_color(&display_textb, TEXT_BACKGROUND, (Color)(bg));
return 0;
}
int epic_disp_txt_set_cursor(uint16_t x, uint16_t y, uint16_t draw_cursor)
{
int cl = check_lock();
if (cl < 0) {
return cl;
}
txt_set_cursor(&display_textb, x, y, draw_cursor);
return 0;
}
int epic_disp_txt_set_autoupdate(uint16_t enabled)
{
int cl = check_lock();
if (cl < 0) {
return cl;
}
display_textb.auto_update = enabled;
return 0;
}
void disp_forcelock()
{
TaskHandle_t task = xTaskGetCurrentTaskHandle();
......
......@@ -12,6 +12,7 @@ void txt_init(struct txt_buffer *txtb, struct gfx_region *reg, sFONT *f)
txtb->bg_color = gfx_color_rgb_f(reg, .0f, .0f, .0f);
txtb->draw_cursor = 1;
txtb->auto_update = 1;
txtb->needs_redraw = 0;
txt_clear(txtb);
}
......@@ -49,6 +50,8 @@ static void scrollup(struct txt_buffer *tm)
g->fg_color = tm->fg_color;
g->bg_color = tm->bg_color;
}
tm->needs_redraw = 1;
}
static void newline(struct txt_buffer *tm)
......@@ -71,6 +74,8 @@ static inline void advance_cursor(struct txt_buffer *tm)
if (tm->cursor_row > last_row)
newline(tm);
}
tm->needs_redraw = 1;
}
static void tab(struct txt_buffer *tm)
......@@ -107,8 +112,9 @@ void txt_clear(struct txt_buffer *tm)
tm->cursor_column = 0;
tm->cursor_row = 0;
tm->needs_redraw = 1;
if (tm->auto_update)
txt_update(tm);
txt_update(tm, 0);
}
void txt_putchar(struct txt_buffer *tm, char ch)
......@@ -131,8 +137,9 @@ void txt_putchar(struct txt_buffer *tm, char ch)
advance_cursor(tm);
}
tm->needs_redraw = 1;
if (tm->auto_update)
txt_update(tm);
txt_update(tm, 0);
}
void txt_puts(struct txt_buffer *tm, const char *str)
......@@ -193,6 +200,8 @@ void txt_draw(struct txt_buffer *tm)
if (tm->draw_cursor)
draw_cursor_(tm);
tm->needs_redraw = 0;
}
void txt_set_color_f(
......@@ -210,8 +219,9 @@ void txt_set_color_f(
}
}
void txt_set_color(struct txt_buffer *tm, enum txt_color sw, int r, int g, int b)
{
void txt_set_color_rgb(
struct txt_buffer *tm, enum txt_color sw, int r, int g, int b
) {
Color c = gfx_color_rgb(tm->reg, r, g, b);
switch (c) {
......@@ -224,6 +234,18 @@ void txt_set_color(struct txt_buffer *tm, enum txt_color sw, int r, int g, int b
}
}
void txt_set_color(struct txt_buffer *tm, enum txt_color sw, Color c)
{
switch (c) {
case TEXT_FOREGROUND:
tm->fg_color = c;
break;
case TEXT_BACKGROUND:
tm->bg_color = c;
break;
}
}
void txt_set_cursor(struct txt_buffer *tm, int x, int y, int draw_cursor)
{
tm->draw_cursor = draw_cursor;
......@@ -237,7 +259,7 @@ void txt_set_cursor(struct txt_buffer *tm, int x, int y, int draw_cursor)
tm->cursor_row = y;
if (tm->auto_update)
txt_update(tm);
txt_update(tm, 0);
}
void txt_set_transparent(struct txt_buffer *tm)
......@@ -245,7 +267,9 @@ void txt_set_transparent(struct txt_buffer *tm)
tm->bg_color = tm->fg_color;
}
void txt_update(struct txt_buffer *tm)
void txt_update(struct txt_buffer *tm, int force_redraw)
{
if (tm->needs_redraw || force_redraw)
txt_draw(tm);
gfx_update(tm->reg);
}
......@@ -22,6 +22,7 @@ struct txt_buffer {
Color bg_color;
int draw_cursor;
int auto_update;
int needs_redraw;
struct txt_glyph text[TEXTBUFFER_MAX_HEIGHT][TEXTBUFFER_MAX_WIDTH];
};
......@@ -40,10 +41,11 @@ void txt_puts(struct txt_buffer *tm, const char *str);
void txt_draw(struct txt_buffer *tm);
void txt_set_color_f(struct txt_buffer *tm, enum txt_color sw, float r, float g,
float b);
void txt_set_color(struct txt_buffer *tm, enum txt_color sw, int r, int g,
void txt_set_color_rgb(struct txt_buffer *tm, enum txt_color sw, int r, int g,
int b);
void txt_set_color(struct txt_buffer *tm, enum txt_color sw, Color c);
void txt_set_transparent(struct txt_buffer *tm);
void txt_set_cursor(struct txt_buffer *tm, int x, int y, int draw_cursor);
void txt_update(struct txt_buffer *tm);
void txt_update(struct txt_buffer *tm, int force_redraw);
#endif