2017-08-14 02:05:19 -07:00
|
|
|
/*
|
|
|
|
* Copyright (c) Pavol Rusnak, SatoshiLabs
|
|
|
|
*
|
|
|
|
* Licensed under TREZOR License
|
|
|
|
* see LICENSE file for details
|
|
|
|
*/
|
|
|
|
|
2017-11-11 08:16:17 -08:00
|
|
|
#ifndef TREZORHAL_TOUCH_H
|
|
|
|
#define TREZORHAL_TOUCH_H
|
2017-03-07 06:52:19 -08:00
|
|
|
|
2017-10-20 06:25:24 -07:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2017-10-26 07:23:04 -07:00
|
|
|
#define TOUCH_START (1U << 24)
|
|
|
|
#define TOUCH_MOVE (2U << 24)
|
|
|
|
#define TOUCH_END (4U << 24)
|
2017-04-06 17:34:53 -07:00
|
|
|
|
2017-11-11 08:16:17 -08:00
|
|
|
#define TOUCH_ADDRESS (0x38U << 1) // the HAL requires the 7-bit address to be shifted by one bit
|
|
|
|
#define TOUCH_PACKET_SIZE 7U
|
|
|
|
#define EVENT_PRESS_DOWN 0x00U
|
|
|
|
#define EVENT_CONTACT 0x80U
|
|
|
|
#define EVENT_LIFT_UP 0x40U
|
|
|
|
#define EVENT_NO_EVENT 0xC0U
|
|
|
|
#define GESTURE_NO_GESTURE 0x00U
|
|
|
|
#define X_POS_MSB (touch_data[3] & 0xFU)
|
|
|
|
#define X_POS_LSB (touch_data[4])
|
|
|
|
#define Y_POS_MSB (touch_data[5] & 0xFU)
|
|
|
|
#define Y_POS_LSB (touch_data[6])
|
|
|
|
#define X_Y_POS ((X_POS_MSB << 20) | (X_POS_LSB << 12) | (Y_POS_MSB << 8) | (Y_POS_LSB))
|
|
|
|
|
2017-10-20 08:18:55 -07:00
|
|
|
void touch_init(void);
|
2017-03-07 06:52:19 -08:00
|
|
|
uint32_t touch_read(void);
|
2017-10-24 08:59:25 -07:00
|
|
|
uint32_t touch_click(void);
|
2017-03-07 06:52:19 -08:00
|
|
|
|
|
|
|
#endif
|