1
0
Fork 0
forked from len0rd/rockbox

Samsung YP-Z5: keypad adaption to the new button API

After compiling the ypz5 target, I have discovered that the keypad
system was refusing to compile, due to a much newer button API.
This patch adapts the target to the current imx233 implementation.
Additonally, some ADC button values have been re-adjusted.

Change-Id: Ib9bfd6aeec5e9e8dfef5887c4147201dd9028a44
This commit is contained in:
Lorenzo Miori 2017-05-06 15:10:48 +02:00 committed by Amaury Pouly
parent 6e69e3adaa
commit e9f7385bdf
2 changed files with 20 additions and 22 deletions

View file

@ -1485,7 +1485,6 @@ target/arm/imx233/samsung-ypz5/lcd-ypz5.c
target/arm/imx233/samsung-ypz5/button-ypz5.c
target/arm/imx233/samsung-ypz5/debug-ypz5.c
target/arm/imx233/samsung-ypz5/powermgmt-ypz5.c
target/arm/imx233/button-lradc-imx233.c
#ifndef BOOTLOADER
target/arm/imx233/fmradio-imx233.c
#endif

View file

@ -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