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:
parent
6e69e3adaa
commit
e9f7385bdf
2 changed files with 20 additions and 22 deletions
|
|
@ -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/button-ypz5.c
|
||||||
target/arm/imx233/samsung-ypz5/debug-ypz5.c
|
target/arm/imx233/samsung-ypz5/debug-ypz5.c
|
||||||
target/arm/imx233/samsung-ypz5/powermgmt-ypz5.c
|
target/arm/imx233/samsung-ypz5/powermgmt-ypz5.c
|
||||||
target/arm/imx233/button-lradc-imx233.c
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
target/arm/imx233/fmradio-imx233.c
|
target/arm/imx233/fmradio-imx233.c
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include "power-imx233.h"
|
#include "power-imx233.h"
|
||||||
#include "button-lradc-imx233.h"
|
#include "button-lradc-imx233.h"
|
||||||
#include "button-target.h"
|
#include "button-target.h"
|
||||||
|
#include "button-imx233.h"
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
#include "touchscreen.h"
|
#include "touchscreen.h"
|
||||||
|
|
@ -35,15 +36,21 @@
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
#endif
|
#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},
|
[I_VDDIO] = IMX233_BUTTON_(VDDIO, VDDIO(3760), "vddio"), /* we need VDDIO for relative */
|
||||||
{900, BUTTON_VOL_DOWN},
|
IMX233_BUTTON_(HOLD, GPIO(0, 13), "hold"),
|
||||||
{1410, BUTTON_BACK},
|
IMX233_BUTTON(POWER, PSWITCH(1), "power"),
|
||||||
{1868, BUTTON_FF},
|
IMX233_BUTTON(SELECT, PSWITCH(3), "select"),
|
||||||
{2311, BUTTON_REW},
|
IMX233_BUTTON(VOL_UP, LRADC_REL(CHAN, 485, I_VDDIO), "vol up"),
|
||||||
{2700, 0},
|
IMX233_BUTTON(VOL_DOWN, LRADC_REL(CHAN, 975, I_VDDIO), "vol down"),
|
||||||
{3300, IMX233_BUTTON_LRADC_END},
|
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
|
#ifndef BOOTLOADER
|
||||||
|
|
@ -93,7 +100,8 @@ void touchpad_pin_setup(void)
|
||||||
|
|
||||||
void button_init_device(void)
|
void button_init_device(void)
|
||||||
{
|
{
|
||||||
imx233_button_lradc_init();
|
/* init button subsystem */
|
||||||
|
imx233_button_init();
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
touchpad_pin_setup();
|
touchpad_pin_setup();
|
||||||
/* Now that is powered up, proceed with touchpad initialization */
|
/* Now that is powered up, proceed with touchpad initialization */
|
||||||
|
|
@ -102,11 +110,6 @@ void button_init_device(void)
|
||||||
#endif /* BOOTLOADER */
|
#endif /* BOOTLOADER */
|
||||||
}
|
}
|
||||||
|
|
||||||
bool button_hold(void)
|
|
||||||
{
|
|
||||||
return imx233_button_lradc_hold();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* X, Y, RadiusX, RadiusY */
|
/* X, Y, RadiusX, RadiusY */
|
||||||
#define TOUCH_UP 2400, 1050, 650, 250
|
#define TOUCH_UP 2400, 1050, 650, 250
|
||||||
#define TOUCH_DOWN 2057, 3320, 500, 350
|
#define TOUCH_DOWN 2057, 3320, 500, 350
|
||||||
|
|
@ -123,13 +126,8 @@ int button_read_device(void)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
switch(imx233_power_read_pswitch())
|
|
||||||
{
|
|
||||||
case 1: res |= BUTTON_POWER; break;
|
|
||||||
case 3: res |= BUTTON_SELECT; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
|
/* handle the touchpad events */
|
||||||
touching = imx233_touchscreen_get_touch(&last_x, &last_y);
|
touching = imx233_touchscreen_get_touch(&last_x, &last_y);
|
||||||
if(touching)
|
if(touching)
|
||||||
{
|
{
|
||||||
|
|
@ -151,7 +149,8 @@ int button_read_device(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* BOOTLOADER */
|
#endif /* BOOTLOADER */
|
||||||
return imx233_button_lradc_read(res);
|
/* handle the generic events */
|
||||||
|
return imx233_button_read(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue