mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-05-29 12:18:51 +00:00
feat(core): fix out-of-range touch coordinates on T3W1
[no changelog]
This commit is contained in:
parent
f1120d53c2
commit
f46bfb4bfe
@ -32,6 +32,8 @@
|
||||
#include "panels/lx154a2422cpt23.h"
|
||||
#elif defined TOUCH_PANEL_LHS200KB_IF21
|
||||
#include "panels/lhs200kb-if21.h"
|
||||
#elif defined TOUCH_PANEL_LX250A2410A
|
||||
#include "panels/lx250a2410a.h"
|
||||
#endif
|
||||
|
||||
#include "../touch_fsm.h"
|
||||
@ -282,6 +284,8 @@ static void ft6x36_panel_correction(uint16_t x, uint16_t y, uint16_t* x_new,
|
||||
lx154a2422cpt23_touch_correction(x, y, x_new, y_new);
|
||||
#elif defined TOUCH_PANEL_LHS200KB_IF21
|
||||
lhs200kb_if21_touch_correction(x, y, x_new, y_new);
|
||||
#elif defined TOUCH_PANEL_LX250A2410A
|
||||
lx250a2410a_touch_correction(x, y, x_new, y_new);
|
||||
#else
|
||||
*x_new = x;
|
||||
*y_new = y;
|
||||
|
@ -18,12 +18,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <trezor_bsp.h>
|
||||
#include <trezor_model.h>
|
||||
#include <trezor_rtl.h>
|
||||
|
||||
#include <io/touch.h>
|
||||
#include "lx154a2422cpt23.h"
|
||||
#include "lhs200kb-if21.h"
|
||||
|
||||
void lhs200kb_if21_touch_correction(uint16_t x, uint16_t y, uint16_t *x_new,
|
||||
uint16_t *y_new) {
|
||||
|
@ -17,16 +17,12 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TREZORHAL_TOUCH_LX154A2422CPT23_H
|
||||
#define TREZORHAL_TOUCH_LX154A2422CPT23_H
|
||||
#pragma once
|
||||
|
||||
#include <trezor_types.h>
|
||||
|
||||
// Performs touch coordinates correction needed for a specific panel
|
||||
// Input parameteres x, y represent original touch coordinates.
|
||||
// Output parameters x_new, y_new represent corrected touch coordinates.
|
||||
//
|
||||
// Performs touch coordinates correction needed for a specific panel.
|
||||
// Input parameters x, y represent the original touch coordinates.
|
||||
// Output parameters x_new, y_new represent the corrected touch coordinates.
|
||||
void lhs200kb_if21_touch_correction(uint16_t x, uint16_t y, uint16_t *x_new,
|
||||
uint16_t *y_new);
|
||||
|
||||
#endif
|
||||
|
@ -17,11 +17,6 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <trezor_bsp.h>
|
||||
#include <trezor_model.h>
|
||||
#include <trezor_rtl.h>
|
||||
|
||||
#include <io/touch.h>
|
||||
#include "lx154a2422cpt23.h"
|
||||
|
||||
void lx154a2422cpt23_touch_correction(uint16_t x, uint16_t y, uint16_t *x_new,
|
||||
|
@ -17,19 +17,16 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TREZORHAL_TOUCH_LX154A2422CPT23_H
|
||||
#define TREZORHAL_TOUCH_LX154A2422CPT23_H
|
||||
#pragma once
|
||||
|
||||
#include <trezor_types.h>
|
||||
|
||||
// Performs touch coordinates correction needed for a specific panel
|
||||
// Input parameteres x, y represent original touch coordinates.
|
||||
// Output parameters x_new, y_new represent corrected touch coordinates.
|
||||
// Performs touch coordinates correction needed for a specific panel.
|
||||
// Input parameters x, y represent the original touch coordinates.
|
||||
// Output parameters x_new, y_new represent the corrected touch coordinates.
|
||||
//
|
||||
// In case of LX154A2422CPT23, this correction means to shift X coordinate
|
||||
// towards the edge of the screen, proportionally to the distance from the
|
||||
// center of the screen.
|
||||
void lx154a2422cpt23_touch_correction(uint16_t x, uint16_t y, uint16_t *x_new,
|
||||
uint16_t *y_new);
|
||||
|
||||
#endif
|
||||
|
30
core/embed/io/touch/ft6x36/panels/lx250a2410a.c
Normal file
30
core/embed/io/touch/ft6x36/panels/lx250a2410a.c
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
/*
|
||||
* This file is part of the Trezor project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <trezor_rtl.h>
|
||||
|
||||
#include "lx250a2410a.h"
|
||||
|
||||
void lx250a2410a_touch_correction(uint16_t x, uint16_t y, uint16_t *x_new,
|
||||
uint16_t *y_new) {
|
||||
// This panel may report coordinates outside the display area
|
||||
*x_new = MIN(x, DISPLAY_RESX - 1);
|
||||
*y_new = MIN(y, DISPLAY_RESY - 1);
|
||||
}
|
28
core/embed/io/touch/ft6x36/panels/lx250a2410a.h
Normal file
28
core/embed/io/touch/ft6x36/panels/lx250a2410a.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of the Trezor project, https://trezor.io/
|
||||
*
|
||||
* Copyright (c) SatoshiLabs
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <trezor_types.h>
|
||||
|
||||
// Performs touch coordinates correction needed for a specific panel.
|
||||
// Input parameters x, y represent the original touch coordinates.
|
||||
// Output parameters x_new, y_new represent the corrected touch coordinates.
|
||||
void lx250a2410a_touch_correction(uint16_t x, uint16_t y, uint16_t *x_new,
|
||||
uint16_t *y_new);
|
@ -107,6 +107,7 @@
|
||||
#define I2C_INSTANCE_3_ER_IRQn I2C4_ER_IRQn
|
||||
#define I2C_INSTANCE_3_GUARD_TIME 50
|
||||
|
||||
#define TOUCH_PANEL_LX250A2410A 1
|
||||
#define TOUCH_SENSITIVITY 0x40
|
||||
#define TOUCH_WAKEUP_WORKAROUND 1
|
||||
#define TOUCH_I2C_INSTANCE 2
|
||||
|
@ -107,6 +107,7 @@
|
||||
#define I2C_INSTANCE_3_ER_IRQn I2C4_ER_IRQn
|
||||
#define I2C_INSTANCE_3_GUARD_TIME 50
|
||||
|
||||
#define TOUCH_PANEL_LX250A2410A 1
|
||||
#define TOUCH_SENSITIVITY 0x40
|
||||
#define TOUCH_WAKEUP_WORKAROUND 1
|
||||
#define TOUCH_I2C_INSTANCE 2
|
||||
|
@ -125,6 +125,7 @@
|
||||
#define I2C_INSTANCE_4_ER_IRQn I2C5_ER_IRQn
|
||||
#define I2C_INSTANCE_4_GUARD_TIME 0
|
||||
|
||||
#define TOUCH_PANEL_LX250A2410A 1
|
||||
#define TOUCH_SENSITIVITY 0x40
|
||||
#define TOUCH_WAKEUP_WORKAROUND 1
|
||||
#define TOUCH_I2C_INSTANCE 4
|
||||
|
@ -60,6 +60,7 @@ def configure(
|
||||
|
||||
if "input" in features_wanted:
|
||||
sources += ["embed/io/touch/ft6x36/ft6x36.c"]
|
||||
sources += ["embed/io/touch/ft6x36/panels/lx250a2410a.c"]
|
||||
sources += ["embed/io/touch/touch_fsm.c"]
|
||||
paths += ["embed/io/touch/inc"]
|
||||
features_available.append("touch")
|
||||
|
@ -60,6 +60,7 @@ def configure(
|
||||
|
||||
if "input" in features_wanted:
|
||||
sources += ["embed/io/touch/ft6x36/ft6x36.c"]
|
||||
sources += ["embed/io/touch/ft6x36/panels/lx250a2410a.c"]
|
||||
sources += ["embed/io/touch/touch_fsm.c"]
|
||||
paths += ["embed/io/touch/inc"]
|
||||
features_available.append("touch")
|
||||
|
@ -60,6 +60,7 @@ def configure(
|
||||
|
||||
if "input" in features_wanted:
|
||||
sources += ["embed/io/touch/ft6x36/ft6x36.c"]
|
||||
sources += ["embed/io/touch/ft6x36/panels/lx250a2410a.c"]
|
||||
sources += ["embed/io/touch/touch_fsm.c"]
|
||||
paths += ["embed/io/touch/inc"]
|
||||
features_available.append("touch")
|
||||
|
Loading…
Reference in New Issue
Block a user