diff options
| author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-06-30 20:25:37 +0000 |
|---|---|---|
| committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-06-30 20:25:37 +0000 |
| commit | 7d3c31b1a90b152b7a7cdd4566771dd3560563bc (patch) | |
| tree | 8dd714b6f411dd0642f07c4abda3da753c38bc71 /apps | |
| parent | d1c88e728ba324fa38a59656bfce4db2cf6d8db7 (diff) | |
| download | rockbox-7d3c31b1a90b152b7a7cdd4566771dd3560563bc.zip rockbox-7d3c31b1a90b152b7a7cdd4566771dd3560563bc.tar.gz rockbox-7d3c31b1a90b152b7a7cdd4566771dd3560563bc.tar.bz2 rockbox-7d3c31b1a90b152b7a7cdd4566771dd3560563bc.tar.xz | |
Added adc_init() call
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1277 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/main.c | 64 |
1 files changed, 42 insertions, 22 deletions
diff --git a/apps/main.c b/apps/main.c index c43248e..4dee1a4 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(); |