summaryrefslogtreecommitdiffstats
path: root/bootloader/telechips.c
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2007-11-01 23:38:57 +0000
committerDave Chapman <dave@dchapman.com>2007-11-01 23:38:57 +0000
commita4d48d0c0dabb3e78e6b1dc31c023627ce924ce1 (patch)
tree23210360f876d7c962368a85f81c909824e2a7e1 /bootloader/telechips.c
parent80e4d671d2271c8a6a3ec463c277fcf7b3fa3ab9 (diff)
downloadrockbox-a4d48d0c0dabb3e78e6b1dc31c023627ce924ce1.tar.gz
rockbox-a4d48d0c0dabb3e78e6b1dc31c023627ce924ce1.tar.bz2
rockbox-a4d48d0c0dabb3e78e6b1dc31c023627ce924ce1.zip
Button driver for Logik DAX, plus some changes to the debug info displayed in the bootloader build.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15396 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader/telechips.c')
-rw-r--r--bootloader/telechips.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/bootloader/telechips.c b/bootloader/telechips.c
index c1dcda0dae..83dad704da 100644
--- a/bootloader/telechips.c
+++ b/bootloader/telechips.c
@@ -32,6 +32,7 @@
#include "fat.h"
#include "disk.h"
#include "font.h"
+#include "button.h"
#include "adc.h"
#include "adc-target.h"
#include "backlight-target.h"
@@ -46,8 +47,10 @@ extern int line;
void* main(void)
{
- unsigned short button;
- int gpioa;
+ int button;
+ int power_count = 0;
+ int count = 0;
+ bool do_power_off = false;
system_init();
adc_init();
@@ -56,17 +59,36 @@ void* main(void)
__backlight_on();
- while(1) {
+ while(!do_power_off) {
line = 0;
printf("Hello World!");
- gpioa = GPIOA;
- printf("GPIOA: 0x%08x",gpioa);
+ button = button_read_device();
- button = adc_read(ADC_BUTTONS);
- printf("ADC[0]: 0x%04x",button);
+ /* Power-off if POWER button has been held for a long time
+ This loop is currently running at about 100 iterations/second
+ */
+ if (button & BUTTON_POWERPLAY) {
+ power_count++;
+ if (power_count > 200)
+ do_power_off = true;
+ } else {
+ power_count = 0;
+ }
+
+ printf("Btn: 0x%08x",button);
+
+ count++;
+ printf("Count: %d",count);
}
+ lcd_clear_display();
+ line = 0;
+ printf("POWER-OFF");
+
+ /* TODO: Power-off */
+ while(1);
+
return 0;
}