From 7d3c31b1a90b152b7a7cdd4566771dd3560563bc Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Sun, 30 Jun 2002 20:25:37 +0000 Subject: Added adc_init() call git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1277 a1c6a512-1295-4272-9138-f99709370657 --- apps/main.c | 64 ++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 22 deletions(-) (limited to 'apps') diff --git a/apps/main.c b/apps/main.c index c43248e45a..4dee1a482c 100644 --- a/apps/main.c +++ b/apps/main.c @@ -30,6 +30,7 @@ #include "menu.h" #include "system.h" #include "usb.h" +#include "adc.h" #ifndef SIMULATOR #include "dmalloc.h" #include "bmalloc.h" @@ -49,36 +50,53 @@ char appsversion[]=APPSVERSION; void init(void); +#ifndef SIMULATOR /* Test code!!! */ void dbg_ports(void) { - unsigned short porta; - unsigned short portb; - unsigned char portc; - char buf[32]; - - lcd_clear_display(); - - while(1) - { - porta = PADR; - portb = PBDR; - portc = PCDR; - - snprintf(buf, 32, "PCDR: %04x", porta); - lcd_puts(0, 0, buf); - snprintf(buf, 32, "PCDR: %04x", portb); - lcd_puts(0, 1, buf); - snprintf(buf, 32, "PCDR: %02x", portc); - lcd_puts(0, 2, buf); - lcd_update(); - sleep(HZ/10); - } + unsigned short porta; + unsigned short portb; + unsigned char portc; + char buf[32]; + + 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); + + /* Toggle the charger */ + if ((portb & PBDR_BTN_ON) == 0) + PBDR ^= 0x20; + } } +#endif void app_main(void) { init(); +// dbg_ports(); browse_root(); } @@ -120,6 +138,8 @@ void init(void) #endif set_irq_level(0); + adc_init(); + usb_init(); rc = ata_init(); -- cgit v1.2.3