Tatung Elio: a few more buttons identified

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23737 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Robert Kukla 2009-11-24 15:42:54 +00:00
parent ed13fd6dca
commit 1511d75f9d
2 changed files with 30 additions and 65 deletions

View file

@ -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_VOL_DOWN 0x00000001
#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
/* 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
#define BUTTON_MAIN 0x00000fff
/* 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

View file

@ -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;