mirror of
https://github.com/CTCaer/hekate.git
synced 2024-12-24 12:14:11 +00:00
touch: Do a panel HW test before calibration
In case the panel or the panel connection has issues, abort the calibration.
This commit is contained in:
parent
4ec7befe82
commit
dc9c7fd95c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Touch driver for Nintendo Switch's STM FingerTip S (4cd60d) touch controller
|
* Touch driver for Nintendo Switch's STM FingerTip S (4CD60D) touch controller
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018 langerhans
|
* Copyright (c) 2018 langerhans
|
||||||
* Copyright (c) 2018-2020 CTCaer
|
* Copyright (c) 2018-2020 CTCaer
|
||||||
@ -236,6 +236,46 @@ int touch_sys_reset()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int touch_panel_ito_test(u8 *err)
|
||||||
|
{
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
|
// Reset touchscreen module.
|
||||||
|
if (touch_sys_reset())
|
||||||
|
return res;
|
||||||
|
|
||||||
|
// Do ITO Production test.
|
||||||
|
u8 cmd[2] = { 1, 0 };
|
||||||
|
if (touch_command(STMFTS_ITO_CHECK, cmd, 2))
|
||||||
|
return res;
|
||||||
|
|
||||||
|
u32 timer = get_tmr_ms() + 2000;
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
u8 tmp[8] = {0};
|
||||||
|
i2c_recv_buf_small(tmp, 8, I2C_3, STMFTS_I2C_ADDR, STMFTS_READ_ONE_EVENT);
|
||||||
|
if (tmp[1] == 0xF && tmp[2] == 0x5)
|
||||||
|
{
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
err[0] = tmp[3];
|
||||||
|
err[1] = tmp[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
res = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (get_tmr_ms() > timer)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset touchscreen module.
|
||||||
|
touch_sys_reset();
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
int touch_sense_enable()
|
int touch_sense_enable()
|
||||||
{
|
{
|
||||||
// Enable auto tuning calibration and multi-touch sensing.
|
// Enable auto tuning calibration and multi-touch sensing.
|
||||||
@ -326,9 +366,14 @@ int touch_power_on()
|
|||||||
|
|
||||||
u32 btn = btn_wait_timeout(0, BTN_VOL_DOWN | BTN_VOL_UP);
|
u32 btn = btn_wait_timeout(0, BTN_VOL_DOWN | BTN_VOL_UP);
|
||||||
if ((btn & BTN_VOL_DOWN) && (btn & BTN_VOL_UP))
|
if ((btn & BTN_VOL_DOWN) && (btn & BTN_VOL_UP))
|
||||||
return touch_execute_autotune();
|
{
|
||||||
else
|
u8 err[2];
|
||||||
return touch_init();
|
if (touch_panel_ito_test(err))
|
||||||
|
if (!err[0] && !err[1])
|
||||||
|
return touch_execute_autotune();
|
||||||
|
}
|
||||||
|
|
||||||
|
return touch_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void touch_power_off()
|
void touch_power_off()
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Touch driver for Nintendo Switch's STM FingerTip S (4cd60d) touch controller
|
* Touch driver for Nintendo Switch's STM FingerTip S (4CD60D) touch controller
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018 langerhans
|
* Copyright (c) 2018 langerhans
|
||||||
* Copyright (c) 2018-2020 CTCaer
|
* Copyright (c) 2018-2020 CTCaer
|
||||||
@ -44,6 +44,7 @@
|
|||||||
#define STMFTS_FULL_FORCE_CALIBRATION 0xA2
|
#define STMFTS_FULL_FORCE_CALIBRATION 0xA2
|
||||||
#define STMFTS_MS_CX_TUNING 0xA3
|
#define STMFTS_MS_CX_TUNING 0xA3
|
||||||
#define STMFTS_SS_CX_TUNING 0xA4
|
#define STMFTS_SS_CX_TUNING 0xA4
|
||||||
|
#define STMFTS_ITO_CHECK 0xA7
|
||||||
#define STMFTS_RELEASEINFO 0xAA
|
#define STMFTS_RELEASEINFO 0xAA
|
||||||
#define STMFTS_WRITE_REG 0xB6
|
#define STMFTS_WRITE_REG 0xB6
|
||||||
#define STMFTS_AUTO_CALIBRATION 0xC3
|
#define STMFTS_AUTO_CALIBRATION 0xC3
|
||||||
@ -99,6 +100,27 @@
|
|||||||
#define STMFTS_DATA_MAX_SIZE (STMFTS_EVENT_SIZE * STMFTS_STACK_DEPTH)
|
#define STMFTS_DATA_MAX_SIZE (STMFTS_EVENT_SIZE * STMFTS_STACK_DEPTH)
|
||||||
#define STMFTS_MAX_FINGERS 10
|
#define STMFTS_MAX_FINGERS 10
|
||||||
|
|
||||||
|
typedef enum _touch_ito_error {
|
||||||
|
ITO_NO_ERROR = 0,
|
||||||
|
ITO_FORCE_OPEN,
|
||||||
|
ITO_SENSE_OPEN,
|
||||||
|
ITO_FORCE_SHRT_GND,
|
||||||
|
ITO_SENSE_SHRT_GND,
|
||||||
|
ITO_FORCE_SHRT_VCM,
|
||||||
|
ITO_SENSE_SHRT_VCM,
|
||||||
|
ITO_FORCE_SHRT_FORCE,
|
||||||
|
ITO_SENSE_SHRT_SENSE,
|
||||||
|
ITO_F2E_SENSE,
|
||||||
|
ITO_FPC_FORCE_OPEN,
|
||||||
|
ITO_FPC_SENSE_OPEN,
|
||||||
|
ITO_KEY_FORCE_OPEN,
|
||||||
|
ITO_KEY_SENSE_OPEN,
|
||||||
|
ITO_RESERVED0,
|
||||||
|
ITO_RESERVED1,
|
||||||
|
ITO_RESERVED2,
|
||||||
|
ITO_MAX_ERR_REACHED = 0xFF
|
||||||
|
} touch_ito_error;
|
||||||
|
|
||||||
typedef struct _touch_event {
|
typedef struct _touch_event {
|
||||||
u8 raw[8];
|
u8 raw[8];
|
||||||
u16 type; // Event type.
|
u16 type; // Event type.
|
||||||
@ -126,7 +148,9 @@ void touch_poll(touch_event *event);
|
|||||||
touch_event touch_poll_wait();
|
touch_event touch_poll_wait();
|
||||||
int touch_get_fw_info(touch_fw_info_t *fw);
|
int touch_get_fw_info(touch_fw_info_t *fw);
|
||||||
touch_info touch_get_info();
|
touch_info touch_get_info();
|
||||||
|
int touch_panel_ito_test(u8 *err);
|
||||||
int touch_execute_autotune();
|
int touch_execute_autotune();
|
||||||
|
int touch_sense_enable();
|
||||||
int touch_power_on();
|
int touch_power_on();
|
||||||
void touch_power_off();
|
void touch_power_off();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user