2021-03-04 08:02:21 +01:00
|
|
|
/****************************************************************************
|
2011-07-29 22:12:14 +02:00
|
|
|
* drivers/input/tsc2007.h
|
|
|
|
*
|
2021-03-04 07:10:42 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2011-07-29 22:12:14 +02:00
|
|
|
*
|
2021-03-04 07:10:42 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-07-29 22:12:14 +02:00
|
|
|
*
|
2021-03-04 07:10:42 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2011-07-29 22:12:14 +02:00
|
|
|
*
|
2021-03-04 08:02:21 +01:00
|
|
|
****************************************************************************/
|
2011-07-29 22:12:14 +02:00
|
|
|
|
2021-03-04 08:02:21 +01:00
|
|
|
/* The TSC2007 is an analog interface circuit for a human interface touch
|
|
|
|
* screen device.
|
|
|
|
* All peripheral functions are controlled through the command byte and
|
|
|
|
* onboard state machines.
|
2011-07-30 17:31:23 +02:00
|
|
|
*/
|
|
|
|
|
2021-03-04 07:10:42 +01:00
|
|
|
/* References:
|
|
|
|
* "1.2V to 3.6V, 12-Bit, Nanopower, 4-Wire Micro TOUCH SCREEN CONTROLLER
|
|
|
|
* with I2C Interface," SBAS405A March 2007, Revised, March 2009, Texas
|
|
|
|
* Instruments Incorporated
|
|
|
|
*/
|
|
|
|
|
2011-07-29 22:12:14 +02:00
|
|
|
#ifndef __DRIVERS_INPUT_TSC2007_H
|
|
|
|
#define __DRIVERS_INPUT_TSC2007_H
|
|
|
|
|
2021-03-04 08:02:21 +01:00
|
|
|
/****************************************************************************
|
2011-07-29 22:12:14 +02:00
|
|
|
* Included Files
|
2021-03-04 08:02:21 +01:00
|
|
|
****************************************************************************/
|
2011-07-29 22:12:14 +02:00
|
|
|
|
2021-03-04 08:02:21 +01:00
|
|
|
/****************************************************************************
|
2015-04-08 15:15:32 +02:00
|
|
|
* Pre-processor Definitions
|
2021-03-04 08:02:21 +01:00
|
|
|
****************************************************************************/
|
2011-07-29 22:12:14 +02:00
|
|
|
|
|
|
|
/* TSC2007 Address */
|
|
|
|
|
2011-07-30 01:37:33 +02:00
|
|
|
#define TSC2007_ADDRESS_MASK (0xf8) /* Bits 3-7: Invariant part of TSC2007 address */
|
2011-07-29 22:12:14 +02:00
|
|
|
#define TSC2007_ADDRESS (0x90) /* Bits 3-7: Always set at '10010' */
|
|
|
|
#define TSC2007_A1 (1 << 2) /* Bit 2: A1 */
|
|
|
|
#define TSC2007_A0 (1 << 1) /* Bit 1: A1 */
|
|
|
|
#define TSC2007_READ (1 << 0) /* Bit0=1: Selects read operation */
|
|
|
|
#define TSC2007_WRITE (0) /* Bit0=0: Selects write operation */
|
|
|
|
|
|
|
|
/* TSC2007 Command Byte */
|
|
|
|
|
|
|
|
#define TSC2007_CMD_FUNC_SHIFT (4) /* Bits 4-7: Converter function select bits */
|
2021-03-04 08:02:21 +01:00
|
|
|
|
2011-07-29 22:12:14 +02:00
|
|
|
#define TSC2007_CMD_FUNC_MASK (15 << TSC2007_CMD_FUNC_SHIFT)
|
|
|
|
# define TSC2007_CMD_FUNC_TEMP0 (0 << TSC2007_CMD_FUNC_SHIFT) /* Measure TEMP0 */
|
|
|
|
# define TSC2007_CMD_FUNC_AUX (2 << TSC2007_CMD_FUNC_SHIFT) /* Measure AUX */
|
|
|
|
# define TSC2007_CMD_FUNC_TEMP1 (4 << TSC2007_CMD_FUNC_SHIFT) /* Measure TEMP1 */
|
|
|
|
# define TSC2007_CMD_FUNC_XON (8 << TSC2007_CMD_FUNC_SHIFT) /* Activate X-drivers */
|
|
|
|
# define TSC2007_CMD_FUNC_YON (9 << TSC2007_CMD_FUNC_SHIFT) /* Activate Y-drivers */
|
|
|
|
# define TSC2007_CMD_FUNC_YXON (10 << TSC2007_CMD_FUNC_SHIFT) /* Activate Y+, X-drivers */
|
|
|
|
# define TSC2007_CMD_FUNC_SETUP (11 << TSC2007_CMD_FUNC_SHIFT) /* Setup command */
|
|
|
|
# define TSC2007_CMD_FUNC_XPOS (12 << TSC2007_CMD_FUNC_SHIFT) /* Measure X position */
|
|
|
|
# define TSC2007_CMD_FUNC_YPOS (13 << TSC2007_CMD_FUNC_SHIFT) /* Measure Y position */
|
|
|
|
# define TSC2007_CMD_FUNC_Z1POS (14 << TSC2007_CMD_FUNC_SHIFT) /* Measure Z1 position */
|
2020-02-23 09:50:23 +01:00
|
|
|
# define TSC2007_CMD_FUNC_Z2POS (15 << TSC2007_CMD_FUNC_SHIFT) /* Measure Z2 position */
|
2021-03-04 08:02:21 +01:00
|
|
|
|
2011-07-29 22:12:14 +02:00
|
|
|
#define TSC2007_CMD_PWRDN_SHIFT (2) /* Bits 2-3: Power-down bits */
|
|
|
|
#define TSC2007_CMD_PWRDN_MASK (3 << TSC2007_CMD_PWRDN_SHIFT)
|
|
|
|
# define TSC2007_CMD_PWRDN_IRQEN (0 << TSC2007_CMD_PWRDN_SHIFT) /* 00: Power down between cycles; PENIRQ enabled */
|
|
|
|
# define TSC2007_CMD_ADCON_IRQDIS (1 << TSC2007_CMD_PWRDN_SHIFT) /* 01: A/D converter on; PENIRQ disabled */
|
|
|
|
# define TSC2007_CMD_ADCOFF_IRQEN (2 << TSC2007_CMD_PWRDN_SHIFT) /* 10: A/D converter off; PENIRQ enabled. */
|
|
|
|
/* 11: A/D converter on; PENIRQ disabled. */
|
2021-03-04 08:02:21 +01:00
|
|
|
|
2011-07-29 22:12:14 +02:00
|
|
|
#define TSC2007_CMD_12BIT (0) /* Bit 1: 0=12-bit */
|
|
|
|
#define TSC2007_CMD_8BIT (1 << 1) /* Bit 1: 1=8-bit */
|
|
|
|
/* Bit 0: Don't care */
|
|
|
|
|
|
|
|
/* TSC2007 Setup Command */
|
|
|
|
|
|
|
|
#define TSC2007_SETUP_CMD TSC2007_CMD_FUNC_SETUP /* Bits 4-7: Setup command */
|
2021-03-04 08:02:21 +01:00
|
|
|
|
2011-07-29 22:12:14 +02:00
|
|
|
/* Bits 2-3: Must be zero */
|
|
|
|
#define TSC2007_CMD_USEMAV (0) /* Bit 1: 0: Use the onboard MAV filter (default) */
|
|
|
|
#define TSC2007_CMD_BYPASSMAV (1 << 1) /* Bit 1: 1: Bypass the onboard MAV filter */
|
|
|
|
#define TSC2007_CMD_PU_50KOHM (0) /* Bit 0: 0: RIRQ = 50kOhm (default). */
|
|
|
|
#define TSC2007_CMD_PU_90KOHM (1 << 1) /* Bit 0: 1: 1: RIRQ = 90kOhm */
|
|
|
|
|
2021-03-04 08:02:21 +01:00
|
|
|
/****************************************************************************
|
2011-07-30 01:37:33 +02:00
|
|
|
* Public Types
|
2021-03-04 08:02:21 +01:00
|
|
|
****************************************************************************/
|
2011-07-30 01:37:33 +02:00
|
|
|
|
2021-03-04 08:02:21 +01:00
|
|
|
/****************************************************************************
|
2011-07-29 22:12:14 +02:00
|
|
|
* Public Function Prototypes
|
2021-03-04 08:02:21 +01:00
|
|
|
****************************************************************************/
|
2011-07-29 22:12:14 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN extern "C"
|
2014-07-05 19:47:54 +02:00
|
|
|
extern "C"
|
|
|
|
{
|
2011-07-29 22:12:14 +02:00
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __DRIVERS_INPUT_TSC2007_H */
|