frederic blanc / TS_STMPE811

Dependents:   Touch_Screen_MCB

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TS.h Source File

TS.h

00001 
00002 
00003 #ifndef _TS_H
00004 #define _TS_H
00005 #include "mbed.h"
00006 
00007 extern int         TS_Init   (void);
00008 extern int         TS_Write  (unsigned char reg, unsigned int val);
00009 extern unsigned int TS_Read   (unsigned char reg, int num);
00010 extern int ts_XY( int *x,int *y,int *z);
00011 
00012 #define TS_CHIP_ID          0x00
00013 #define TS_ID_VER           0x02
00014 #define TS_SYS_CTRL1        0x03
00015 #define TS_SYS_CTRL2        0x04
00016 #define TS_SPI_CFG          0x08
00017 #define TS_INT_CTRL         0x09
00018 #define TS_INT_EN           0x0A
00019 #define TS_INT_STA          0x0B
00020 #define TS_GPIO_EN          0x0C
00021 #define TS_GPIO_INT_STA     0x0D
00022 #define TS_ADC_INT_EN       0x0E
00023 #define TS_ADC_INT_STA      0x0F
00024 #define TS_GPIO_SET_PIN     0x10
00025 #define TS_GPIO_CLR_PIN     0x11
00026 #define TS_GPIO_MP_STA      0x12
00027 #define TS_GPIO_DIR         0x13
00028 #define TS_GPIO_ED          0x14
00029 #define TS_GPIO_RE          0x15
00030 #define TS_GPIO_FE          0x16
00031 #define TS_GPIO_AF          0x17
00032 #define TS_ADC_CTRL1        0x20
00033 #define TS_ADC_CTRL2        0x21
00034 #define TS_ADC_CAPT         0x22
00035 #define TS_ADC_DATA_CH0     0x30
00036 #define TS_ADC_DATA_CH1     0x32
00037 #define TS_ADC_DATA_CH2     0x34
00038 #define TS_ADC_DATA_CH3     0x36
00039 #define TS_ADC_DATA_CH4     0x38
00040 #define TS_ADC_DATA_CH5     0x3A
00041 #define TS_ADC_DATA_CH6     0x3C
00042 #define TS_ADC_DATA_CH7     0x3E
00043 #define TS_TSC_CTRL         0x40
00044 #define TS_TSC_CFG          0x41
00045 #define TS_WDW_TR_X         0x42
00046 #define TS_WDW_TR_Y         0x44
00047 #define TS_WDW_BL_X         0x46
00048 #define TS_WDW_BL_Y         0x48
00049 #define TS_FIFO_TH          0x4A
00050 #define TS_FIFO_STA         0x4B
00051 #define TS_FIFO_SIZE        0x4C
00052 #define TS_TSC_DATA_X       0x4D
00053 #define TS_TSC_DATA_Y       0x4F
00054 #define TS_TSC_DATA_Z       0x51
00055 #define TS_TSC_DATA_XYZ     0x52
00056 #define TS_TSC_FRACTION_Z   0x56
00057 #define TS_TSC_DATA_AI      0x57
00058 #define TS_TSC_DATA_NAI     0xD7
00059 #define TS_TSC_I_DRIVE      0x58
00060 #define TS_TSC_SHIELD       0x59
00061 #define TS_TEMP_CTRL        0x60
00062 #define TS_TEMP_DATA        0x61
00063 #define TS_TEMP_TH          0x62
00064 
00065 #define SYS_CTRL2_ADC_OFF   0x01      //Switch off the clock supply to the ADC
00066 #define SYS_CTRL2_TSC_OFF   0x02      //Switch off the clock supplyto the touchscreen controller
00067 #define SYS_CTRL2_GPIO_OFF   0x04    //Switch off the clock supply to the GPIO
00068 #define SYS_CTRL2_TS_OFF   0x08      //Switch off the clock supply to the temperature sensor
00069 
00070 #define SYS_CTRL1_SOFT_RESET 0x02   //Reset the STMPE811 using the serial communication interface
00071 #define SYS_CTRL1_HIBERNATE 0x01    //Force the device into hibernation mode
00072 
00073 #define INT_TOUCH_DET   0x01    //Touch is detected
00074 #define INT_FIFO_TH     0x02    // FIFO is equal or above threshold value.
00075 #define INT_FIFO_OFLOW  0x04    // FIFO is overflowed
00076 #define INT_FIFO_FULL   0x08    // FIFO is full
00077 #define INT_FIFO_EMPTY  0x10    // FIFO is empty
00078 #define INT_TEMP_SENS   0x20    //Temperature threshold triggering
00079 #define INT_ADC         0x40    // Any enabled ADC interrupts
00080 #define INT_GPIO            0x80    //Any enabled GPIO interrupts
00081 
00082 
00083 
00084 #define TS_10us     0x00 
00085 #define TS_100us    0x01 
00086 #define TS_50us     0x02 
00087 #define TS_1ms      0x03 
00088 #define TS_5ms      0x04 
00089 #define TS_10ms     0x05
00090 #define TS_50ms     0x06  
00091 #define TS_100ms    0x07 
00092 #endif /* _TS_H */
00093