Panel Management and Display Interface


Compounds

struct  panel
struct  panel_line

Typedefs

typedef unsigned short key_t
typedef void(* panel_enter_t )(struct panel *p)
typedef void(* panel_exit_t )(struct panel *p)
typedef unsigned long(* panel_refresh_t )(struct panel *p)
typedef void(* panel_input_t )(struct panel *p, enum key_mode mode, button_t button)

Enumerations

enum  panel_justify { JUSTIFY_LEFT, JUSTIFY_RIGHT, JUSTIFY_CENTER }

Functions

void panel_putchar (struct panel *p, lcd_line_t line, lcd_col_t col, unsigned char ch)
void panel_putstring (struct panel *p, lcd_line_t line, lcd_col_t col, const char *str)
void panel_putitem (struct panel *p, lcd_line_t line, lcd_col_t col, enum panel_justify mode, int field_len, const char *item)
void panel_clear_line (struct panel *p, lcd_line_t line, lcd_col_t col)
unsigned char panel_getchar_at (struct panel *p, lcd_line_t line, lcd_col_t col)
void panel_refresh (void)
void panel_touch (void)
int panel_need_refresh (void)
int panel_is_visible (struct panel *p)
void panel_push (struct panel *p)
void panel_pop (void)
void panel_create (struct panel *p)
void panel_initialize (void)
void panel_setcursor (struct panel *p, lcd_line_t line, lcd_col_t col)
void panel_show_cursor (struct panel *p, int mode)
void panel_loop (void) __attribute__((noreturn))

Detailed Description

The panel module controls the LCD display and the keyboard. It reacts to keyboard events and manages all LCD display update.

A panel entity displays its data on the LCD. It does so using the panel_putXXX operations. It provides a keyboard input callback to react to keyboard events.

The panel module allows to push or pop panels.

Typedef Documentation

typedef void(* panel_enter_t)(struct panel *p)
 

Panel enter callback.

Callback function invoked when the panel object is activated and has the LCD focus. This is called by panel_push and panel_pop on the panel which is activated.

Parameters:
p  Pointer to the panel object.

Definition at line 68 of file panel.h.

typedef void(* panel_exit_t)(struct panel *p)
 

Panel leave callback.

Callback function invoked when the panel object is deactivated and looses the LCD focus. This is called by panel_push and panel_pop on the panel which is deactivated. When a new panel is installed, the current active panel is first deactivated.

Parameters:
p  Pointer to the panel object.

Definition at line 79 of file panel.h.

typedef void(* panel_input_t)(struct panel *p, enum key_mode mode, button_t button)
 

Panel input handler.

Callback to handle the buttons for the panel.

Parameters:
p  Pointer to the panel object.
mode  Whether the key is pressed or released
button  Button which is pressed or released

Definition at line 103 of file panel.h.

typedef unsigned long(* panel_refresh_t)(struct panel *p)
 

Panel refresh callback.

Refresh the panel. This function is called by the panel main loop to automatically update the panel content. The function must update the panel using panel_putstring to show a newer or an up to date content. It must return the delay in milliseconds to wait before the next refresh.

Parameters:
p  Pointer to the panel object.
Returns:
The delay in milliseconds to wait before the next refresh

Definition at line 92 of file panel.h.

Enumeration Type Documentation

enum panel_justify
 

Justification mode

Definition at line 126 of file panel.h.

Function Documentation

void panel_clear_line struct panel *    p,
lcd_line_t    line,
lcd_col_t    col
 

Clear the rest of the line.

Clear the rest of the line line starting at col by writing spaces in it.

Parameters:
p  Pointer to the panel object
line  Line to clear
col  Column to start
See also:
panel_putchar, panel_refresh

void panel_create struct panel *    p
 

Create the panel object.

Parameters:
p  Pointer to the panel object.

unsigned char panel_getchar_at struct panel *    p,
lcd_line_t    line,
lcd_col_t    col
 

Return the character displayed on the panel.

Parameters:
p  Null or pointer to the panel object
col  Column number
line  Line number
Returns:
The character at the given position
See also:
panel_putchar

void panel_initialize void   
 

Initialize the panel module.

See also:
panel_create

int panel_is_visible struct panel *    p
 

Panel is visible.

Return whether the panel is visible.

Parameters:
p  Pointer to the panel object
Returns:
true if the panel is visible
See also:
panel_push

int panel_need_refresh void   
 

Returns true if the panel must be refreshed.

Returns true if the LCD display is not synchronized with the active panel and a call to panel_refresh is necessary.

Returns:
true if the panel must be refreshed.
See also:
panel_refresh, panel_touch

void panel_pop void   
 

Pop the active panel moving to the previous one.

Pop the active panel and redraw the previous one. The to_exit handler of the active panel is called before deactivating it. The to_enter handler of the previous panel is called to activate it.

See also:
panel_push, panel_refresh

void panel_push struct panel *    p
 

Push the panel.

Push the panel p making it the active panel. The previous active panel is kept for later re-activation with panel_pop.

Parameters:
p  Pointer to the panel object
See also:
panel_pop

void panel_putchar struct panel *    p,
lcd_line_t    line,
lcd_col_t    col,
unsigned char    ch
 

Write the character on the panel.

Write the character ch at position col, line on the panel. The character is not written on the LCD device but in an internal panel memory. The panel_refresh operation synchronizes the panel memory and the LCD display.

Parameters:
p  Pointer to the panel object
col  Column where to write
line  Line where to write
ch  Character to write
See also:
panel_putstring, panel_refresh

void panel_putitem struct panel *    p,
lcd_line_t    line,
lcd_col_t    col,
enum panel_justify    mode,
int    field_len,
const char *    item
 

Write a justified string on the panel.

Justify the string item according to the justification mode mode and the item length field_len. The justified string is then written on the panel p at position col, line.

Parameters:
p  Pointer to the panel object
col  Column where to write
line  Line where to write
mode  Justification mode to use
field_len  Length of the final item
str  String to write
See also:
panel_putchar, panel_refresh

void panel_putstring struct panel *    p,
lcd_line_t    line,
lcd_col_t    col,
const char *    str
 

Write the string on the panel.

Write the string str at position col, line on the panel. The string is not written on the LCD device but in an internal panel memory. The panel_refresh operation synchronizes the panel memory and the LCD display.

Parameters:
p  Pointer to the panel object
col  Column where to write
line  Line where to write
str  String to write
See also:
panel_putchar, panel_refresh

void panel_refresh void   
 

Refresh the panel.

Refresh the LCD display to match the content with the active panel. This function optimizes by only updating the LCD part which has changed. This is the only function which calls the LCD print operations.

See also:
panel_putchar, panel_putstring, panel_redraw

void panel_touch void   
 

Touch the panel.

Forget any optimization about the LCD panel display.

See also:
panel_refresh