Prusa MINI Firmware overview
window_term.c File Reference
#include "window_term.h"
#include "gui.h"

Functions

static void window_term_init (window_term_t *window)
 
void render_term (rect_ui16_t rc, term_t *pt, font_t *font, color_t clr0, color_t clr1)
 
static void window_term_draw (window_term_t *window)
 

Variables

const window_class_term_t window_class_term
 

Function Documentation

◆ window_term_init()

static void window_term_init ( window_term_t window)
static
5  {
8  window->font = gui_defaults.font;
9  window->term = 0;
10  window->win.flg |= WINDOW_FLG_ENABLED;
11 }

◆ render_term()

void render_term ( rect_ui16_t  rc,
term_t pt,
font_t font,
color_t  clr0,
color_t  clr1 
)
13  {
14  uint8_t char_w = font->w;
15  uint8_t char_h = font->h;
16  if (pt && (pt->flg & TERM_FLG_CHANGED)) {
17  uint8_t cols = pt->cols;
18  uint8_t rows = pt->rows;
19  uint8_t *pb = pt->buff;
20  uint8_t *pm = pt->buff + (cols * rows * 2);
21  uint8_t msk = 0x01;
22  uint8_t c;
23  uint8_t r;
24  int i = 0;
25  for (r = 0; r < rows; r++)
26  for (c = 0; c < cols; c++) {
27  if ((*pm) & msk) {
28  //character is followed by attribut
29  uint8_t ch = *(pb++);
30  pb++; //uint8_t attr = *(pb++);
31  display->draw_char(point_ui16(rc.x + c * char_w, rc.y + r * char_h), ch, font, clr0, clr1);
32  } else
33  pb += 2;
34  i++;
35  msk <<= 1;
36  if ((i & 7) == 0) {
37  *pm = 0;
38  pm++;
39  msk = 0x01;
40  }
41  }
42  } else
43  display->fill_rect(rc, clr0);
44 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_term_draw()

static void window_term_draw ( window_term_t window)
static
46  {
48  render_term(window->win.rect, window->term, window->font, window->color_back, window->color_text);
49  window->win.flg &= ~WINDOW_FLG_INVALID;
50  }
51 }
Here is the call graph for this function:

Variable Documentation

◆ window_class_term

const window_class_term_t window_class_term
window_draw_t
void() window_draw_t(void *window)
Definition: window.h:57
_rect_ui16_t::y
uint16_t y
Definition: guitypes.h:71
_font_t::h
uint8_t h
Definition: guitypes.h:78
_term_t::rows
uint8_t rows
Definition: term.h:45
_display_t::draw_char
display_draw_char_t * draw_char
Definition: display.h:34
_gui_defaults_t::color_text
color_t color_text
Definition: guitypes.h:108
WINDOW_CLS_TERM
#define WINDOW_CLS_TERM
Definition: window.h:17
render_term
void render_term(rect_ui16_t rc, term_t *pt, font_t *font, color_t clr0, color_t clr1)
Definition: window_term.c:13
window_term_init
static void window_term_init(window_term_t *window)
Definition: window_term.c:5
TERM_FLG_CHANGED
#define TERM_FLG_CHANGED
Definition: term.h:29
_window_term_t::term
term_t * term
Definition: window_term.h:20
_gui_defaults_t::font
font_t * font
Definition: guitypes.h:110
i
uint8_t i
Definition: screen_test_graph.c:72
WINDOW_FLG_VISIBLE
#define WINDOW_FLG_VISIBLE
Definition: window.h:24
_window_term_t::color_text
color_t color_text
Definition: window_term.h:18
_display_t::fill_rect
display_fill_rect_t * fill_rect
Definition: display.h:33
_window_term_t::win
window_t win
Definition: window_term.h:16
_term_t::cols
uint8_t cols
Definition: term.h:44
_term_t::flg
uint16_t flg
Definition: term.h:46
window_term_draw
static void window_term_draw(window_term_t *window)
Definition: window_term.c:46
_gui_defaults_t::color_back
color_t color_back
Definition: guitypes.h:107
_font_t::w
uint8_t w
Definition: guitypes.h:77
window_term_t
struct _window_term_t window_term_t
uint8_t
const uint8_t[]
Definition: 404_html.c:3
display
display_t * display
Definition: display.c:6
_window_t::rect
rect_ui16_t rect
Definition: window.h:101
_window_term_t::font
font_t * font
Definition: window_term.h:19
_rect_ui16_t::x
uint16_t x
Definition: guitypes.h:70
_window_term_t::color_back
color_t color_back
Definition: window_term.h:17
window_init_t
void() window_init_t(void *window)
Definition: window.h:55
gui_defaults
gui_defaults_t gui_defaults
Definition: gui.c:20
_window_t::flg
uint32_t flg
Definition: window.h:81
WINDOW_FLG_INVALID
#define WINDOW_FLG_INVALID
Definition: window.h:26
WINDOW_FLG_ENABLED
#define WINDOW_FLG_ENABLED
Definition: window.h:25
_term_t::buff
uint8_t * buff
Definition: term.h:47
point_ui16
static point_ui16_t point_ui16(uint16_t x, uint16_t y)
Definition: guitypes.h:154