summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorRobert Kukla <roolku@rockbox.org>2009-11-24 15:42:54 +0000
committerRobert Kukla <roolku@rockbox.org>2009-11-24 15:42:54 +0000
commit1511d75f9d965cba0e1ef9d2fddb94149196638c (patch)
tree842b60648cd7d630e44ce914a9da7a9459cd68b7 /firmware
parented13fd6dca3503b4513ba7b6a61b01a4e59fd363 (diff)
Tatung Elio: a few more buttons identified
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23737 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/tatung/tpj1022/button-target.h45
-rw-r--r--firmware/target/arm/tatung/tpj1022/button-tpj1022.c56
2 files changed, 33 insertions, 68 deletions
diff --git a/firmware/target/arm/tatung/tpj1022/button-target.h b/firmware/target/arm/tatung/tpj1022/button-target.h
index c7afa59070..979cf88936 100644
--- a/firmware/target/arm/tatung/tpj1022/button-target.h
+++ b/firmware/target/arm/tatung/tpj1022/button-target.h
@@ -7,7 +7,7 @@
* \/ \/ \/ \/ \/
* $Id$
*
- * Copyright (C) 2006 by Barry Wardell
+ * Copyright (C) 2006 by Robert Kukla
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -22,34 +22,33 @@
#ifndef _BUTTON_TARGET_H_
#define _BUTTON_TARGET_H_
-#include <stdbool.h>
-#include "config.h"
-
#define HAS_BUTTON_HOLD
+#define button_init_device()
+
bool button_hold(void);
-void button_init_device(void);
int button_read_device(void);
-/* Tatung Elio TPJ-1022 button codes */
-
/* Main unit's buttons */
-#define BUTTON_POWER 0x00000001
-
-#define BUTTON_LEFT 0x00000002
-#define BUTTON_RIGHT 0x00000004
-#define BUTTON_UP 0x00000008
-#define BUTTON_DOWN 0x00000010
-
-#define BUTTON_MENU 0x00000020
-#define BUTTON_FF 0x00000040
-#define BUTTON_REW 0x00000080
-#define BUTTON_REC 0x00000100
-#define BUTTON_AB 0x00000200
-#define BUTTON_PLUS 0x00000400
-#define BUTTON_MINUS 0x00000800
-
-#define BUTTON_MAIN 0x00000fff
+
+#define BUTTON_VOL_DOWN 0x00000001
+
+/* bit position in GPIOA */
+#define BUTTON_REW 0x00000002
+#define BUTTON_FF 0x00000004
+#define BUTTON_POWER 0x00000008
+#define BUTTON_UP 0x00000010
+#define BUTTON_DOWN 0x00000020
+#define BUTTON_AB 0x00000040
+#define BUTTON_RIGHT 0x00000080
+
+/* still unknown */
+#define BUTTON_MENU 0x00000100
+#define BUTTON_REC 0x00000200
+#define BUTTON_VOL_UP 0x00000400
+#define BUTTON_LEFT 0x00000800
+
+#define BUTTON_MAIN 0x00000FFF
/* No Remote control */
#define BUTTON_REMOTE 0
diff --git a/firmware/target/arm/tatung/tpj1022/button-tpj1022.c b/firmware/target/arm/tatung/tpj1022/button-tpj1022.c
index 6cdca5b35d..ce9d7ab24d 100644
--- a/firmware/target/arm/tatung/tpj1022/button-tpj1022.c
+++ b/firmware/target/arm/tatung/tpj1022/button-tpj1022.c
@@ -7,7 +7,7 @@
* \/ \/ \/ \/ \/
* $Id$
*
- * Copyright (C) 2006 by Barry Wardell
+ * Copyright (C) 2006 by Robert Kukla
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -19,64 +19,30 @@
*
****************************************************************************/
-/* Custom written for the TPJ-1022 based on analysis of the GPIO data */
-
-#include <stdlib.h>
-#include "config.h"
-#include "cpu.h"
#include "system.h"
#include "button.h"
-#include "kernel.h"
-#include "backlight.h"
-
-void button_init_device(void)
-{
- /* No hardware initialisation required as it is done by the bootloader */
-}
bool button_hold(void)
{
- return false;
+ return (GPIOK_INPUT_VAL & 0x40) ? true : false;
}
-/*
- * Get button pressed from hardware
- */
int button_read_device(void)
{
int btn = BUTTON_NONE;
- unsigned char state;
- static bool hold_button = false;
-#if 0
- /* light handling */
- if (hold_button && !button_hold())
+ if (!button_hold())
{
- backlight_on();
- }
-#endif
+ btn = (GPIOA_INPUT_VAL & 0xfe) ^ 0xfe;
- hold_button = button_hold();
- if (!hold_button)
- {
- /* Read normal buttons */
- state = GPIOA_INPUT_VAL;
- if ((state & 0x2) == 0) btn |= BUTTON_REW;
- if ((state & 0x4) == 0) btn |= BUTTON_FF;
- if ((state & 0x80) == 0) btn |= BUTTON_RIGHT;
+ if ((GPIOK_INPUT_VAL & 0x20) == 0) btn |= BUTTON_VOL_DOWN;
- /* Buttons left to figure out:
- button_hold()
- BUTTON_POWER
- BUTTON_LEFT
- BUTTON_UP
- BUTTON_DOWN
- BUTTON_MENU
- BUTTON_REC
- BUTTON_AB
- BUTTON_PLUS
- BUTTON_MINUS
- */
+ /* to be found
+ if ((GPIO?_INPUT_VAL & 0x??) == 0) btn |= BUTTON_MENU;
+ if ((GPIO?_INPUT_VAL & 0x??) == 0) btn |= BUTTON_REC;
+ if ((GPIO?_INPUT_VAL & 0x??) == 0) btn |= BUTTON_VOL_UP;
+ if ((GPIO?_INPUT_VAL & 0x??) == 0) btn |= BUTTON_LEFT;
+ */
}
return btn;