2017-08-14 09:05:19 +00:00
|
|
|
/*
|
2018-02-26 13:06:10 +00:00
|
|
|
* This file is part of the TREZOR project, https://trezor.io/
|
2017-08-14 09:05:19 +00:00
|
|
|
*
|
2018-02-26 13:06:10 +00:00
|
|
|
* 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/>.
|
2017-08-14 09:05:19 +00:00
|
|
|
*/
|
|
|
|
|
2017-11-11 16:16:17 +00:00
|
|
|
#ifndef TREZORHAL_TOUCH_H
|
|
|
|
#define TREZORHAL_TOUCH_H
|
2017-03-07 14:52:19 +00:00
|
|
|
|
2017-10-20 13:25:24 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2019-03-29 15:26:02 +00:00
|
|
|
#define TOUCH_START (1U << 24)
|
|
|
|
#define TOUCH_MOVE (1U << 25)
|
|
|
|
#define TOUCH_END (1U << 26)
|
2017-04-07 00:34:53 +00:00
|
|
|
|
2017-10-20 15:18:55 +00:00
|
|
|
void touch_init(void);
|
2018-07-18 22:01:54 +00:00
|
|
|
void touch_power_on(void);
|
|
|
|
void touch_power_off(void);
|
2018-12-16 22:01:24 +00:00
|
|
|
void touch_sensitivity(uint8_t value);
|
2017-03-07 14:52:19 +00:00
|
|
|
uint32_t touch_read(void);
|
2017-10-24 15:59:25 +00:00
|
|
|
uint32_t touch_click(void);
|
2018-07-26 22:40:30 +00:00
|
|
|
uint32_t touch_is_detected(void);
|
2019-03-29 15:26:02 +00:00
|
|
|
static inline uint16_t touch_unpack_x(uint32_t evt) {
|
|
|
|
return (evt >> 12) & 0xFFF;
|
|
|
|
}
|
|
|
|
static inline uint16_t touch_unpack_y(uint32_t evt) {
|
|
|
|
return (evt >> 0) & 0xFFF;
|
|
|
|
}
|
|
|
|
static inline uint32_t touch_pack_xy(uint16_t x, uint16_t y) {
|
|
|
|
return ((x & 0xFFF) << 12) | (y & 0xFFF);
|
|
|
|
}
|
2017-03-07 14:52:19 +00:00
|
|
|
|
|
|
|
#endif
|