diff options
author | Mats Lidell <matsl@rockbox.org> | 2002-08-21 10:37:34 +0000 |
---|---|---|
committer | Mats Lidell <matsl@rockbox.org> | 2002-08-21 10:37:34 +0000 |
commit | 89d2285e0010adda3a2d9d936733943d93c25cd1 (patch) | |
tree | 2928659f9ba62a28ec79233a634bbc21f4da783b /uisimulator | |
parent | d00119729d8bacdc8f813c928f50ef1688343101 (diff) | |
download | rockbox-89d2285e0010adda3a2d9d936733943d93c25cd1.tar.gz rockbox-89d2285e0010adda3a2d9d936733943d93c25cd1.zip |
Created.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1856 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/common/sim_icons.c | 198 | ||||
-rw-r--r-- | uisimulator/common/sim_icons.h | 27 |
2 files changed, 225 insertions, 0 deletions
diff --git a/uisimulator/common/sim_icons.c b/uisimulator/common/sim_icons.c new file mode 100644 index 0000000000..8c175e48b1 --- /dev/null +++ b/uisimulator/common/sim_icons.c | |||
@@ -0,0 +1,198 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Mats Lidell <matsl@contactor.se> | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifdef HAVE_LCD_CHARCELLS | ||
20 | |||
21 | #include "sim_icons.h" | ||
22 | |||
23 | #include <lcd.h> | ||
24 | #include <kernel.h> | ||
25 | #include <sprintf.h> | ||
26 | #include <string.h> | ||
27 | #include <debug.h> | ||
28 | |||
29 | #define XPOS_volume 105 | ||
30 | #define XPOS_volume1 XPOS_volume + 15 | ||
31 | #define XPOS_volume2 XPOS_volume1 + 2 | ||
32 | #define XPOS_volume3 XPOS_volume2 + 2 | ||
33 | #define XPOS_volume4 XPOS_volume3 + 2 | ||
34 | #define XPOS_volume5 XPOS_volume4 + 2 | ||
35 | |||
36 | #define BMPHEIGHT_battery 7 | ||
37 | #define BMPWIDTH_battery 14 | ||
38 | const unsigned char battery[] = { | ||
39 | 0x7f, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x7f, 0x14, 0x1c, | ||
40 | |||
41 | }; | ||
42 | #define BMPHEIGHT_battery_bit 3 | ||
43 | #define BMPWIDTH_battery_bit 2 | ||
44 | const unsigned char battery_bit[] = { | ||
45 | 0x07, 0x07, | ||
46 | |||
47 | }; | ||
48 | #define BMPHEIGHT_pause 7 | ||
49 | #define BMPWIDTH_pause 7 | ||
50 | const unsigned char pause[] = { | ||
51 | 0x7f, 0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x7f, | ||
52 | |||
53 | }; | ||
54 | #define BMPHEIGHT_play 7 | ||
55 | #define BMPWIDTH_play 8 | ||
56 | const unsigned char play[] = { | ||
57 | 0x7f, 0x7f, 0x3e, 0x3e, 0x1c, 0x1c, 0x08, 0x08, | ||
58 | |||
59 | }; | ||
60 | #define BMPHEIGHT_record 8 | ||
61 | #define BMPWIDTH_record 4 | ||
62 | const unsigned char record[] = { | ||
63 | 0x08, 0x1c, 0x1c, 0x08, | ||
64 | |||
65 | }; | ||
66 | #define BMPHEIGHT_volume 7 | ||
67 | #define BMPWIDTH_volume 13 | ||
68 | const unsigned char volume[] = { | ||
69 | 0x0e, 0x30, 0x60, 0x30, 0x0e, 0x30, 0x48, 0x48, 0x48, 0x30, 0x00, 0x7e, 0x00, | ||
70 | |||
71 | }; | ||
72 | #define BMPHEIGHT_volume1 7 | ||
73 | #define BMPWIDTH_volume1 2 | ||
74 | const unsigned char volume1[] = { | ||
75 | 0x00, 0x70, | ||
76 | |||
77 | }; | ||
78 | #define BMPHEIGHT_volume2 7 | ||
79 | #define BMPWIDTH_volume2 2 | ||
80 | const unsigned char volume2[] = { | ||
81 | 0x00, 0x78, | ||
82 | |||
83 | }; | ||
84 | #define BMPHEIGHT_volume3 7 | ||
85 | #define BMPWIDTH_volume3 2 | ||
86 | const unsigned char volume3[] = { | ||
87 | 0x00, 0x7c, | ||
88 | |||
89 | }; | ||
90 | #define BMPHEIGHT_volume4 7 | ||
91 | #define BMPWIDTH_volume4 2 | ||
92 | const unsigned char volume4[] = { | ||
93 | 0x00, 0x7e, | ||
94 | |||
95 | }; | ||
96 | #define BMPHEIGHT_volume5 7 | ||
97 | #define BMPWIDTH_volume5 2 | ||
98 | const unsigned char volume5[] = { | ||
99 | 0x00, 0x7f, | ||
100 | |||
101 | }; | ||
102 | #define BMPHEIGHT_usb 7 | ||
103 | #define BMPWIDTH_usb 22 | ||
104 | const unsigned char usb[] = { | ||
105 | 0x08, 0x1c, 0x1c, 0x08, 0x0c, 0x0e, 0x1b, 0x39, 0x69, 0x49, 0x49, 0x49, 0x4b, 0x4b, 0x48, 0x48, 0x68, 0x68, 0x08, 0x1c, 0x1c, 0x08, | ||
106 | |||
107 | }; | ||
108 | #define BMPHEIGHT_audio 7 | ||
109 | #define BMPWIDTH_audio 27 | ||
110 | const unsigned char audio[] = { | ||
111 | 0x1c, 0x22, 0x41, 0x79, 0x55, 0x55, 0x79, 0x41, 0x5d, 0x61, 0x61, 0x5d, 0x41, 0x7d, 0x65, 0x65, 0x59, 0x41, 0x7d, 0x41, 0x59, 0x65, 0x65, 0x59, 0x41, 0x22, 0x1c, | ||
112 | |||
113 | }; | ||
114 | #define BMPHEIGHT_param 7 | ||
115 | #define BMPWIDTH_param 31 | ||
116 | const unsigned char param[] = { | ||
117 | 0x1c, 0x22, 0x41, 0x7d, 0x55, 0x55, 0x49, 0x41, 0x79, 0x55, 0x55, 0x79, 0x41, 0x7d, 0x55, 0x75, 0x69, 0x41, 0x79, 0x55, 0x55, 0x79, 0x41, 0x7d, 0x49, 0x51, 0x49, 0x7d, 0x41, 0x22, 0x1c, | ||
118 | |||
119 | }; | ||
120 | |||
121 | |||
122 | struct icon_info | ||
123 | { | ||
124 | const unsigned char* bitmap; | ||
125 | int xpos; | ||
126 | int ypos; | ||
127 | int width; | ||
128 | int height; | ||
129 | }; | ||
130 | |||
131 | static struct icon_info icons [] = | ||
132 | { | ||
133 | { battery, 0, 0, BMPWIDTH_battery, BMPHEIGHT_battery }, /* ICON_BATTERY */ | ||
134 | { battery_bit, 2, 2, BMPWIDTH_battery_bit, BMPHEIGHT_battery_bit }, /* ICON_BATTERY_1 */ | ||
135 | { battery_bit, 5, 2, BMPWIDTH_battery_bit, BMPHEIGHT_battery_bit }, /* ICON_BATTERY_2 */ | ||
136 | { battery_bit, 8, 2, BMPWIDTH_battery_bit, BMPHEIGHT_battery_bit }, /* ICON_BATTERY_3 */ | ||
137 | { usb, 0, 40, BMPWIDTH_usb, BMPHEIGHT_usb }, /* ICON_USB */ | ||
138 | { play, 40, 0, BMPWIDTH_play, BMPHEIGHT_play }, /* ICON_PLAY */ | ||
139 | { record, 48, 0, BMPWIDTH_record, BMPHEIGHT_record }, /* ICON_RECORD */ | ||
140 | { pause, 60, 0, BMPWIDTH_pause, BMPHEIGHT_pause }, /* ICON_PAUSE */ | ||
141 | { audio, 40, 40, BMPWIDTH_audio, BMPHEIGHT_audio }, /* ICON_AUDIO */ | ||
142 | { 0, 0, 0, 0, 0 }, /* ICON_REPEAT */ | ||
143 | { 0, 0, 0, 0, 0 }, /* ICON_1 */ | ||
144 | { volume, XPOS_volume, 0, BMPWIDTH_volume, BMPHEIGHT_volume }, /* ICON_VOLUME */ | ||
145 | { volume1, XPOS_volume1, 0, BMPWIDTH_volume1, BMPHEIGHT_volume1 }, /* ICON_VOLUME1 */ | ||
146 | { volume2, XPOS_volume2, 0, BMPWIDTH_volume2, BMPHEIGHT_volume2 }, /* ICON_VOLUME2 */ | ||
147 | { volume3, XPOS_volume3, 0, BMPWIDTH_volume3, BMPHEIGHT_volume3 }, /* ICON_VOLUME3 */ | ||
148 | { volume4, XPOS_volume4, 0, BMPWIDTH_volume4, BMPHEIGHT_volume4 }, /* ICON_VOLUME4 */ | ||
149 | { volume5, XPOS_volume5, 0, BMPWIDTH_volume5, BMPHEIGHT_volume5 }, /* ICON_VOLUME5 */ | ||
150 | { param, 90, 40, BMPWIDTH_param, BMPHEIGHT_param }, /* ICON_PARAM */ | ||
151 | }; | ||
152 | |||
153 | void display_icon(int icon, bool enable) | ||
154 | { | ||
155 | if (enable) | ||
156 | lcd_bitmap((unsigned char*)icons[icon].bitmap, icons[icon].xpos, icons[icon].ypos, icons[icon].width, icons[icon].height, true); | ||
157 | else | ||
158 | lcd_clearrect(icons[icon].xpos, icons[icon].ypos, icons[icon].width, icons[icon].height); | ||
159 | } | ||
160 | |||
161 | void sim_battery_icon(int icon, bool enable) | ||
162 | { | ||
163 | static bool battery_icons[4] = { true, true, true, true }; | ||
164 | int i; | ||
165 | |||
166 | battery_icons[icon] = enable; | ||
167 | |||
168 | for (i = 0; i <= ICON_BATTERY_3; ++i) | ||
169 | { | ||
170 | display_icon(icon, battery_icons[i]); | ||
171 | } | ||
172 | }; | ||
173 | |||
174 | void | ||
175 | sim_lcd_icon(int icon, bool enable) | ||
176 | { | ||
177 | switch (icon) | ||
178 | { | ||
179 | case ICON_BATTERY: | ||
180 | case ICON_BATTERY_1: | ||
181 | case ICON_BATTERY_2: | ||
182 | case ICON_BATTERY_3: | ||
183 | sim_battery_icon(icon, enable); | ||
184 | break; | ||
185 | |||
186 | /* Ignore. Don't know these icons yet */ | ||
187 | case ICON_REPEAT: | ||
188 | case ICON_1: | ||
189 | break; | ||
190 | |||
191 | default: | ||
192 | display_icon(icon, enable); | ||
193 | break; | ||
194 | } | ||
195 | lcd_update(); | ||
196 | } | ||
197 | |||
198 | #endif /* HAVE_LCD_CHARCELLS */ | ||
diff --git a/uisimulator/common/sim_icons.h b/uisimulator/common/sim_icons.h new file mode 100644 index 0000000000..4555b65189 --- /dev/null +++ b/uisimulator/common/sim_icons.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Mats Lidell <matsl@contactor.se> | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITH OUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #ifndef SIM_ICONS | ||
21 | #define SIM_ICONS | ||
22 | |||
23 | #include <stdbool.h> | ||
24 | |||
25 | extern void sim_lcd_icon(int icon, bool enable); | ||
26 | |||
27 | #endif /* SIM_ICONS */ | ||