Fix typo.
[Rockbox.git] / firmware / export / tsc2100.h
blobff30c64559c2549035fc6bf470ed905182b2dc23
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: $
10 * Copyright (C) 2007 by Jonathan Gordon
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #ifndef __TSC2100_H_
20 #define __TSC2100_H_
22 /* Read X, Y, Z1, Z2 touchscreen coordinates. */
23 void tsc2100_read_values(short *x, short* y, short *z1, short *z2);
25 /* read a register */
26 short tsc2100_readreg(int page, int address);
27 /* write a value to the register */
28 void tsc2100_writereg(int page, int address, short value);
30 /* ts adc page defines (page 1, 00h ) (refer to page 40 of the datasheet) */
31 #define TSADC_PAGE 1
32 #define TSADC_ADDRESS 0x00
33 #define TSADC_PSTCM (1<<15)
34 #define TSADC_ADST (1<<14)
35 #define TSADC_ADSCM_MASK (0x3C00)
36 #define TSADC_ADSCM_SHIFT 10
37 #define TSADC_RESOL_MASK (0x0300)
38 #define TSADC_RESOL_SHIFT 8
39 #define TSADC_ADAVG_MASK (0x00C0)
40 #define TSADC_ADAVG_SHIFT 6
41 #define TSADC_ADCR_MASK (0x0030)
42 #define TSADC_ADCR_SHIFT 4
43 #define TSADC_PVSTC_MASK (0x000E)
44 #define TSADC_PVSTC_SHIFT 1
45 #define TSADC_AVGFS (1<<0)
47 /* ts status page defines (page 1, 01h ) (refer to page 41 of the datasheet) */
48 #define TSSTAT_PAGE 1
49 #define TSSTAT_ADDRESS 0x01
50 #define TSSTAT_PINTDAV_MASK 0xC000 /* controls the !PINTDAV pin */
51 #define TSSTAT_PINTDAV_SHIFT 14
52 /* these are all read only */
53 #define TSSTAT_PWRDN (1<<13)
54 #define TSSTAT_HCTLM (1<<12)
55 #define TSSTAT_DAVAIL (1<<11)
56 #define TSSTAT_XSTAT (1<<10)
57 #define TSSTAT_YSTAT (1<<9)
58 #define TSSTAT_Z1STAT (1<<8)
59 #define TSSTAT_Z2STAT (1<<7)
60 #define TSSTAT_B1STAT (1<<6)
61 #define TSSTAT_B2STAT (1<<5)
62 #define TSSTAT_AXSTAT (1<<4)
63 // Bit 3 is reserved (1<<3)
64 #define TSSTAT_T1STAT (1<<2)
65 #define TSSTAT_T2STAT (1<<1)
66 // Bit 0 is reserved (1<<0)
68 /* ts Reset Control */
69 #define TSRESET_PAGE 1
70 #define TSRESET_ADDRESS 0x04
71 #define TSRESET_VALUE 0xBB00
75 /* ts audio control 2 */
76 #define TSAC2_PAGE 2
77 #define TSAC2_ADDRESS 0x04
78 #define TSAC2_KCLEN (1<<15)
79 #define TSAC2_KCLAC_MASK 0x7000
80 #define TSAC2_KCLSC_SHIFT 12
81 #define TSAC2_APGASS (1<<11)
82 #define TSAC2_KCLFRQ_MASK 0x0700
83 #define TSAC2_KCLFRQ_SHIFT 8
84 #define TSAC2_KCLLN_MASK 0x00F0
85 #define TSAC2_KCLLN_SHIFT 4
86 #define TSAC2_DLGAF (1<<3) /* r only */
87 #define TSAC2_DRGAF (1<<2) /* r only */
88 #define TSAC2_DASTC (1<<1)
89 #define TSAC2_ADGAF (1<<0) /* r only */
104 #endif