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

Functions

void window_numb_draw (window_numb_t *window)
 
void window_spin_inc (window_spin_t *window, int dif)
 
void window_spin_dec (window_spin_t *window, int dif)
 
void window_spin_init (window_spin_t *window)
 
void window_spin_event (window_spin_t *window, uint8_t event, void *param)
 

Variables

osThreadId displayTaskHandle
 
const window_class_spin_t window_class_spin
 

Function Documentation

◆ window_numb_draw()

void window_numb_draw ( window_numb_t window)
17  {
19  color_t clr_back = (window->win.flg & WINDOW_FLG_FOCUSED) ? window->color_text : window->color_back;
20  color_t clr_text = (window->win.flg & WINDOW_FLG_FOCUSED) ? window->color_back : window->color_text;
21  if (window->win.flg & WINDOW_FLG_CAPTURE)
22  clr_text = COLOR_ORANGE;
23  char text[WINDOW_NUMB_MAX_TEXT];
24  if (window->win.flg & WINDOW_FLG_NUMB_FLOAT2INT) {
25  sprintf(text, window->format, (int)(window->value));
26  } else {
27  sprintf(text, window->format, (double)window->value);
28  }
29 
30  render_text_align(window->win.rect,
31  text,
32  window->font,
33  clr_back,
34  clr_text,
35  window->padding,
36  window->alignment);
37  window->win.flg &= ~WINDOW_FLG_INVALID;
38  }
39 }
Here is the call graph for this function:

◆ window_spin_inc()

void window_spin_inc ( window_spin_t window,
int  dif 
)
42  {
43  window->index += dif;
44  if (window->index >= window->count)
45  window->index = window->count - 1;
46  window->window.value = window->min + window->index * window->step;
47  _window_invalidate((window_t *)window);
48 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_spin_dec()

void window_spin_dec ( window_spin_t window,
int  dif 
)
50  {
51  window->index -= dif;
52  if (window->index < 0)
53  window->index = 0;
54  window->window.value = window->min + window->index * window->step;
55  _window_invalidate((window_t *)window);
56 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ window_spin_init()

void window_spin_init ( window_spin_t window)
12  {
13  window_class_numb.cls.init(window);
14  window->min = 0.0;
15  window->max = 100.0F;
16  window->step = 1.0F;
17  window->count = 101;
18  window->index = 0;
19  window->window.win.flg |= WINDOW_FLG_ENABLED;
20 }

◆ window_spin_event()

void window_spin_event ( window_spin_t window,
uint8_t  event,
void param 
)
22  {
23  switch (event) {
25  if ((window->window.win.flg & WINDOW_FLG_ENABLED) && window->window.win.f_tag)
26  screen_dispatch_event((window_t *)window, WINDOW_EVENT_CHANGE, (void *)(int)window->window.win.f_tag);
27  window_set_capture(window->window.win.id_parent);
28  break;
30  window_spin_dec(window, (int)param);
31  break;
33  window_spin_inc(window, (int)param);
34  break;
37  window_invalidate(window->window.win.id);
38  break;
39  }
40 }
Here is the call graph for this function:

Variable Documentation

◆ displayTaskHandle

osThreadId displayTaskHandle

◆ window_class_spin

window_draw_t
void() window_draw_t(void *window)
Definition: window.h:57
_window_numb_t::padding
padding_ui8_t padding
Definition: window_numb.h:24
WINDOW_EVENT_CAPT_0
#define WINDOW_EVENT_CAPT_0
Definition: window.h:44
WINDOW_EVENT_CAPT_1
#define WINDOW_EVENT_CAPT_1
Definition: window.h:45
_window_spin_t::min
float min
Definition: window_spin.h:14
_window_class_numb_t::cls
window_class_t cls
Definition: window_numb.h:14
_window_t::id_parent
int16_t id_parent
Definition: window.h:78
window_numb_draw
void window_numb_draw(window_numb_t *window)
Definition: window_numb.c:17
WINDOW_NUMB_MAX_TEXT
#define WINDOW_NUMB_MAX_TEXT
Definition: window_numb.c:5
window_spin_dec
void window_spin_dec(window_spin_t *window, int dif)
Definition: window_spin.c:50
_window_numb_t::font
font_t * font
Definition: window_numb.h:21
WINDOW_EVENT_ENC_UP
#define WINDOW_EVENT_ENC_UP
Definition: window.h:41
_window_numb_t::color_text
color_t color_text
Definition: window_numb.h:20
window_invalidate
void window_invalidate(int16_t id)
Definition: window.c:304
WINDOW_FLG_VISIBLE
#define WINDOW_FLG_VISIBLE
Definition: window.h:24
_window_numb_t::value
float value
Definition: window_numb.h:22
_window_numb_t::color_back
color_t color_back
Definition: window_numb.h:19
_window_numb_t::alignment
uint8_t alignment
Definition: window_numb.h:25
WINDOW_EVENT_CHANGE
#define WINDOW_EVENT_CHANGE
Definition: window.h:47
_window_t::id
int16_t id
Definition: window.h:79
window_spin_inc
void window_spin_inc(window_spin_t *window, int dif)
Definition: window_spin.c:42
_window_spin_t::index
int index
Definition: window_spin.h:18
_window_numb_t::format
char * format
Definition: window_numb.h:23
WINDOW_CLS_SPIN
#define WINDOW_CLS_SPIN
Definition: window.h:15
_window_spin_t::count
int count
Definition: window_spin.h:17
COLOR_ORANGE
#define COLOR_ORANGE
Definition: guitypes.h:57
WINDOW_FLG_CAPTURE
#define WINDOW_FLG_CAPTURE
Definition: window.h:29
_window_spin_t::step
float step
Definition: window_spin.h:16
_window_t
Definition: window.h:76
_window_spin_t::max
float max
Definition: window_spin.h:15
WINDOW_FLG_NUMB_FLOAT2INT
#define WINDOW_FLG_NUMB_FLOAT2INT
Definition: window_numb.h:8
window_set_capture
void window_set_capture(int16_t id)
Definition: window.c:500
_window_class_t::init
window_init_t * init
Definition: window.h:70
window_event_t
void() window_event_t(void *window, uint8_t event, void *param)
Definition: window.h:58
render_text_align
void render_text_align(rect_ui16_t rc, const char *text, font_t *font, color_t clr0, color_t clr1, padding_ui8_t padding, uint16_t flags)
Definition: display_helper.c:6
_window_t::rect
rect_ui16_t rect
Definition: window.h:101
window_spin_init
void window_spin_init(window_spin_t *window)
Definition: window_spin.c:12
WINDOW_FLG_FOCUSED
#define WINDOW_FLG_FOCUSED
Definition: window.h:27
window_spin_event
void window_spin_event(window_spin_t *window, uint8_t event, void *param)
Definition: window_spin.c:22
_window_spin_t::window
window_numb_t window
Definition: window_spin.h:13
color_t
uint32_t color_t
Definition: guitypes.h:62
window_init_t
void() window_init_t(void *window)
Definition: window.h:55
WINDOW_EVENT_BTN_DN
#define WINDOW_EVENT_BTN_DN
Definition: window.h:38
_window_t::flg
uint32_t flg
Definition: window.h:81
screen_dispatch_event
void screen_dispatch_event(window_t *window, uint8_t event, void *param)
Definition: screen.c:103
_window_numb_t::win
window_t win
Definition: window_numb.h:18
window_class_numb
const window_class_numb_t window_class_numb
Definition: window_numb.c:41
WINDOW_FLG_INVALID
#define WINDOW_FLG_INVALID
Definition: window.h:26
_window_t::f_tag
uint32_t f_tag
Definition: window.h:98
WINDOW_FLG_ENABLED
#define WINDOW_FLG_ENABLED
Definition: window.h:25
_window_invalidate
static void _window_invalidate(window_t *window)
Definition: window.h:257
WINDOW_EVENT_ENC_DN
#define WINDOW_EVENT_ENC_DN
Definition: window.h:40
window_spin_t
struct _window_spin_t window_spin_t