summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/imx233')
-rw-r--r--firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c b/firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c
index c2e53117e5..91fe059c31 100644
--- a/firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c
+++ b/firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c
@@ -26,6 +26,7 @@
#include "power-imx233.h"
#include "button-lradc-imx233.h"
#include "button-target.h"
+#include "button-imx233.h"
#ifndef BOOTLOADER
#include "touchscreen.h"
@@ -35,15 +36,21 @@
#include "action.h"
#endif
-struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] =
+#define CHAN 0 /* ADC channel for the buttons */
+#define I_VDDIO 0 /* Mock button to define the relative voltage to compute voltage from ADC steps */
+
+struct imx233_button_map_t imx233_button_map[] =
{
- {455, BUTTON_VOL_UP},
- {900, BUTTON_VOL_DOWN},
- {1410, BUTTON_BACK},
- {1868, BUTTON_FF},
- {2311, BUTTON_REW},
- {2700, 0},
- {3300, IMX233_BUTTON_LRADC_END},
+ [I_VDDIO] = IMX233_BUTTON_(VDDIO, VDDIO(3760), "vddio"), /* we need VDDIO for relative */
+ IMX233_BUTTON_(HOLD, GPIO(0, 13), "hold"),
+ IMX233_BUTTON(POWER, PSWITCH(1), "power"),
+ IMX233_BUTTON(SELECT, PSWITCH(3), "select"),
+ IMX233_BUTTON(VOL_UP, LRADC_REL(CHAN, 485, I_VDDIO), "vol up"),
+ IMX233_BUTTON(VOL_DOWN, LRADC_REL(CHAN, 975, I_VDDIO), "vol down"),
+ IMX233_BUTTON(BACK, LRADC_REL(CHAN, 1521, I_VDDIO), "back"),
+ IMX233_BUTTON(FF, LRADC_REL(CHAN, 2000, I_VDDIO), "ff"),
+ IMX233_BUTTON(REW, LRADC_REL(CHAN, 2480, I_VDDIO), "rew"),
+ IMX233_BUTTON_(END, END(), "")
};
#ifndef BOOTLOADER
@@ -93,7 +100,8 @@ void touchpad_pin_setup(void)
void button_init_device(void)
{
- imx233_button_lradc_init();
+ /* init button subsystem */
+ imx233_button_init();
#ifndef BOOTLOADER
touchpad_pin_setup();
/* Now that is powered up, proceed with touchpad initialization */
@@ -102,11 +110,6 @@ void button_init_device(void)
#endif /* BOOTLOADER */
}
-bool button_hold(void)
-{
- return imx233_button_lradc_hold();
-}
-
/* X, Y, RadiusX, RadiusY */
#define TOUCH_UP 2400, 1050, 650, 250
#define TOUCH_DOWN 2057, 3320, 500, 350
@@ -123,13 +126,8 @@ int button_read_device(void)
{
int res = 0;
- switch(imx233_power_read_pswitch())
- {
- case 1: res |= BUTTON_POWER; break;
- case 3: res |= BUTTON_SELECT; break;
- }
-
#ifndef BOOTLOADER
+ /* handle the touchpad events */
touching = imx233_touchscreen_get_touch(&last_x, &last_y);
if(touching)
{
@@ -151,7 +149,8 @@ int button_read_device(void)
}
}
#endif /* BOOTLOADER */
- return imx233_button_lradc_read(res);
+ /* handle the generic events */
+ return imx233_button_read(res);
}
#ifndef BOOTLOADER