summaryrefslogtreecommitdiff
path: root/firmware/target/arm/samsung/button-yh82x_yh92x.c
diff options
context:
space:
mode:
authorSebastian Leonhardt <sebastian.leonhardt@web.de>2015-07-20 01:50:26 +0200
committerGerrit Rockbox <gerrit@rockbox.org>2015-11-15 23:46:39 +0100
commita507bb283782ee3adb1fc9ba0c6f094108ef558c (patch)
treeacae6cf04f8e34172375061b6fbdc11b6ffb84cb /firmware/target/arm/samsung/button-yh82x_yh92x.c
parenta8758c953d50fb020b245d5739c41de113638b49 (diff)
downloadrockbox-a507bb283782ee3adb1fc9ba0c6f094108ef558c.tar.gz
rockbox-a507bb283782ee3adb1fc9ba0c6f094108ef558c.zip
YH8xx,YH9xx: Keymap improvement
The main "innovation" in this patch are two "virtual buttons" for the record switch on YH92x targets. When the switch state changes, a single BUTTON_REC_SW_ON or .._OFF button event will be generated. Thus keymap code can react on switching, but not on the actual state of the switch. Wherever sensible, the following user scheme is applied: - use PLAY as confirm button - use REW button or Long REW to exit - use REC (YH820) or FFWD (YH92X) as modifier key for button combos Change-Id: Ic8d1db9cc6869daed8dda98990dfdf7f6fd5d5a1
Diffstat (limited to 'firmware/target/arm/samsung/button-yh82x_yh92x.c')
-rw-r--r--firmware/target/arm/samsung/button-yh82x_yh92x.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/firmware/target/arm/samsung/button-yh82x_yh92x.c b/firmware/target/arm/samsung/button-yh82x_yh92x.c
index 2874a4a48a..ff8a580d2a 100644
--- a/firmware/target/arm/samsung/button-yh82x_yh92x.c
+++ b/firmware/target/arm/samsung/button-yh82x_yh92x.c
@@ -20,12 +20,15 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#include "system.h" 22#include "system.h"
23#include "kernel.h"
23#include "button.h" 24#include "button.h"
24#include "backlight.h" 25#include "backlight.h"
25#if defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925) 26#if defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925)
27#include "powermgmt.h"
26#include "adc.h" 28#include "adc.h"
27 29
28static int int_btn = BUTTON_NONE; 30static int int_btn = BUTTON_NONE;
31static unsigned int rec_switch;
29 32
30void button_init_device(void) 33void button_init_device(void)
31{ 34{
@@ -44,6 +47,9 @@ void button_init_device(void)
44 /* remote PLAY */ 47 /* remote PLAY */
45 GPIOD_ENABLE |= 0x02; 48 GPIOD_ENABLE |= 0x02;
46 GPIOD_OUTPUT_EN &= ~0x02; 49 GPIOD_OUTPUT_EN &= ~0x02;
50
51 /* current record switch state */
52 rec_switch = ~GPIOA_INPUT_VAL & 0x40;
47} 53}
48 54
49/* Remote buttons */ 55/* Remote buttons */
@@ -117,7 +123,24 @@ int button_read_device(void)
117 if (~GPIOA_INPUT_VAL & 0x08) btn |= BUTTON_DOWN; 123 if (~GPIOA_INPUT_VAL & 0x08) btn |= BUTTON_DOWN;
118 if (~GPIOA_INPUT_VAL & 0x02) btn |= BUTTON_FFWD; 124 if (~GPIOA_INPUT_VAL & 0x02) btn |= BUTTON_FFWD;
119 if (~GPIOA_INPUT_VAL & 0x80) btn |= BUTTON_REW; 125 if (~GPIOA_INPUT_VAL & 0x80) btn |= BUTTON_REW;
126#if defined(SAMSUNG_YH820)
120 if (~GPIOA_INPUT_VAL & 0x40) btn |= BUTTON_REC; 127 if (~GPIOA_INPUT_VAL & 0x40) btn |= BUTTON_REC;
128#else
129 if ((~GPIOA_INPUT_VAL & 0x40) != rec_switch)
130 {
131 if (rec_switch) {
132 queue_post(&button_queue,BUTTON_REC_SW_OFF,0);
133 queue_post(&button_queue,BUTTON_REC_SW_OFF|BUTTON_REL,0);
134 }
135 else {
136 queue_post(&button_queue,BUTTON_REC_SW_ON,0);
137 queue_post(&button_queue,BUTTON_REC_SW_ON|BUTTON_REL,0);
138 }
139 rec_switch = ~GPIOA_INPUT_VAL & 0x40;
140 backlight_on();
141 reset_poweroff_timer();
142 }
143#endif
121#if defined(SAMSUNG_YH820) 144#if defined(SAMSUNG_YH820)
122 if ( GPIOB_INPUT_VAL & 0x80) btn |= BUTTON_PLAY; 145 if ( GPIOB_INPUT_VAL & 0x80) btn |= BUTTON_PLAY;
123#elif defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925) 146#elif defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925)