forked from len0rd/rockbox
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
This commit is contained in:
parent
80e4d671d2
commit
a4d48d0c0d
5 changed files with 135 additions and 30 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue