blob: e43ad2776406058a9f9af977653e19a5c1c59190 [file] [log] [blame]
Marcoen Hirschbergdd754882006-08-12 08:01:54 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
11 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
Marcoen Hirschbergdd754882006-08-12 08:01:54 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef _BUTTON_TARGET_H_
22#define _BUTTON_TARGET_H_
23
24#include <stdbool.h>
25#include "config.h"
26
27#define HAS_BUTTON_HOLD
28
29bool button_hold(void);
30void button_init_device(void);
31int button_read_device(void);
Michael Sevakisc541e042008-05-29 21:27:44 +000032void touchpad_set_sensitivity(int level);
Marcoen Hirschbergdd754882006-08-12 08:01:54 +000033
34/* Toshiba Gigabeat specific button codes */
35
36#define BUTTON_POWER 0x00000001
37#define BUTTON_MENU 0x00000002
Karl Kurbjun9ba48642008-05-29 22:22:44 +000038#define BUTTON_VOL_UP 0x00000004
39#define BUTTON_VOL_DOWN 0x00000008
40#define BUTTON_A 0x00000010
Marcoen Hirschbergdd754882006-08-12 08:01:54 +000041
Karl Kurbjun9ba48642008-05-29 22:22:44 +000042#define BUTTON_LEFT 0x00000020
43#define BUTTON_RIGHT 0x00000040
44#define BUTTON_UP 0x00000080
45#define BUTTON_DOWN 0x00000100
Marcoen Hirschbergdd754882006-08-12 08:01:54 +000046
Karl Kurbjun9ba48642008-05-29 22:22:44 +000047#define BUTTON_SELECT 0x00000200
Marcoen Hirschbergdd754882006-08-12 08:01:54 +000048
Marcoen Hirschberg0037a1b2007-05-20 11:42:04 +000049/* Remote control buttons */
50
51#define BUTTON_RC_VOL_UP 0x00000400
52#define BUTTON_RC_VOL_DOWN 0x00000800
53#define BUTTON_RC_FF 0x00001000
54#define BUTTON_RC_REW 0x00002000
55
56#define BUTTON_RC_PLAY 0x00004000
57#define BUTTON_RC_DSP 0x00008000
Marcoen Hirschbergdd754882006-08-12 08:01:54 +000058
Marcoen Hirschberg29536762006-12-29 02:49:12 +000059/* Toshiba Gigabeat specific remote button ADC values */
60/* The remote control uses ADC 1 to emulate button pushes
61 Reading (approx) Button HP plugged in? Remote plugged in?
62 0 N/A Yes No
63 125 Play/Pause Cant tell Yes
64 241 Speaker+ Cant tell Yes
65 369 Rewind Cant tell Yes
66 492 Fast Fwd Cant tell Yes
67 616 Vol + Cant tell Yes
68 742 Vol - Cant tell Yes
69 864 None Cant tell Yes
70 1023 N/A No No
71*/
72
73/*
74 Notes:
75
76 Buttons on the remote are translated into equivalent button presses just
77 as if you were pressing them on the Gigabeat itself.
78
79 We cannot tell if the hold is asserted on the remote. The Hold function on
80 the remote is to block the output of the buttons changing.
81
82 Only one button can be sensed at a time. If another is pressed, the button
83 with the lowest reading is dominant. So, if Rewind and Vol + are pressed
84 at the same time, Rewind value is the one that is read.
85*/
86
87
88
89
Marcoen Hirschbergdd754882006-08-12 08:01:54 +000090#define BUTTON_MAIN (BUTTON_POWER|BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT\
91 |BUTTON_UP|BUTTON_DOWN|BUTTON_VOL_UP|BUTTON_VOL_DOWN\
92 |BUTTON_SELECT|BUTTON_A)
93
Marcoen Hirschberg0037a1b2007-05-20 11:42:04 +000094#define BUTTON_REMOTE (BUTTON_RC_VOL_UP|BUTTON_RC_VOL_DOWN|BUTTON_RC_FF\
95 |BUTTON_RC_REW|BUTTON_RC_PLAY|BUTTON_RC_DSP)
Marcoen Hirschbergdd754882006-08-12 08:01:54 +000096
97#define POWEROFF_BUTTON BUTTON_POWER
98#define POWEROFF_COUNT 10
99
100#endif /* _BUTTON_TARGET_H_ */