Prusa MINI Firmware overview
screen.h File Reference
#include <inttypes.h>
#include "window.h"

Go to the source code of this file.

Classes

struct  _screen_t
 

Typedefs

typedef struct _screen_t screen_t
 
typedef void() screen_init_t(screen_t *screen)
 
typedef void() screen_done_t(screen_t *screen)
 
typedef void() screen_draw_t(screen_t *screen)
 
typedef int() screen_event_t(screen_t *screen, window_t *window, uint8_t event, void *param)
 

Functions

int16_t screen_id (void)
 
int16_t screen_register (screen_t *pscreen)
 
screen_tscreen_unregister (int16_t screen_id)
 
void screen_stack_push (int16_t screen_id)
 
int16_t screen_stack_pop (void)
 
void screen_open (int16_t screen_id)
 
void screen_close (void)
 
void screen_draw (void)
 
void screen_dispatch_event (window_t *window, uint8_t event, void *param)
 
screen_tscreen_get_curr (void)
 

Typedef Documentation

◆ screen_t

typedef struct _screen_t screen_t

◆ screen_init_t

typedef void() screen_init_t(screen_t *screen)

◆ screen_done_t

typedef void() screen_done_t(screen_t *screen)

◆ screen_draw_t

typedef void() screen_draw_t(screen_t *screen)

◆ screen_event_t

typedef int() screen_event_t(screen_t *screen, window_t *window, uint8_t event, void *param)

Function Documentation

◆ screen_id()

int16_t screen_id ( void  )
18  {
19  if (screen_0)
20  return screen_0->id;
21  return -1;
22 }
Here is the caller graph for this function:

◆ screen_register()

int16_t screen_register ( screen_t pscreen)
24  {
25  int16_t id = -1;
26  if ((pscreen != 0) && (screen_count < SCREEN_MAX_SCREENS)) {
27  id = 0;
28  if (screen_count == 0) //reset all pointers when starting
29  memset(screens, 0, SCREEN_MAX_SCREENS * sizeof(screen_t *));
30  else //find free id
31  while ((id < SCREEN_MAX_SCREENS) && (screens[id]))
32  id++;
33  if (id < SCREEN_MAX_SCREENS) { //id is valid
34  screens[id] = pscreen; //set screen pointer
35  pscreen->id = id;
36  screen_count++; //increment count
37  } else
38  id = -1;
39  }
40  return id;
41 }
Here is the caller graph for this function:

◆ screen_unregister()

screen_t* screen_unregister ( int16_t  screen_id)
43  {
44  //TODO
45  return 0;
46 }

◆ screen_stack_push()

void screen_stack_push ( int16_t  screen_id)
48  {
49  screen_t *pscreen;
51  if ((screen_id >= 0) && (screen_id < SCREEN_MAX_SCREENS) && ((pscreen = screens[screen_id]) != 0))
53 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ screen_stack_pop()

int16_t screen_stack_pop ( void  )
55  {
56  int16_t screen_id = -1;
57  if (screen_stack_count > 0)
59  return screen_id;
60 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ screen_open()

void screen_open ( int16_t  screen_id)
62  {
63  if (screen_0) {
66  if (screen_0->pdata && screen_0->data_size) {
68  screen_0->pdata = 0;
69  }
70  screen_0 = 0;
71  }
72  if ((screen_id >= 0) && (screen_id < SCREEN_MAX_SCREENS) && ((screen_0 = screens[screen_id]) != 0)) {
73  if (screen_0->data_size)
77  }
78 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ screen_close()

void screen_close ( void  )
80  {
81  if (screen_0) {
83  if (screen_0->pdata && screen_0->data_size) {
85  screen_0->pdata = 0;
86  }
87  screen_0 = 0;
88  }
89  int16_t screen_id = screen_stack_pop();
90  if ((screen_id >= 0) && (screen_id < SCREEN_MAX_SCREENS) && ((screen_0 = screens[screen_id]) != 0)) {
91  if (screen_0->data_size)
95  }
96 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ screen_draw()

void screen_draw ( void  )
98  {
99  if (screen_0)
101 }

◆ screen_dispatch_event()

void screen_dispatch_event ( window_t window,
uint8_t  event,
void param 
)
103  {
104  int ret = 0;
105  if (screen_0 && screen_0->event) {
106  ret = screen_0->event(screen_0, window, event, param);
107  if (screen_0 == 0)
108  ret = 1;
109  }
110  if ((ret == 0) && window && window->event)
111  window_dispatch_event(window, event, param);
112 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ screen_get_curr()

screen_t* screen_get_curr ( void  )
114  {
115  return screen_0;
116 }
Here is the caller graph for this function:
_screen_t::event
screen_event_t * event
Definition: screen.h:24
gui_free
void gui_free(void *ptr)
Definition: gui.c:39
screen_0
screen_t * screen_0
Definition: screen.c:10
screen_stack_pop
int16_t screen_stack_pop(void)
Definition: screen.c:55
screen_count
uint16_t screen_count
Definition: screen.c:13
gui_malloc
void * gui_malloc(unsigned int size)
Definition: gui.c:35
screens
screen_t * screens[SCREEN_MAX_SCREENS]
Definition: screen.c:12
_screen_t::data_size
uint16_t data_size
Definition: screen.h:25
SCREEN_MAX_HISTORY
#define SCREEN_MAX_HISTORY
Definition: screen.c:8
_screen_t::pdata
void * pdata
Definition: screen.h:26
SCREEN_MAX_SCREENS
#define SCREEN_MAX_SCREENS
Definition: screen.c:6
screen_id
int16_t screen_id(void)
Definition: screen.c:18
_screen_t::draw
screen_draw_t * draw
Definition: screen.h:23
_screen_t::done
screen_done_t * done
Definition: screen.h:22
window_dispatch_event
void window_dispatch_event(window_t *window, uint8_t event, void *param)
Definition: window.c:797
window_set_capture
void window_set_capture(int16_t id)
Definition: window.c:500
_screen_t
Definition: screen.h:18
screen_stack
int16_t screen_stack[SCREEN_MAX_HISTORY]
Definition: screen.c:15
screen_stack_push
void screen_stack_push(int16_t screen_id)
Definition: screen.c:48
_window_t::event
window_event_t * event
Definition: window.h:102
_screen_t::init
screen_init_t * init
Definition: screen.h:21
_screen_t::id
int16_t id
Definition: screen.h:19
screen_stack_count
uint16_t screen_stack_count
Definition: screen.c:16