mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
nwz{e360,e370}: switch to new button driver
Change-Id: Iad08653f6cdbcfd75d3130186f91ed0b49a04ac9
This commit is contained in:
parent
a2bfbe9ebc
commit
8660393c9f
3 changed files with 21 additions and 33 deletions
|
|
@ -1229,7 +1229,6 @@ target/arm/imx233/creative-zenxfi3/powermgmt-zenxfi3.c
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SONY_NWZE360) || defined(SONY_NWZE370)
|
#if defined(SONY_NWZE360) || defined(SONY_NWZE370)
|
||||||
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
|
||||||
|
|
|
||||||
|
|
@ -25,40 +25,37 @@
|
||||||
#include "power-imx233.h"
|
#include "power-imx233.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "button-lradc-imx233.h"
|
#include "button-imx233.h"
|
||||||
|
|
||||||
struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] =
|
#define CHAN 0
|
||||||
|
#define I_VDDIO 0 /* index in the table */
|
||||||
|
|
||||||
|
struct imx233_button_map_t imx233_button_map[] =
|
||||||
{
|
{
|
||||||
|
[I_VDDIO] = IMX233_BUTTON_(VDDIO, VDDIO(3630), "vddio"), /* we need VDDIO for relative */
|
||||||
#ifdef SONY_NWZE360
|
#ifdef SONY_NWZE360
|
||||||
{195, BUTTON_VOL_DOWN},
|
IMX233_BUTTON(VOL_DOWN, LRADC_REL(CHAN, 180, I_VDDIO), "vol_down"),
|
||||||
{810, BUTTON_VOL_UP},
|
IMX233_BUTTON(VOL_UP, LRADC_REL(CHAN, 830, I_VDDIO), "vol_up"),
|
||||||
#endif
|
#endif
|
||||||
{1095, BUTTON_BACK},
|
IMX233_BUTTON(BACK, LRADC_REL(CHAN, 1135, I_VDDIO), "back"),
|
||||||
{1470, BUTTON_PLAY},
|
IMX233_BUTTON(PLAY, LRADC_REL(CHAN, 1536, I_VDDIO), "play"),
|
||||||
{1845, BUTTON_RIGHT},
|
IMX233_BUTTON(RIGHT, LRADC_REL(CHAN, 1930, I_VDDIO), "right"),
|
||||||
{2185, BUTTON_LEFT},
|
IMX233_BUTTON(LEFT, LRADC_REL(CHAN, 2290, I_VDDIO), "left"),
|
||||||
{2525, BUTTON_UP},
|
IMX233_BUTTON(UP, LRADC_REL(CHAN, 2655, I_VDDIO), "up"),
|
||||||
{2870, BUTTON_DOWN},
|
IMX233_BUTTON(DOWN, LRADC_REL(CHAN, 3020, I_VDDIO), "down"),
|
||||||
{3400, 0},
|
IMX233_BUTTON(POWER, PSWITCH(3), "power"),
|
||||||
{0, IMX233_BUTTON_LRADC_END},
|
#ifdef HAS_BUTTON_HOLD
|
||||||
|
IMX233_BUTTON_(HOLD, GPIO(0, 9), "hold", INVERTED, PULLUP),
|
||||||
|
#endif
|
||||||
|
IMX233_BUTTON_(END, END(), "")
|
||||||
};
|
};
|
||||||
|
|
||||||
void button_init_device(void)
|
void button_init_device(void)
|
||||||
{
|
{
|
||||||
imx233_button_lradc_init();
|
imx233_button_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_BUTTON_HOLD
|
|
||||||
bool button_hold(void)
|
|
||||||
{
|
|
||||||
return imx233_button_lradc_hold();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int button_read_device(void)
|
int button_read_device(void)
|
||||||
{
|
{
|
||||||
int res = 0;
|
return imx233_button_read(0);
|
||||||
if(BF_RD(POWER_STS, PSWITCH) == 3)
|
|
||||||
res |= BUTTON_POWER;
|
|
||||||
return imx233_button_lradc_read(res);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,17 +29,9 @@ int button_read_device(void);
|
||||||
bool button_debug_screen(void);
|
bool button_debug_screen(void);
|
||||||
|
|
||||||
#ifdef SONY_NWZE360
|
#ifdef SONY_NWZE360
|
||||||
// Sony NWZ-E360 has hold detect on B0P09, inverted using pullup
|
|
||||||
#define HAS_BUTTON_HOLD
|
#define HAS_BUTTON_HOLD
|
||||||
#define IMX233_BUTTON_LRADC_HOLD_DET BLH_GPIO
|
|
||||||
#define BLH_GPIO_BANK 0
|
|
||||||
#define BLH_GPIO_PIN 9
|
|
||||||
#define BLH_GPIO_INVERTED
|
|
||||||
#define BLH_GPIO_PULLUP
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IMX233_BUTTON_LRADC_CHANNEL 0
|
|
||||||
|
|
||||||
/* Main unit's buttons */
|
/* Main unit's buttons */
|
||||||
#define BUTTON_POWER 0x00000001
|
#define BUTTON_POWER 0x00000001
|
||||||
#define BUTTON_BACK 0x00000002
|
#define BUTTON_BACK 0x00000002
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue