1
0
Fork 0
forked from len0rd/rockbox

D2: Implement HAS_BUTTON_HOLD.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16748 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rob Purchase 2008-03-22 15:55:19 +00:00
parent b659c0c14c
commit f061ba4ebb
2 changed files with 11 additions and 7 deletions

View file

@ -27,6 +27,11 @@ void button_init_device(void)
/* Nothing to do */
}
bool button_hold(void)
{
return (GPIOA & 0x8) ? false : true;
}
int button_read_device(void)
{
int btn = BUTTON_NONE;
@ -57,9 +62,6 @@ int button_read_device(void)
/* TODO: Read 'fake' buttons based on touchscreen quadrants.
Question: How can I read from the PCF chip (I2C) in a tick task? */
if (!(GPIOA & 0x8))
btn |= BUTTON_HOLD;
if (!(GPIOA & 0x4))
btn |= BUTTON_POWER;

View file

@ -23,15 +23,17 @@
#include <stdbool.h>
#include "config.h"
#define HAS_BUTTON_HOLD
bool button_hold(void);
void button_init_device(void);
int button_read_device(void);
/* Main unit's buttons */
#define BUTTON_POWER 0x00000001
#define BUTTON_HOLD 0x00000002
#define BUTTON_PLUS 0x00000004
#define BUTTON_MINUS 0x00000008
#define BUTTON_MENU 0x00000010
#define BUTTON_PLUS 0x00000002
#define BUTTON_MINUS 0x00000004
#define BUTTON_MENU 0x00000008
/* Faked buttons based on touchscreen quadrants (not yet read) */
#define BUTTON_UP 0x00000020