rt-thread/bsp/stm32/stm32f429-st-disco/board/ports/touch/drv_touch.h

80 lines
2.5 KiB
C
Raw Normal View History

/*
2021-03-14 15:33:55 +08:00
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-10-03 xuzhuoyi first implementation.
*/
#ifndef __DRV_TOUCH_H__
#define __DRV_TOUCH_H__
#include <stdint.h>
/* Register addresses */
#define STMPE811_CHIP_ID 0x00
#define STMPE811_ID_VER 0x02
#define STMPE811_SYS_CTRL1 0x03
#define STMPE811_SYS_CTRL2 0x04
#define STMPE811_SPI_CFG 0x08
#define STMPE811_INT_CTRL 0x09
#define STMPE811_INT_EN 0x0A
#define STMPE811_INT_STA 0x0B
#define STMPE811_GPIO_EN 0x0C
#define STMPE811_GPIO_INT_STA 0x0D
#define STMPE811_ADC_INT_EN 0x0E
#define STMPE811_ADC_INT_STA 0x0F
#define STMPE811_GPIO_SET_PIN 0x10
#define STMPE811_GPIO_CLR_PIN 0x11
#define STMPE811_GPIO_MP_STA 0x12
#define STMPE811_GPIO_DIR 0x13
#define STMPE811_GPIO_ED 0x14
#define STMPE811_GPIO_RE 0x15
#define STMPE811_GPIO_FE 0x16
#define STMPE811_GPIO_AF 0x17
#define STMPE811_ADC_CTRL1 0x20
#define STMPE811_ADC_CTRL2 0x21
#define STMPE811_ADC_CAPT 0x22
#define STMPE811_ADC_DATA_CH0 0x30
#define STMPE811_ADC_DATA_CH1 0x32
#define STMPE811_ADC_DATA_CH2 0x34
#define STMPE811_ADC_DATA_CH3 0x36
#define STMPE811_ADC_DATA_CH4 0x38
#define STMPE811_ADC_DATA_CH5 0x3A
#define STMPE811_ADC_DATA_CH6 0x3C
#define STMPE811_ADC_DATA_CH7 0x3E
#define STMPE811_TSC_CTRL 0x40
#define STMPE811_TSC_CFG 0x41
#define STMPE811_WDW_TR_X 0x42
#define STMPE811_WDW_TR_Y 0x44
#define STMPE811_WDW_BL_X 0x46
#define STMPE811_WDW_BL_Y 0x48
#define STMPE811_FIFO_TH 0x4A
#define STMPE811_FIFO_STA 0x4B
#define STMPE811_FIFO_SIZE 0x4C
#define STMPE811_TSC_DATA_X 0x4D
#define STMPE811_TSC_DATA_Y 0x4F
#define STMPE811_TSC_DATA_Z 0x51
#define STMPE811_TSC_FRACTION_Z 0x56
#define STMPE811_TSC_DATA_XYZ 0x57
#define STMPE811_TSC_DATA 0xD7
#define STMPE811_TSC_I_DRIVE 0x58
#define STMPE811_TSC_SHIELD 0x59
#define STMPE811_TEMP_CTRL 0x60
#define STMPE811_TEMP_DATA 0x61
#define STMPE811_TEMP_TH 0x62
/* Touch state */
struct touch_state {
int16_t x; ///< Position X
int16_t y; ///< Position Y
uint8_t pressed; ///< Pressed flag
uint8_t padding;
};
int32_t touch_get_state(struct touch_state *state);
#endif /* __DRV_TOUCH_H__ */