summaryrefslogtreecommitdiff
path: root/apps/main_menu.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-07-01 21:50:52 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-07-01 21:50:52 +0000
commit93cf3d3f46d9101b65069b5beb23c887fccc5350 (patch)
tree461c237d214d13b5d06cf58c1633fd4ae3c69f09 /apps/main_menu.c
parent2d3a67640948f8bfe41cbc40bf31852a74729674 (diff)
Added debug menu entry
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1294 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/main_menu.c')
-rw-r--r--apps/main_menu.c68
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 @@
#include "button.h"
#include "kernel.h"
#include "main_menu.h"
-/*#include "sound_menu.h"*/
#include "version.h"
#include "debug.h"
#include "sprintf.h"
@@ -39,8 +38,14 @@
#include "screensavers_menu.h"
#include "bmp.h"
#include "icons.h"
+
+#ifndef SIMULATOR
+#include "adc.h"
+#endif
#endif
+void dbg_ports(void);
+
int show_logo( void )
{
#ifdef HAVE_LCD_BITMAP
@@ -135,9 +140,70 @@ void main_menu(void)
{ "Screensavers", screensavers_menu },
#endif
{ "Version", show_credits },
+#ifndef SIMULATOR
+ { "Debug (keep out!)", dbg_ports },
+#endif
};
m=menu_init( items, sizeof items / sizeof(struct menu_items) );
menu_run(m);
menu_exit(m);
}
+
+/*---------------------------------------------------*/
+/* SPECIAL DEBUG STUFF */
+/*---------------------------------------------------*/
+#ifndef SIMULATOR
+/* Test code!!! */
+void dbg_ports(void)
+{
+ unsigned short porta;
+ unsigned short portb;
+ unsigned char portc;
+ char buf[32];
+ int button;
+
+ lcd_clear_display();
+
+ while(1)
+ {
+ porta = PADR;
+ portb = PBDR;
+ portc = PCDR;
+
+ snprintf(buf, 32, "PADR: %04x", porta);
+ lcd_puts(0, 0, buf);
+ snprintf(buf, 32, "PBDR: %04x", portb);
+ lcd_puts(0, 1, buf);
+ snprintf(buf, 32, "PCDR: %02x", portc);
+ lcd_puts(0, 2, buf);
+
+ snprintf(buf, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
+ lcd_puts(0, 3, buf);
+ snprintf(buf, 32, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
+ lcd_puts(0, 4, buf);
+ snprintf(buf, 32, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
+ lcd_puts(0, 5, buf);
+ snprintf(buf, 32, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
+ lcd_puts(0, 6, buf);
+
+ lcd_update();
+ sleep(HZ/10);
+
+ button = button_get(false);
+
+ switch(button)
+ {
+ case BUTTON_ON:
+ /* Toggle the charger */
+ PBDR ^= 0x20;
+ break;
+
+ case BUTTON_OFF:
+ /* Disable the charger */
+ PBDR |= 0x20;
+ return;
+ }
+ }
+}
+#endif