Firmware SDK
twr_module_lcd

Driver for lcd. More...

Enumerations

enum  twr_module_lcd_event_t {
  TWR_MODULE_LCD_EVENT_LEFT_PRESS = 0x10 | TWR_BUTTON_EVENT_PRESS ,
  TWR_MODULE_LCD_EVENT_LEFT_RELEASE = 0x10 | TWR_BUTTON_EVENT_RELEASE ,
  TWR_MODULE_LCD_EVENT_LEFT_CLICK = 0x10 | TWR_BUTTON_EVENT_CLICK ,
  TWR_MODULE_LCD_EVENT_LEFT_HOLD = 0x10 | TWR_BUTTON_EVENT_HOLD ,
  TWR_MODULE_LCD_EVENT_RIGHT_PRESS = 0x20 | TWR_BUTTON_EVENT_PRESS ,
  TWR_MODULE_LCD_EVENT_RIGHT_RELEASE = 0x20 | TWR_BUTTON_EVENT_RELEASE ,
  TWR_MODULE_LCD_EVENT_RIGHT_CLICK = 0x20 | TWR_BUTTON_EVENT_CLICK ,
  TWR_MODULE_LCD_EVENT_RIGHT_HOLD = 0x20 | TWR_BUTTON_EVENT_HOLD ,
  TWR_MODULE_LCD_EVENT_BOTH_HOLD = 0x30 | TWR_BUTTON_EVENT_HOLD
}
 Callback events.
 
enum  twr_module_lcd_rotation_t {
  TWR_MODULE_LCD_ROTATION_0 = TWR_GFX_ROTATION_0 ,
  TWR_MODULE_LCD_ROTATION_90 = TWR_GFX_ROTATION_90 ,
  TWR_MODULE_LCD_ROTATION_180 = TWR_GFX_ROTATION_180 ,
  TWR_MODULE_LCD_ROTATION_270 = TWR_GFX_ROTATION_270
}
 Rotation. More...
 
enum  twr_module_lcd_led_t {
  TWR_MODULE_LCD_LED_RED = 0 ,
  TWR_MODULE_LCD_LED_GREEN = 1 ,
  TWR_MODULE_LCD_LED_BLUE = 2
}
 Virtual LED channels. More...
 
enum  twr_module_lcd_button_t {
  TWR_MODULE_LCD_BUTTON_LEFT = 0 ,
  TWR_MODULE_LCD_BUTTON_RIGHT = 1
}
 Virtual button channels. More...
 

Functions

void twr_module_lcd_init ()
 Initialize lcd.
 
twr_gfx_ttwr_module_lcd_get_gfx ()
 Get gfx instance.
 
bool twr_module_lcd_on (void)
 Lcd on. More...
 
bool twr_module_lcd_off (void)
 Lcd off. More...
 
bool twr_module_lcd_is_present (void)
 Get LCD Module is pressent, can use without twr_module_lcd_init.
 
bool twr_module_lcd_is_ready (void)
 Check if lcd is ready for commands. More...
 
void twr_module_lcd_clear (void)
 Lcd clear.
 
void twr_module_lcd_draw_pixel (int left, int top, bool color)
 Lcd draw pixel. More...
 
int twr_module_lcd_draw_char (int left, int top, uint8_t ch, bool color)
 Lcd draw char. More...
 
int twr_module_lcd_draw_string (int left, int top, char *str, bool color)
 Lcd draw string. More...
 
void twr_module_lcd_draw_line (int x0, int y0, int x1, int y1, bool color)
 Lcd draw line. More...
 
void twr_module_lcd_draw_rectangle (int x0, int y0, int x1, int y1, bool color)
 Lcd draw rectangle. More...
 
void twr_module_lcd_draw_circle (int x0, int y0, int radius, bool color)
 Lcd draw circle. More...
 
void twr_module_lcd_draw_image (int left, int top, const twr_image_t *img)
 Lcd draw image. More...
 
bool twr_module_lcd_update (void)
 Lcd update, send data. More...
 
void twr_module_lcd_set_font (const twr_font_t *font)
 Lcd set font. More...
 
void twr_module_lcd_set_rotation (twr_module_lcd_rotation_t rotation)
 Lcd set rotation. More...
 
void twr_module_lcd_set_event_handler (void(*event_handler)(twr_module_lcd_event_t, void *), void *event_param)
 Lcd set event handler for buttons. More...
 
twr_module_lcd_rotation_t twr_module_lcd_get_rotation (void)
 Lcd get rotation. More...
 
const twr_led_driver_ttwr_module_lcd_get_led_driver (void)
 Lcd get led driver. More...
 
const twr_button_driver_ttwr_module_lcd_get_button_driver (void)
 Lcd get button driver. More...
 
void twr_module_lcd_set_button_hold_time (twr_tick_t hold_time)
 Set hold time (interval after which hold event is recognized when button is steadily pressed) More...
 
void twr_module_lcd_set_button_scan_interval (twr_tick_t scan_interval)
 Set scan interval (period of button input sampling) More...
 
void twr_module_lcd_set_button_debounce_time (twr_tick_t debounce_time)
 Set debounce time (minimum sampling interval during which input cannot change to toggle its state) More...
 
void twr_module_lcd_set_button_click_timeout (twr_tick_t click_timeout)
 Set click timeout (maximum interval within which button has to be released to recognize click event) More...
 

Detailed Description

Driver for lcd.

Enumeration Type Documentation

◆ twr_module_lcd_button_t

Virtual button channels.

Enumerator
TWR_MODULE_LCD_BUTTON_LEFT 

LCD left button channel.

TWR_MODULE_LCD_BUTTON_RIGHT 

LCD right button channel.

Definition at line 69 of file twr_module_lcd.h.

◆ twr_module_lcd_led_t

Virtual LED channels.

Enumerator
TWR_MODULE_LCD_LED_RED 

LCD red LED channel.

TWR_MODULE_LCD_LED_GREEN 

LCD green LED channel.

TWR_MODULE_LCD_LED_BLUE 

LCD blue LED channel.

Definition at line 54 of file twr_module_lcd.h.

◆ twr_module_lcd_rotation_t

Rotation.

Enumerator
TWR_MODULE_LCD_ROTATION_0 

LCD rotation 0 degrees.

TWR_MODULE_LCD_ROTATION_90 

LCD rotation 90 degrees.

TWR_MODULE_LCD_ROTATION_180 

LCD rotation 180 degrees.

TWR_MODULE_LCD_ROTATION_270 

LCD rotation 270 degrees.

Definition at line 36 of file twr_module_lcd.h.

Function Documentation

◆ twr_module_lcd_draw_char()

int twr_module_lcd_draw_char ( int  left,
int  top,
uint8_t  ch,
bool  color 
)

Lcd draw char.

Parameters
[in]leftPixels from left edge
[in]topPixels from top edge
[in]chChar to be printed
[in]colorPixels state
Returns
Width of printed character

Definition at line 110 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_draw_circle()

void twr_module_lcd_draw_circle ( int  x0,
int  y0,
int  radius,
bool  color 
)

Lcd draw circle.

Parameters
[in]x0Center - pixels from left edge
[in]y0Center - pixels from top edge
[in]radiusIn pixels
[in]colorPixels state

Definition at line 144 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_draw_image()

void twr_module_lcd_draw_image ( int  left,
int  top,
const twr_image_t img 
)

Lcd draw image.

Parameters
[in]leftPixels from left edge
[in]topPixels from top edge
[in]imgPointer to the image

Definition at line 149 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_draw_line()

void twr_module_lcd_draw_line ( int  x0,
int  y0,
int  x1,
int  y1,
bool  color 
)

Lcd draw line.

Parameters
[in]x0Pixels from left edge
[in]y0Pixels from top edge
[in]x1Pixels from left edge
[in]y1Pixels from top edge
[in]colorPixels state

Definition at line 134 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_draw_pixel()

void twr_module_lcd_draw_pixel ( int  left,
int  top,
bool  color 
)

Lcd draw pixel.

Parameters
[in]leftPixels from left edge
[in]topPixels from top edge
[in]colorPixels state

Definition at line 105 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_draw_rectangle()

void twr_module_lcd_draw_rectangle ( int  x0,
int  y0,
int  x1,
int  y1,
bool  color 
)

Lcd draw rectangle.

Parameters
[in]x0Pixels from left edge
[in]y0Pixels from top edge
[in]x1Pixels from left edge
[in]y1Pixels from top edge
[in]colorPixels state

Definition at line 139 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_draw_string()

int twr_module_lcd_draw_string ( int  left,
int  top,
char *  str,
bool  color 
)

Lcd draw string.

Parameters
[in]leftPixels from left edge
[in]topPixels from top edge
[in]*strString to be printed
[in]colorPixels state
Returns
Width of printed string

Definition at line 115 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_get_button_driver()

const twr_button_driver_t* twr_module_lcd_get_button_driver ( void  )

Lcd get button driver.

Returns
Driver for onboard button

Definition at line 307 of file twr_module_lcd.c.

Referenced by twr_module_lcd_set_event_handler().

Here is the caller graph for this function:

◆ twr_module_lcd_get_led_driver()

const twr_led_driver_t* twr_module_lcd_get_led_driver ( void  )

Lcd get led driver.

Returns
Driver for onboard led

Definition at line 295 of file twr_module_lcd.c.

◆ twr_module_lcd_get_rotation()

twr_module_lcd_rotation_t twr_module_lcd_get_rotation ( void  )

Lcd get rotation.

Returns
Rotation of display

Definition at line 290 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_is_ready()

bool twr_module_lcd_is_ready ( void  )

Check if lcd is ready for commands.

Returns
true If ready
false If not ready

Definition at line 95 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_off()

bool twr_module_lcd_off ( void  )

Lcd off.

Returns
true On success
false On failure

Definition at line 85 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_on()

bool twr_module_lcd_on ( void  )

Lcd on.

Returns
true On success
false On failure

Definition at line 80 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_set_button_click_timeout()

void twr_module_lcd_set_button_click_timeout ( twr_tick_t  click_timeout)

Set click timeout (maximum interval within which button has to be released to recognize click event)

Parameters
[in]click_timeoutDesired click timeout in ticks

Definition at line 279 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_set_button_debounce_time()

void twr_module_lcd_set_button_debounce_time ( twr_tick_t  debounce_time)

Set debounce time (minimum sampling interval during which input cannot change to toggle its state)

Parameters
[in]debounce_timeDesired debounce time in ticks

Definition at line 273 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_set_button_hold_time()

void twr_module_lcd_set_button_hold_time ( twr_tick_t  hold_time)

Set hold time (interval after which hold event is recognized when button is steadily pressed)

Parameters
[in]hold_timeDesired hold time in ticks

Definition at line 261 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_set_button_scan_interval()

void twr_module_lcd_set_button_scan_interval ( twr_tick_t  scan_interval)

Set scan interval (period of button input sampling)

Parameters
[in]scan_intervalDesired scan interval in ticks

Definition at line 267 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_set_event_handler()

void twr_module_lcd_set_event_handler ( void(*)(twr_module_lcd_event_t, void *)  event_handler,
void *  event_param 
)

Lcd set event handler for buttons.

Parameters
[in]event_handlerEvent handler
[in]event_paramEvent parameter

Definition at line 247 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_set_font()

void twr_module_lcd_set_font ( const twr_font_t font)

Lcd set font.

Parameters
[in]*fontFont

Definition at line 179 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_set_rotation()

void twr_module_lcd_set_rotation ( twr_module_lcd_rotation_t  rotation)

Lcd set rotation.

Parameters
[in]rotationRotation of diplay

Definition at line 285 of file twr_module_lcd.c.

Here is the call graph for this function:

◆ twr_module_lcd_update()

bool twr_module_lcd_update ( void  )

Lcd update, send data.

Returns
true On success
false On failure

Definition at line 174 of file twr_module_lcd.c.

Here is the call graph for this function: