Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_module_lcd.h
1 #ifndef _BC_MODULE_LCD
2 #define _BC_MODULE_LCD
3 
4 
5 #include <bc_font_common.h>
6 #include <bc_image.h>
7 #include <bc_led.h>
8 #include <bc_button.h>
9 #include <bc_gfx.h>
10 
14 
16 
17 typedef enum
18 {
19  BC_MODULE_LCD_EVENT_LEFT_PRESS = 0x10 | BC_BUTTON_EVENT_PRESS,
20  BC_MODULE_LCD_EVENT_LEFT_RELEASE = 0x10 | BC_BUTTON_EVENT_RELEASE,
21  BC_MODULE_LCD_EVENT_LEFT_CLICK = 0x10 | BC_BUTTON_EVENT_CLICK,
22  BC_MODULE_LCD_EVENT_LEFT_HOLD = 0x10 | BC_BUTTON_EVENT_HOLD,
23 
24  BC_MODULE_LCD_EVENT_RIGHT_PRESS = 0x20 | BC_BUTTON_EVENT_PRESS,
25  BC_MODULE_LCD_EVENT_RIGHT_RELEASE = 0x20 | BC_BUTTON_EVENT_RELEASE,
26  BC_MODULE_LCD_EVENT_RIGHT_CLICK = 0x20 | BC_BUTTON_EVENT_CLICK,
27  BC_MODULE_LCD_EVENT_RIGHT_HOLD = 0x20 | BC_BUTTON_EVENT_HOLD,
28 
29  BC_MODULE_LCD_EVENT_BOTH_HOLD = 0x30 | BC_BUTTON_EVENT_HOLD,
30 
32 
33 
35 
36 typedef enum
37 {
40 
43 
46 
49 
51 
53 
54 typedef enum
55 {
58 
61 
64 
66 
68 
69 typedef enum
70 {
73 
76 
78 
79 
81 
82 void bc_module_lcd_init();
83 
85 
87 
91 
92 bool bc_module_lcd_on(void);
93 
97 
98 bool bc_module_lcd_off(void);
99 
103 
104 bool bc_module_lcd_is_ready(void);
105 
107 
108 void bc_module_lcd_clear(void);
109 
114 
115 void bc_module_lcd_draw_pixel(int left, int top, bool color);
116 
123 
124 int bc_module_lcd_draw_char(int left, int top, uint8_t ch, bool color);
125 
132 
133 int bc_module_lcd_draw_string(int left, int top, char *str, bool color);
134 
141 
142 void bc_module_lcd_draw_line(int x0, int y0, int x1, int y1, bool color);
143 
150 
151 void bc_module_lcd_draw_rectangle(int x0, int y0, int x1, int y1, bool color);
152 
158 
159 void bc_module_lcd_draw_circle(int x0, int y0, int radius, bool color);
160 
165 
166 void bc_module_lcd_draw_image(int left, int top, const bc_image_t *img);
167 
168 //void bc_module_lcd_draw(const uint8_t *frame, uint8_t width, uint8_t height); // In pixels
169 //void bc_module_lcd_printf(uint8_t line, /*uint8_t size, font, */const uint8_t *string/*, ...*/);
170 
174 
175 bool bc_module_lcd_update(void);
176 
179 
180 void bc_module_lcd_set_font(const bc_font_t *font);
181 
184 
186 
190 
191 void bc_module_lcd_set_event_handler(void (*event_handler)(bc_module_lcd_event_t, void *), void *event_param);
192 
195 
197 
200 
202 
205 
207 
210 
212 
215 
217 
220 
222 
225 
227 
229 
230 #endif // _BC_MODULE_LCD
uint64_t bc_tick_t
Timestamp data type.
Definition: bc_tick.h:16
LCD rotation 0 degrees.
Definition: bc_module_lcd.h:39
bool bc_module_lcd_is_ready(void)
Check if lcd is ready for commands.
Definition: bc_module_lcd.c:90
Button driver interface.
Definition: bc_button.h:36
bc_module_lcd_button_t
Virtual button channels.
Definition: bc_module_lcd.h:69
bool bc_module_lcd_on(void)
Lcd on.
Definition: bc_module_lcd.c:80
bc_module_lcd_rotation_t bc_module_lcd_get_rotation(void)
Lcd get rotation.
LED driver interface.
Definition: bc_led.h:56
Event button released.
Definition: bc_button.h:20
void bc_module_lcd_draw_circle(int x0, int y0, int radius, bool color)
Lcd draw circle.
bool bc_module_lcd_update(void)
Lcd update, send data.
bc_module_lcd_event_t
Callback events.
Definition: bc_module_lcd.h:17
void bc_module_lcd_clear(void)
Lcd clear.
Definition: bc_module_lcd.c:95
Event button pressed.
Definition: bc_button.h:17
int bc_module_lcd_draw_string(int left, int top, char *str, bool color)
Lcd draw string.
LCD rotation 180 degrees.
Definition: bc_module_lcd.h:45
Rotation 90 degrees.
Definition: bc_gfx.h:52
LCD green LED channel.
Definition: bc_module_lcd.h:60
void bc_module_lcd_set_rotation(bc_module_lcd_rotation_t rotation)
Lcd set rotation.
void bc_module_lcd_draw_rectangle(int x0, int y0, int x1, int y1, bool color)
Lcd draw rectangle.
bc_module_lcd_rotation_t
Rotation.
Definition: bc_module_lcd.h:36
void bc_module_lcd_set_font(const bc_font_t *font)
Lcd set font.
LCD blue LED channel.
Definition: bc_module_lcd.h:63
void bc_module_lcd_draw_line(int x0, int y0, int x1, int y1, bool color)
Lcd draw line.
void bc_module_lcd_draw_image(int left, int top, const bc_image_t *img)
Lcd draw image.
LCD left button channel.
Definition: bc_module_lcd.h:72
void bc_module_lcd_set_button_scan_interval(bc_tick_t scan_interval)
Set scan interval (period of button input sampling)
LCD right button channel.
Definition: bc_module_lcd.h:75
void bc_module_lcd_set_event_handler(void(*event_handler)(bc_module_lcd_event_t, void *), void *event_param)
Lcd set event handler for buttons.
Rotation 180 degrees.
Definition: bc_gfx.h:55
void bc_module_lcd_set_button_click_timeout(bc_tick_t click_timeout)
Set click timeout (maximum interval within which button has to be released to recognize click event) ...
Event button hold (pressed for longer time)
Definition: bc_button.h:26
bc_gfx_t * bc_module_lcd_get_gfx()
Get gfx instance.
Definition: bc_module_lcd.c:75
const bc_button_driver_t * bc_module_lcd_get_button_driver(void)
Lcd get button driver.
bool bc_module_lcd_off(void)
Lcd off.
Definition: bc_module_lcd.c:85
void bc_module_lcd_draw_pixel(int left, int top, bool color)
Lcd draw pixel.
void bc_module_lcd_init()
Initialize lcd.
Definition: bc_module_lcd.c:64
void bc_module_lcd_set_button_hold_time(bc_tick_t hold_time)
Set hold time (interval after which hold event is recognized when button is steadily pressed) ...
const bc_led_driver_t * bc_module_lcd_get_led_driver(void)
Lcd get led driver.
int bc_module_lcd_draw_char(int left, int top, uint8_t ch, bool color)
Lcd draw char.
Instance.
Definition: bc_gfx.h:80
void bc_module_lcd_set_button_debounce_time(bc_tick_t debounce_time)
Set debounce time (minimum sampling interval during which input cannot change to toggle its state) ...
Event button clicked (pressed and released within certain time)
Definition: bc_button.h:23
bc_module_lcd_led_t
Virtual LED channels.
Definition: bc_module_lcd.h:54
LCD rotation 90 degrees.
Definition: bc_module_lcd.h:42
Rotation 270 degrees.
Definition: bc_gfx.h:58
LCD red LED channel.
Definition: bc_module_lcd.h:57
Rotation 0 degrees.
Definition: bc_gfx.h:49
LCD rotation 270 degrees.
Definition: bc_module_lcd.h:48