summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/main.c64
1 files changed, 42 insertions, 22 deletions
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 @@
30#include "menu.h" 30#include "menu.h"
31#include "system.h" 31#include "system.h"
32#include "usb.h" 32#include "usb.h"
33#include "adc.h"
33#ifndef SIMULATOR 34#ifndef SIMULATOR
34#include "dmalloc.h" 35#include "dmalloc.h"
35#include "bmalloc.h" 36#include "bmalloc.h"
@@ -49,36 +50,53 @@ char appsversion[]=APPSVERSION;
49 50
50void init(void); 51void init(void);
51 52
53#ifndef SIMULATOR
52/* Test code!!! */ 54/* Test code!!! */
53void dbg_ports(void) 55void dbg_ports(void)
54{ 56{
55 unsigned short porta; 57 unsigned short porta;
56 unsigned short portb; 58 unsigned short portb;
57 unsigned char portc; 59 unsigned char portc;
58 char buf[32]; 60 char buf[32];
59 61
60 lcd_clear_display(); 62 lcd_clear_display();
61 63
62 while(1) 64 while(1)
63 { 65 {
64 porta = PADR; 66 porta = PADR;
65 portb = PBDR; 67 portb = PBDR;
66 portc = PCDR; 68 portc = PCDR;
67 69
68 snprintf(buf, 32, "PCDR: %04x", porta); 70 snprintf(buf, 32, "PADR: %04x", porta);
69 lcd_puts(0, 0, buf); 71 lcd_puts(0, 0, buf);
70 snprintf(buf, 32, "PCDR: %04x", portb); 72 snprintf(buf, 32, "PBDR: %04x", portb);
71 lcd_puts(0, 1, buf); 73 lcd_puts(0, 1, buf);
72 snprintf(buf, 32, "PCDR: %02x", portc); 74 snprintf(buf, 32, "PCDR: %02x", portc);
73 lcd_puts(0, 2, buf); 75 lcd_puts(0, 2, buf);
74 lcd_update(); 76
75 sleep(HZ/10); 77 snprintf(buf, 32, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
76 } 78 lcd_puts(0, 3, buf);
79 snprintf(buf, 32, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
80 lcd_puts(0, 4, buf);
81 snprintf(buf, 32, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
82 lcd_puts(0, 5, buf);
83 snprintf(buf, 32, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
84 lcd_puts(0, 6, buf);
85
86 lcd_update();
87 sleep(HZ/10);
88
89 /* Toggle the charger */
90 if ((portb & PBDR_BTN_ON) == 0)
91 PBDR ^= 0x20;
92 }
77} 93}
94#endif
78 95
79void app_main(void) 96void app_main(void)
80{ 97{
81 init(); 98 init();
99// dbg_ports();
82 browse_root(); 100 browse_root();
83} 101}
84 102
@@ -120,6 +138,8 @@ void init(void)
120#endif 138#endif
121 set_irq_level(0); 139 set_irq_level(0);
122 140
141 adc_init();
142
123 usb_init(); 143 usb_init();
124 144
125 rc = ata_init(); 145 rc = ata_init();