Marcoen Hirschberg | dd75488 | 2006-08-12 08:01:54 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2006 by Linus Nielsen Feltzing |
| 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 12 | * 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 Hirschberg | dd75488 | 2006-08-12 08:01:54 +0000 | [diff] [blame] | 16 | * |
| 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 | |
| 29 | bool button_hold(void); |
| 30 | void button_init_device(void); |
| 31 | int button_read_device(void); |
Michael Sevakis | c541e04 | 2008-05-29 21:27:44 +0000 | [diff] [blame] | 32 | void touchpad_set_sensitivity(int level); |
Marcoen Hirschberg | dd75488 | 2006-08-12 08:01:54 +0000 | [diff] [blame] | 33 | |
| 34 | /* Toshiba Gigabeat specific button codes */ |
| 35 | |
| 36 | #define BUTTON_POWER 0x00000001 |
| 37 | #define BUTTON_MENU 0x00000002 |
Karl Kurbjun | 9ba4864 | 2008-05-29 22:22:44 +0000 | [diff] [blame] | 38 | #define BUTTON_VOL_UP 0x00000004 |
| 39 | #define BUTTON_VOL_DOWN 0x00000008 |
| 40 | #define BUTTON_A 0x00000010 |
Marcoen Hirschberg | dd75488 | 2006-08-12 08:01:54 +0000 | [diff] [blame] | 41 | |
Karl Kurbjun | 9ba4864 | 2008-05-29 22:22:44 +0000 | [diff] [blame] | 42 | #define BUTTON_LEFT 0x00000020 |
| 43 | #define BUTTON_RIGHT 0x00000040 |
| 44 | #define BUTTON_UP 0x00000080 |
| 45 | #define BUTTON_DOWN 0x00000100 |
Marcoen Hirschberg | dd75488 | 2006-08-12 08:01:54 +0000 | [diff] [blame] | 46 | |
Karl Kurbjun | 9ba4864 | 2008-05-29 22:22:44 +0000 | [diff] [blame] | 47 | #define BUTTON_SELECT 0x00000200 |
Marcoen Hirschberg | dd75488 | 2006-08-12 08:01:54 +0000 | [diff] [blame] | 48 | |
Marcoen Hirschberg | 0037a1b | 2007-05-20 11:42:04 +0000 | [diff] [blame] | 49 | /* 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 Hirschberg | dd75488 | 2006-08-12 08:01:54 +0000 | [diff] [blame] | 58 | |
Marcoen Hirschberg | 2953676 | 2006-12-29 02:49:12 +0000 | [diff] [blame] | 59 | /* 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 Hirschberg | dd75488 | 2006-08-12 08:01:54 +0000 | [diff] [blame] | 90 | #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 Hirschberg | 0037a1b | 2007-05-20 11:42:04 +0000 | [diff] [blame] | 94 | #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 Hirschberg | dd75488 | 2006-08-12 08:01:54 +0000 | [diff] [blame] | 96 | |
| 97 | #define POWEROFF_BUTTON BUTTON_POWER |
| 98 | #define POWEROFF_COUNT 10 |
| 99 | |
| 100 | #endif /* _BUTTON_TARGET_H_ */ |