diff options
-rw-r--r-- | apps/main_menu.c | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/apps/main_menu.c b/apps/main_menu.c index 5fdb66a420..a21fae33ef 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include "button.h" | 24 | #include "button.h" |
25 | #include "kernel.h" | 25 | #include "kernel.h" |
26 | #include "main_menu.h" | 26 | #include "main_menu.h" |
27 | /*#include "sound_menu.h"*/ | ||
28 | #include "version.h" | 27 | #include "version.h" |
29 | #include "debug.h" | 28 | #include "debug.h" |
30 | #include "sprintf.h" | 29 | #include "sprintf.h" |
@@ -39,8 +38,14 @@ | |||
39 | #include "screensavers_menu.h" | 38 | #include "screensavers_menu.h" |
40 | #include "bmp.h" | 39 | #include "bmp.h" |
41 | #include "icons.h" | 40 | #include "icons.h" |
41 | |||
42 | #ifndef SIMULATOR | ||
43 | #include "adc.h" | ||
44 | #endif | ||
42 | #endif | 45 | #endif |
43 | 46 | ||
47 | void dbg_ports(void); | ||
48 | |||
44 | int show_logo( void ) | 49 | int show_logo( void ) |
45 | { | 50 | { |
46 | #ifdef HAVE_LCD_BITMAP | 51 | #ifdef HAVE_LCD_BITMAP |
@@ -135,9 +140,70 @@ void main_menu(void) | |||
135 | { "Screensavers", screensavers_menu }, | 140 | { "Screensavers", screensavers_menu }, |
136 | #endif | 141 | #endif |
137 | { "Version", show_credits }, | 142 | { "Version", show_credits }, |
143 | #ifndef SIMULATOR | ||
144 | { "Debug (keep out!)", dbg_ports }, | ||
145 | #endif | ||
138 | }; | 146 | }; |
139 | 147 | ||
140 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); | 148 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); |
141 | menu_run(m); | 149 | menu_run(m); |
142 | menu_exit(m); | 150 | menu_exit(m); |
143 | } | 151 | } |
152 | |||
153 | /*---------------------------------------------------*/ | ||
154 | /* SPECIAL DEBUG STUFF */ | ||
155 | /*---------------------------------------------------*/ | ||
156 | #ifndef SIMULATOR | ||
157 | /* Test code!!! */ | ||
158 | void dbg_ports(void) | ||
159 | { | ||
160 | unsigned short porta; | ||
161 | unsigned short portb; | ||
162 | unsigned char portc; | ||
163 | char buf[32]; | ||
164 | int button; | ||
165 | |||
166 | lcd_clear_display(); | ||
167 | |||
168 | while(1) | ||
169 | { | ||
170 | porta = PADR; | ||
171 | portb = PBDR; | ||
172 | portc = PCDR; | ||
173 | |||
174 | snprintf(buf, 32, "PADR: %04x", porta); | ||
175 | lcd_puts(0, 0, buf); | ||
176 | snprintf(buf, 32, "PBDR: %04x", portb); | ||
177 | lcd_puts(0, 1, buf); | ||
178 | snprintf(buf, 32, "PCDR: %02x", portc); | ||
179 | lcd_puts(0, 2, buf); | ||
180 | |||
181 | snprintf(buf, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4)); | ||
182 | lcd_puts(0, 3, buf); | ||
183 | snprintf(buf, 32, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5)); | ||
184 | lcd_puts(0, 4, buf); | ||
185 | snprintf(buf, 32, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6)); | ||
186 | lcd_puts(0, 5, buf); | ||
187 | snprintf(buf, 32, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7)); | ||
188 | lcd_puts(0, 6, buf); | ||
189 | |||
190 | lcd_update(); | ||
191 | sleep(HZ/10); | ||
192 | |||
193 | button = button_get(false); | ||
194 | |||
195 | switch(button) | ||
196 | { | ||
197 | case BUTTON_ON: | ||
198 | /* Toggle the charger */ | ||
199 | PBDR ^= 0x20; | ||
200 | break; | ||
201 | |||
202 | case BUTTON_OFF: | ||
203 | /* Disable the charger */ | ||
204 | PBDR |= 0x20; | ||
205 | return; | ||
206 | } | ||
207 | } | ||
208 | } | ||
209 | #endif | ||