summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tcc77x/debug-tcc77x.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tcc77x/debug-tcc77x.c')
-rw-r--r--firmware/target/arm/tcc77x/debug-tcc77x.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/firmware/target/arm/tcc77x/debug-tcc77x.c b/firmware/target/arm/tcc77x/debug-tcc77x.c
new file mode 100644
index 0000000000..dc3db3926f
--- /dev/null
+++ b/firmware/target/arm/tcc77x/debug-tcc77x.c
@@ -0,0 +1,81 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Rob Purchase
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#include "config.h"
21#include "cpu.h"
22#include "system.h"
23#include "string.h"
24#include <stdbool.h>
25#include "button.h"
26#include "lcd.h"
27#include "sprintf.h"
28#include "font.h"
29#include "debug-target.h"
30#include "adc.h"
31
32bool __dbg_ports(void)
33{
34 return false;
35}
36
37bool __dbg_hw_info(void)
38{
39 int line = 0, i, button, oldline;
40 bool done=false;
41 char buf[100];
42
43 lcd_setmargins(0, 0);
44 lcd_setfont(FONT_SYSFIXED);
45 lcd_clear_display();
46
47 /* Put all the static text before the while loop */
48 lcd_puts(0, line++, "[Hardware info]");
49
50 line++;
51 oldline=line;
52 while(!done)
53 {
54 line = oldline;
55 button = button_get(false);
56
57 button &= ~BUTTON_REPEAT;
58
59 if (button == BUTTON_SELECT)
60 done=true;
61
62 snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d",
63 (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf);
64
65 snprintf(buf, sizeof(buf), "GPIOA: 0x%08x GPIOB: 0x%08x",
66 (unsigned int)GPIOA, (unsigned int)GPIOB); lcd_puts(0, line++, buf);
67 snprintf(buf, sizeof(buf), "GPIOC: 0x%08x GPIOD: 0x%08x",
68 (unsigned int)GPIOC, (unsigned int)GPIOD); lcd_puts(0, line++, buf);
69 snprintf(buf, sizeof(buf), "GPIOE: 0x%08x",
70 (unsigned int)GPIOE); lcd_puts(0, line++, buf);
71
72 for (i = 0; i<4; i++)
73 {
74 snprintf(buf, sizeof(buf), "ADC%d: 0x%04x", i, adc_read(i));
75 lcd_puts(0, line++, buf);
76 }
77
78 lcd_update();
79 }
80 return false;
81}