summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Dziok <b0hoon@o2.pl>2014-11-08 21:12:24 +0100
committerSzymon Dziok <b0hoon@o2.pl>2014-11-10 21:40:47 +0100
commitbcca1114383c2147e60e73825ec68403c90bea40 (patch)
treee07dcc5f35478d20c5db328e2f2430cea997e185
parent73a780265a25371c0d58d7784fa52946011606cc (diff)
downloadrockbox-bcca1114383c2147e60e73825ec68403c90bea40.tar.gz
rockbox-bcca1114383c2147e60e73825ec68403c90bea40.zip
HDD1630/HDD6330/SA9200: Integration of the clicker with the "Keyclick" menu.
Change-Id: Ieb26f2252c1f2613cc9bd83c8349f49113f46d87
-rw-r--r--firmware/SOURCES2
-rw-r--r--firmware/export/config/gogearhdd1630.h2
-rw-r--r--firmware/export/config/gogearhdd6330.h2
-rw-r--r--firmware/export/config/gogearsa9200.h2
-rw-r--r--firmware/target/arm/philips/hdd1630/button-hdd1630.c20
-rw-r--r--firmware/target/arm/philips/hdd6330/button-hdd6330.c18
-rw-r--r--firmware/target/arm/philips/piezo.c67
-rw-r--r--firmware/target/arm/philips/piezo.h23
-rw-r--r--firmware/target/arm/philips/sa9200/button-sa9200.c17
9 files changed, 99 insertions, 54 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 950e4f2bcf..cf8a59bd00 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -944,6 +944,7 @@ target/arm/sandisk/sansa-view/powermgmt-view.c
944#ifdef PHILIPS_SA9200 944#ifdef PHILIPS_SA9200
945#ifndef BOOTLOADER 945#ifndef BOOTLOADER
946drivers/synaptics-mep.c 946drivers/synaptics-mep.c
947target/arm/philips/piezo.c
947#endif /* BOOTLOADER */ 948#endif /* BOOTLOADER */
948target/arm/philips/sa9200/backlight-sa9200.c 949target/arm/philips/sa9200/backlight-sa9200.c
949target/arm/philips/sa9200/button-sa9200.c 950target/arm/philips/sa9200/button-sa9200.c
@@ -956,6 +957,7 @@ target/arm/philips/sa9200/powermgmt-sa9200.c
956#if defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330) 957#if defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330)
957#ifndef BOOTLOADER 958#ifndef BOOTLOADER
958drivers/synaptics-mep.c 959drivers/synaptics-mep.c
960target/arm/philips/piezo.c
959#endif /* BOOTLOADER */ 961#endif /* BOOTLOADER */
960target/arm/philips/power-hdd.c 962target/arm/philips/power-hdd.c
961target/arm/philips/fmradio_i2c-hdd.c 963target/arm/philips/fmradio_i2c-hdd.c
diff --git a/firmware/export/config/gogearhdd1630.h b/firmware/export/config/gogearhdd1630.h
index f36526172f..e1e0af0566 100644
--- a/firmware/export/config/gogearhdd1630.h
+++ b/firmware/export/config/gogearhdd1630.h
@@ -77,6 +77,8 @@
77 77
78#define CONFIG_KEYPAD PHILIPS_HDD1630_PAD 78#define CONFIG_KEYPAD PHILIPS_HDD1630_PAD
79 79
80#define HAVE_HARDWARE_CLICK
81
80/* Define this to enable morse code input */ 82/* Define this to enable morse code input */
81#define HAVE_MORSE_INPUT 83#define HAVE_MORSE_INPUT
82 84
diff --git a/firmware/export/config/gogearhdd6330.h b/firmware/export/config/gogearhdd6330.h
index 3e12b63177..fde8364ded 100644
--- a/firmware/export/config/gogearhdd6330.h
+++ b/firmware/export/config/gogearhdd6330.h
@@ -77,6 +77,8 @@
77 77
78#define CONFIG_KEYPAD PHILIPS_HDD6330_PAD 78#define CONFIG_KEYPAD PHILIPS_HDD6330_PAD
79 79
80#define HAVE_HARDWARE_CLICK
81
80/* Define this to enable morse code input */ 82/* Define this to enable morse code input */
81#define HAVE_MORSE_INPUT 83#define HAVE_MORSE_INPUT
82 84
diff --git a/firmware/export/config/gogearsa9200.h b/firmware/export/config/gogearsa9200.h
index c6dd67a5b7..90d5ad6938 100644
--- a/firmware/export/config/gogearsa9200.h
+++ b/firmware/export/config/gogearsa9200.h
@@ -60,6 +60,8 @@
60 60
61#define CONFIG_KEYPAD PHILIPS_SA9200_PAD 61#define CONFIG_KEYPAD PHILIPS_SA9200_PAD
62 62
63#define HAVE_HARDWARE_CLICK
64
63/* Define this to enable morse code input */ 65/* Define this to enable morse code input */
64#define HAVE_MORSE_INPUT 66#define HAVE_MORSE_INPUT
65 67
diff --git a/firmware/target/arm/philips/hdd1630/button-hdd1630.c b/firmware/target/arm/philips/hdd1630/button-hdd1630.c
index df0f5afbed..faed6abb72 100644
--- a/firmware/target/arm/philips/hdd1630/button-hdd1630.c
+++ b/firmware/target/arm/philips/hdd1630/button-hdd1630.c
@@ -29,18 +29,6 @@
29 29
30static int int_btn = BUTTON_NONE; 30static int int_btn = BUTTON_NONE;
31 31
32/*
33 * Generate a click sound from the player (not in headphones yet)
34 * TODO: integrate this with the "key click" option
35 */
36static void button_click(void)
37{
38 GPO32_ENABLE |= 0x2000;
39 GPO32_VAL |= 0x2000;
40 udelay(1000);
41 GPO32_VAL &= ~0x2000;
42}
43
44#ifndef BOOTLOADER 32#ifndef BOOTLOADER
45void button_init_device(void) 33void button_init_device(void)
46{ 34{
@@ -59,7 +47,7 @@ void button_int(void)
59 int_btn = BUTTON_NONE; 47 int_btn = BUTTON_NONE;
60 48
61 val = touchpad_read_device(data, 4); 49 val = touchpad_read_device(data, 4);
62 50
63 if (val == MEP_BUTTON_HEADER) 51 if (val == MEP_BUTTON_HEADER)
64 { 52 {
65 /* Buttons packet */ 53 /* Buttons packet */
@@ -96,7 +84,6 @@ bool button_hold(void)
96 */ 84 */
97int button_read_device(void) 85int button_read_device(void)
98{ 86{
99 static int btn_old = BUTTON_NONE;
100 int btn = int_btn; 87 int btn = int_btn;
101 88
102 /* Hold */ 89 /* Hold */
@@ -111,11 +98,6 @@ int button_read_device(void)
111 if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_PLAYLIST; 98 if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_PLAYLIST;
112 if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER; 99 if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER;
113 100
114 if ((btn != btn_old) && (btn != BUTTON_NONE))
115 button_click();
116
117 btn_old = btn;
118
119 return btn; 101 return btn;
120} 102}
121 103
diff --git a/firmware/target/arm/philips/hdd6330/button-hdd6330.c b/firmware/target/arm/philips/hdd6330/button-hdd6330.c
index 3f662cca4f..9e9bfd941a 100644
--- a/firmware/target/arm/philips/hdd6330/button-hdd6330.c
+++ b/firmware/target/arm/philips/hdd6330/button-hdd6330.c
@@ -37,18 +37,6 @@ static int scroll_repeat = BUTTON_NONE;
37#endif 37#endif
38static int repeat = 0; 38static int repeat = 0;
39 39
40/*
41 * Generate a click sound from the player (not in headphones yet)
42 * TODO: integrate this with the "key click" option
43 */
44static void button_click(void)
45{
46 GPO32_ENABLE |= 0x2000;
47 GPO32_VAL |= 0x2000;
48 udelay(1000);
49 GPO32_VAL &= ~0x2000;
50}
51
52#ifndef BOOTLOADER 40#ifndef BOOTLOADER
53void button_init_device(void) 41void button_init_device(void)
54{ 42{
@@ -142,7 +130,6 @@ bool button_hold(void)
142 */ 130 */
143int button_read_device(void) 131int button_read_device(void)
144{ 132{
145 static int btn_old = BUTTON_NONE;
146 int btn = int_btn; 133 int btn = int_btn;
147 134
148 /* Hold */ 135 /* Hold */
@@ -167,11 +154,6 @@ int button_read_device(void)
167 btn = BUTTON_NONE; 154 btn = BUTTON_NONE;
168 } 155 }
169 156
170 if ((btn != btn_old) && (btn != BUTTON_NONE))
171 button_click();
172
173 btn_old = btn;
174
175 return btn; 157 return btn;
176} 158}
177 159
diff --git a/firmware/target/arm/philips/piezo.c b/firmware/target/arm/philips/piezo.c
new file mode 100644
index 0000000000..52c3fed2d0
--- /dev/null
+++ b/firmware/target/arm/philips/piezo.c
@@ -0,0 +1,67 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2014 Szymon Dziok
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "system.h"
23#include "kernel.h"
24#include "piezo.h"
25
26void piezo_hw_voltage_on(void)
27{
28#ifndef SIMULATOR
29
30#if defined(PHILIPS_SA9200)
31 GPIOF_ENABLE |= 0x08;
32 GPIOF_OUTPUT_VAL |= 0x08;
33 GPIOF_OUTPUT_EN |= 0x08;
34#else
35 GPO32_ENABLE |= 0x2000;
36 GPO32_VAL |= 0x2000;
37#endif /* PHILIPS_SA9200 */
38
39#endif
40}
41
42void piezo_hw_voltage_off(void)
43{
44#ifndef SIMULATOR
45
46#if defined(PHILIPS_SA9200)
47 GPIOF_OUTPUT_VAL &= ~0x08;
48#else
49 GPO32_VAL &= ~0x2000;
50#endif /* PHILIPS_SA9200 */
51
52#endif
53}
54
55void piezo_init(void)
56{
57}
58
59void piezo_button_beep(bool beep, bool force)
60{
61 /* hw can only do a click */
62 (void)beep;
63 (void)force;
64 piezo_hw_voltage_on();
65 udelay(1000);
66 piezo_hw_voltage_off();
67}
diff --git a/firmware/target/arm/philips/piezo.h b/firmware/target/arm/philips/piezo.h
new file mode 100644
index 0000000000..730042c4f3
--- /dev/null
+++ b/firmware/target/arm/philips/piezo.h
@@ -0,0 +1,23 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2014 Szymon Dziok
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22void piezo_init(void);
23void piezo_button_beep(bool beep, bool force);
diff --git a/firmware/target/arm/philips/sa9200/button-sa9200.c b/firmware/target/arm/philips/sa9200/button-sa9200.c
index c02d1088dc..bef5be7522 100644
--- a/firmware/target/arm/philips/sa9200/button-sa9200.c
+++ b/firmware/target/arm/philips/sa9200/button-sa9200.c
@@ -29,19 +29,6 @@
29 29
30static int int_btn = BUTTON_NONE; 30static int int_btn = BUTTON_NONE;
31 31
32/*
33 * Generate a click sound from the player (not in headphones yet)
34 * TODO: integrate this with the "key click" option
35 */
36static void button_click(void)
37{
38 GPIOF_ENABLE |= 0x08;
39 GPIOF_OUTPUT_VAL |= 0x08;
40 GPIOF_OUTPUT_EN |= 0x08;
41 udelay(1000);
42 GPIOF_OUTPUT_VAL &= ~0x08;
43}
44
45#ifndef BOOTLOADER 32#ifndef BOOTLOADER
46static bool hold_button_old = false; 33static bool hold_button_old = false;
47 34
@@ -148,7 +135,6 @@ bool button_hold(void)
148 */ 135 */
149int button_read_device(void) 136int button_read_device(void)
150{ 137{
151 static int btn_old = BUTTON_NONE;
152 int btn = int_btn; 138 int btn = int_btn;
153 bool hold = !(GPIOL_INPUT_VAL & 0x40); 139 bool hold = !(GPIOL_INPUT_VAL & 0x40);
154 140
@@ -168,9 +154,6 @@ int button_read_device(void)
168 if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_VOL_UP; 154 if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_VOL_UP;
169 if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN; 155 if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN;
170 156
171 if ((btn != btn_old) && (btn != BUTTON_NONE)) button_click();
172 btn_old = btn;
173
174 return btn; 157 return btn;
175} 158}
176 159