Fri, 19 Apr 2024 20:56:55 +0200
Create global_json() for all and expanded the data to the complete setup. Added design for the global setup.
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /***************************************************************************** |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
443
diff
changeset
|
2 | * Copyright (C) 2015-2024 |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Michiel Broek <mbroek at mbse dot eu> |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * This file is part of the mbsePi-apps |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * mbsePi-apps is free software; you can redistribute it and/or modify it |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * under the terms of the GNU General Public License as published by the |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * Free Software Foundation; either version 2, or (at your option) any |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * later version. |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * mbsePi-apps is distributed in the hope that it will be useful, but |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * General Public License for more details. |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | * along with mbsePi-apps; see the file COPYING. If not, write to the Free |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | *****************************************************************************/ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | /* |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | * Simulated LCD driver based on HD44780U displays. |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | #include "brewpanel.h" |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
28 | #include "sdlgui.h" |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | #include "slcd.h" |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
30 | #include "dlgBrew.h" |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
443
diff
changeset
|
32 | #ifdef HAVE_SDL2_SDL_H |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | |
415
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
34 | |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
35 | // Bits in the control register |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
36 | #define SLCD_BLINK_CTRL 0x01 |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
37 | #define SLCD_CURSOR_CTRL 0x02 |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
38 | #define SLCD_DISPLAY_CTRL 0x04 |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | |
431
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
428
diff
changeset
|
40 | extern int debug; |
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
428
diff
changeset
|
41 | |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
42 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
43 | struct slcdDataStruct |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | int x; /* Start x pixels */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
46 | int y; /* Start y pixels */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | int w; /* Width in pixels */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
48 | int h; /* Height in pixels */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | int cols; /* Width in characters */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | int rows; /* Height in characters */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | int cx; /* Cursor x position */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | int cy; /* Cursor y position */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | Uint8 cgram[8][8]; /* Characters in CGRAM */ |
415
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
54 | int control; /* Control register */ |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | }; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
56 | struct slcdDataStruct *slcds [MAX_SLCDS] ; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
57 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
60 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
61 | void slcdHome(SGOBJ *dlg, int fd) |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | struct slcdDataStruct *lcd = slcds [fd]; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
65 | lcd->cx = lcd->cy = 0; |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
66 | SDLGui_Cursor(dlg, fd, lcd->x + (lcd->cx * 12) + 12, lcd->y + (lcd->cy * 18) + 8, lcd->control & SLCD_CURSOR_CTRL, lcd->control & SLCD_BLINK_CTRL); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
67 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
68 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
69 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
70 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
71 | void slcdClear(SGOBJ *dlg, int fd) |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | struct slcdDataStruct *lcd = slcds [fd]; |
415
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
74 | int i; |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
76 | lcd->cx = lcd->cy = 0; |
415
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
77 | for (i = 0; i < (lcd->cols * lcd->rows); i++) |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
78 | slcdPutchar(dlg, fd, ' '); |
415
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
79 | lcd->cx = lcd->cy = 0; |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
80 | SDLGui_Cursor(dlg, fd, lcd->x + (lcd->cx * 12) + 12, lcd->y + (lcd->cy * 18) + 8, lcd->control & SLCD_CURSOR_CTRL, lcd->control & SLCD_BLINK_CTRL); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
84 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
85 | void slcdDisplay(SGOBJ *dlg, int fd, int state) |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
86 | { |
415
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
87 | struct slcdDataStruct *lcd = slcds [fd]; |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
88 | |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
89 | if (state) |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
90 | lcd->control |= SLCD_DISPLAY_CTRL; |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
91 | else |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
92 | lcd->control &= ~SLCD_DISPLAY_CTRL; |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
94 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
95 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
96 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
97 | void slcdCursor(SGOBJ *dlg, int fd, int state) |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
98 | { |
415
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
99 | struct slcdDataStruct *lcd = slcds [fd]; |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
100 | |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
101 | if (state) |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
102 | lcd->control |= SLCD_CURSOR_CTRL; |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
103 | else |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
104 | lcd->control &= ~SLCD_CURSOR_CTRL; |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
105 | SDLGui_Cursor(dlg, fd, lcd->x + (lcd->cx * 12) + 12, lcd->y + (lcd->cy * 18) + 8, lcd->control & SLCD_CURSOR_CTRL, lcd->control & SLCD_BLINK_CTRL); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
106 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
107 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
108 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
109 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
110 | void slcdCursorBlink(SGOBJ *dlg, int fd, int state) |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
111 | { |
415
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
112 | struct slcdDataStruct *lcd = slcds [fd]; |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
113 | |
415
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
114 | if (state) |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
115 | lcd->control |= SLCD_BLINK_CTRL; |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
116 | else |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
117 | lcd->control &= ~SLCD_BLINK_CTRL; |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
118 | SDLGui_Cursor(dlg, fd, lcd->x + (lcd->cx * 12) + 12, lcd->y + (lcd->cy * 18) + 8, lcd->control & SLCD_CURSOR_CTRL, lcd->control & SLCD_BLINK_CTRL); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
119 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
120 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
121 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
122 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
123 | void slcdPosition(SGOBJ *dlg, int fd, int x, int y) |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
124 | { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
125 | struct slcdDataStruct *lcd = slcds [fd]; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
126 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
127 | if ((x > lcd->cols) || (x < 0)) |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
128 | return ; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
129 | if ((y > lcd->rows) || (y < 0)) |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
130 | return ; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
131 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
132 | lcd->cx = x ; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
133 | lcd->cy = y ; |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
134 | SDLGui_Cursor(dlg, fd, lcd->x + (lcd->cx * 12) + 12, lcd->y + (lcd->cy * 18) + 8, lcd->control & SLCD_CURSOR_CTRL, lcd->control & SLCD_BLINK_CTRL); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
135 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
136 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
137 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
138 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
139 | void slcdCharDef(SGOBJ *dlg, int fd, int index, Uint8 data[8]) |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
140 | { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
141 | struct slcdDataStruct *lcd = slcds [fd]; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
142 | int i; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
143 | |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
144 | for (i = 0 ; i < 8 ; i++) { |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
145 | lcd->cgram[index][i] = data[i]; |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
146 | } |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
147 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
148 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
149 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
150 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
151 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
152 | void slcdPutchar(SGOBJ *dlg, int fd, Uint8 data) |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
153 | { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
154 | struct slcdDataStruct *lcd = slcds [fd]; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
155 | |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
156 | if (data < 16) |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
157 | /* |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
158 | * Character 0..7 and 8..15 are the same. |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
159 | */ |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
160 | SDLGui_CGChar(dlg, fd, lcd->x + (lcd->cx * 12) + 12, lcd->y + (lcd->cy * 18) + 8, lcd->cgram[data & 0x07]); |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
161 | else |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
162 | SDLGui_Char(dlg, fd, lcd->x + (lcd->cx * 12) + 12, lcd->y + (lcd->cy * 18) + 8, data); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
163 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
164 | if (++lcd->cx == lcd->cols) { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
165 | lcd->cx = 0; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
166 | if (++lcd->cy == lcd->rows) |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
167 | lcd->cy = 0; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
168 | } |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
169 | SDLGui_Cursor(dlg, fd, lcd->x + (lcd->cx * 12) + 12, lcd->y + (lcd->cy * 18) + 8, lcd->control & SLCD_CURSOR_CTRL, lcd->control & SLCD_BLINK_CTRL); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
170 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
171 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
172 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
173 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
174 | void slcdPuts(SGOBJ *dlg, int fd, const char *string) |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
175 | { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
176 | while (*string) |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
177 | slcdPutchar(dlg, fd, *string++); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
178 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
179 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
180 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
181 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
182 | void slcdPrintf(SGOBJ *dlg, int fd, const char *message, ...) |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
183 | { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
184 | va_list argp; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
185 | char buffer[1024]; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
186 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
187 | va_start(argp, message); |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
188 | vsnprintf(buffer, 1023, message, argp); |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
189 | va_end(argp); |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
190 | slcdPuts(dlg, fd, buffer); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
191 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
192 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
193 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
194 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
195 | void slcdBacklight(SGOBJ *dlg, int fd, int bl) |
427
e8e548922e31
Initial part of LEDs and backlight implemented.
Michiel Broek <mbroek@mbse.eu>
parents:
426
diff
changeset
|
196 | { |
431
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
428
diff
changeset
|
197 | if (debug) |
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
428
diff
changeset
|
198 | fprintf(stdout, "slcdBacklight %d\n", bl); |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
199 | if (bl) |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
200 | dlg[1].state |= SG_SELECTED; |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
201 | else |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
202 | dlg[1].state &= ~SG_SELECTED; |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
203 | SDLGui_DrawLCD(dlg, 1); |
427
e8e548922e31
Initial part of LEDs and backlight implemented.
Michiel Broek <mbroek@mbse.eu>
parents:
426
diff
changeset
|
204 | } |
e8e548922e31
Initial part of LEDs and backlight implemented.
Michiel Broek <mbroek@mbse.eu>
parents:
426
diff
changeset
|
205 | |
e8e548922e31
Initial part of LEDs and backlight implemented.
Michiel Broek <mbroek@mbse.eu>
parents:
426
diff
changeset
|
206 | |
e8e548922e31
Initial part of LEDs and backlight implemented.
Michiel Broek <mbroek@mbse.eu>
parents:
426
diff
changeset
|
207 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
208 | void slcdLED(SGOBJ *dlg, int fd, int color, int state) |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
209 | { |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
210 | SDLGui_LED(dlg, fd, color, state); |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
211 | } |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
212 | |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
213 | |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
214 | |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
215 | int slcdInit(SGOBJ *dlg, int fd, int x, int y, int w, int h, int cols, int rows) |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
216 | { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
217 | static int initialised = 0; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
218 | int i, j; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
219 | struct slcdDataStruct *lcd; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
220 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
221 | if (initialised == 0) { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
222 | initialised = 1 ; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
223 | for (i = 0 ; i < MAX_SLCDS ; ++i) |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
224 | slcds[i] = NULL ; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
225 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
226 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
227 | if ((rows < 0) || (rows > 20)) |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
228 | return -1 ; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
229 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
230 | if ((cols < 0) || (cols > 20)) |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
231 | return -1 ; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
232 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
233 | /* |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
234 | * Create LCD |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
235 | */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
236 | if (slcds[fd] != NULL) { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
237 | syslog(LOG_NOTICE, "slcdInit fd=%d already in use", fd); |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
238 | return -1; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
239 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
240 | if ((lcd = (struct slcdDataStruct *)malloc (sizeof (struct slcdDataStruct))) == NULL) { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
241 | return -1; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
242 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
243 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
244 | lcd->x = x; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
245 | lcd->y = y; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
246 | lcd->w = w; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
247 | lcd->h = h; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
248 | lcd->cols = cols; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
249 | lcd->rows = rows; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
250 | lcd->cx = 0; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
251 | lcd->cy = 0; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
252 | for (i = 0; i < 8; i++) |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
253 | for (j = 0; j < 8; j++) |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
254 | lcd->cgram[i][j] = 0; |
415
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
255 | lcd->control = 0; |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
256 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
257 | slcds[fd] = lcd; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
258 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
259 | slcdDisplay(dlg, fd, TRUE); |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
260 | slcdCursor(dlg, fd, FALSE); |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
261 | slcdCursorBlink(dlg, fd, FALSE); |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
262 | slcdClear(dlg, fd); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
263 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
264 | /* |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
265 | * Most LCD's start with the top row filled with blocks. |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
266 | */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
267 | for (i = 0; i < lcd->cols; i++) |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
268 | slcdPutchar(dlg, fd, 0x0ff); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
269 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
270 | slcdDisplay(dlg, fd, TRUE); |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
271 | slcdCursor(dlg, fd, FALSE); |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
272 | slcdCursorBlink(dlg, fd, FALSE); |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
273 | slcdClear(dlg, fd); |
415
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
274 | |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
275 | return fd; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
276 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
277 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
278 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
279 | #endif |