1 | #ifndef LCD_H |
---|
2 | #define LCD_H |
---|
3 | |
---|
4 | // Maximum supported sizes |
---|
5 | #define LCD_MAX_WID 256 |
---|
6 | #define LCD_MAX_WIDTH 256 |
---|
7 | #define LCD_MAX_HGT 256 |
---|
8 | #define LCD_MAX_HEIGHT 256 |
---|
9 | |
---|
10 | |
---|
11 | int lcd_init(char *args); |
---|
12 | int lcd_add_driver(char *driver, char *args); |
---|
13 | int lcd_shutdown(); |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | ///////////////////////////////////////////////////////////////// |
---|
18 | // Driver functions / info held here... |
---|
19 | // |
---|
20 | // Feel free to override any/all functions here with real driver |
---|
21 | // functions... |
---|
22 | // |
---|
23 | typedef struct lcd_logical_driver |
---|
24 | { |
---|
25 | // Size in cells of the LCD |
---|
26 | int wid, hgt; |
---|
27 | // Size of each LCD cell, in pixels |
---|
28 | int cellwid, cellhgt; |
---|
29 | // Frame buffer... |
---|
30 | char *framebuf; |
---|
31 | |
---|
32 | // Functions which might be the same for all drivers... |
---|
33 | void (*clear)(); |
---|
34 | void (*string)(int x, int y, char lcd[]); |
---|
35 | |
---|
36 | void (*chr)(int x, int y, char c); |
---|
37 | void (*vbar)(int x, int len); |
---|
38 | void (*hbar)(int x, int y, int len); |
---|
39 | void (*init_num)(); |
---|
40 | void (*num)(int x, int num); |
---|
41 | |
---|
42 | // Functions which should probably be implemented in each driver... |
---|
43 | int (*init)(struct lcd_logical_driver *driver, char *args); |
---|
44 | void (*close)(); |
---|
45 | void (*flush)(); |
---|
46 | void (*flush_box)(int lft, int top, int rgt, int bot); |
---|
47 | int (*contrast)(int contrast); |
---|
48 | void (*backlight)(int on); |
---|
49 | void (*output)(int on); |
---|
50 | void (*set_char)(int n, char *dat); |
---|
51 | void (*icon)(int which, char dest); |
---|
52 | void (*init_vbar)(); |
---|
53 | void (*init_hbar)(); |
---|
54 | void (*draw_frame)(); |
---|
55 | |
---|
56 | // Returns 0 for "no key pressed", or (A-Z). |
---|
57 | char (*getkey)(); |
---|
58 | |
---|
59 | // more? |
---|
60 | |
---|
61 | } lcd_logical_driver; |
---|
62 | |
---|
63 | typedef struct lcd_physical_driver |
---|
64 | { |
---|
65 | char *name; |
---|
66 | int (*init)(struct lcd_logical_driver *driver, char *device); |
---|
67 | } lcd_physical_driver; |
---|
68 | |
---|
69 | |
---|
70 | extern lcd_logical_driver lcd; |
---|
71 | |
---|
72 | |
---|
73 | int lcd_drv_init(lcd_logical_driver *driver, char *args); |
---|
74 | void lcd_drv_close(); |
---|
75 | void lcd_drv_clear(); |
---|
76 | void lcd_drv_flush(); |
---|
77 | void lcd_drv_string(int x, int y, char string[]); |
---|
78 | void lcd_drv_chr(int x, int y, char c); |
---|
79 | int lcd_drv_contrast(int contrast); |
---|
80 | void lcd_drv_backlight(int on); |
---|
81 | void lcd_drv_output(int on); |
---|
82 | void lcd_drv_init_vbar(); |
---|
83 | void lcd_drv_init_hbar(); |
---|
84 | void lcd_drv_init_num(); |
---|
85 | void lcd_drv_num(int x, int num); |
---|
86 | void lcd_drv_set_char(int n, char *dat); |
---|
87 | void lcd_drv_vbar(int x, int len); |
---|
88 | void lcd_drv_hbar(int x, int y, int len); |
---|
89 | void lcd_drv_icon(int which, char dest); |
---|
90 | void lcd_drv_flush_box(int lft, int top, int rgt, int bot); |
---|
91 | void lcd_drv_draw_frame(); |
---|
92 | char lcd_drv_getkey(); |
---|
93 | |
---|
94 | #endif |
---|
95 | |
---|