Unit STMPE

From Ultibo.org
Jump to: navigation, search

Return to Unit Reference


Description


ST Microelectronics STMPE Driver unit

The ST Microelectronics STMPE devices are a range of multi function chips that include GPIO, ADC, 4 wire touchscreen controller and PWM outputs in varying combinations. Many of the functions overlap so a pin can be used for example as a GPIO or a PWM but not both at once. The Touchscreen controller also consumes many of the GPIO pins in the models that support it. This driver supports the GPIO and Touchscreen functions of the following chips:

STMPE610 - 6 GPIO/4-wire Touch/I2C/SPI

STMPE801 - 8 GPIO/I2C

STMPE811 - 8 GPIO/4-wire Touch/I2C/SPI

STMPE1601 - 16 GPIO/4 PWM/I2C

STMPE1801 - 18 GPIO/I2C

STMPE2401 - 24 GPIO/3 PWM/I2C

STMPE2403 - 24 GPIO/3 PWM/I2C

Note: A number of variations also support Keypad, Temperature and other features which are not currently handled by this driver.

Constants



STMPE specific constants STMPE*_*
STMPE610_GPIO_DESCRIPTION = 'STMicroelectronics STMPE610 I/O Expander'; Description of STMPE610 GPIO device
STMPE801_GPIO_DESCRIPTION = 'STMicroelectronics STMPE801 I/O Expander'; Description of STMPE801 GPIO device
STMPE811_GPIO_DESCRIPTION = 'STMicroelectronics STMPE811 I/O Expander'; Description of STMPE811 GPIO device
STMPE1601_GPIO_DESCRIPTION = 'STMicroelectronics STMPE1601 I/O Expander'; Description of STMPE1601 GPIO device
STMPE1801_GPIO_DESCRIPTION = 'STMicroelectronics STMPE1801 I/O Expander'; Description of STMPE1801 GPIO device
STMPE2401_GPIO_DESCRIPTION = 'STMicroelectronics STMPE2401 I/O Expander'; Description of STMPE2401 GPIO device
STMPE2403_GPIO_DESCRIPTION = 'STMicroelectronics STMPE2403 I/O Expander'; Description of STMPE2403 GPIO device
 
STMPE610_TOUCH_DESCRIPTION = 'STMicroelectronics STMPE610 Touch Controller'; Description of STMPE610 Touch device
STMPE811_TOUCH_DESCRIPTION = 'STMicroelectronics STMPE811 Touch Controller'; Description of STMPE811 Touch device
 
STMPE610_GPIO_MIN_PIN = GPIO_PIN_2;  
STMPE610_GPIO_MAX_PIN = GPIO_PIN_7;  
STMPE610_GPIO_PIN_COUNT = 6;  
 
STMPE801_GPIO_MIN_PIN = GPIO_PIN_0;  
STMPE801_GPIO_MAX_PIN = GPIO_PIN_7;  
STMPE801_GPIO_PIN_COUNT = 8;  
 
STMPE811_GPIO_MIN_PIN = GPIO_PIN_0;  
STMPE811_GPIO_MAX_PIN = GPIO_PIN_7;  
STMPE811_GPIO_PIN_COUNT = 8;  
 
STMPE1601_GPIO_MIN_PIN = GPIO_PIN_0;  
STMPE1601_GPIO_MAX_PIN = GPIO_PIN_15;  
STMPE1601_GPIO_PIN_COUNT = 16;  
 
STMPE1801_GPIO_MIN_PIN = GPIO_PIN_0;  
STMPE1801_GPIO_MAX_PIN = GPIO_PIN_17;  
STMPE1801_GPIO_PIN_COUNT = 18;  
 
STMPE240X_GPIO_MIN_PIN = GPIO_PIN_0;  
STMPE240X_GPIO_MAX_PIN = GPIO_PIN_23;  
STMPE240X_GPIO_PIN_COUNT = 24;  
 
STMPE_GPIO_MAX_LEVEL = GPIO_LEVEL_HIGH;  
 
STMPE_GPIO_MAX_PULL = GPIO_PULL_DOWN;  
 
STMPE610_GPIO_MIN_FUNCTION = GPIO_FUNCTION_IN;  
STMPE610_GPIO_MAX_FUNCTION = GPIO_FUNCTION_ALT0;  
STMPE610_GPIO_FUNCTION_COUNT = 3;  
 
STMPE801_GPIO_MIN_FUNCTION = GPIO_FUNCTION_IN;  
STMPE801_GPIO_MAX_FUNCTION = GPIO_FUNCTION_OUT;  
STMPE801_GPIO_FUNCTION_COUNT = 2;  
 
STMPE811_GPIO_MIN_FUNCTION = GPIO_FUNCTION_IN;  
STMPE811_GPIO_MAX_FUNCTION = GPIO_FUNCTION_ALT0;  
STMPE811_GPIO_FUNCTION_COUNT = 3;  
 
STMPE1601_GPIO_MIN_FUNCTION = GPIO_FUNCTION_IN;  
STMPE1601_GPIO_MAX_FUNCTION = GPIO_FUNCTION_ALT1; Alternate function 0 = Keypad/Alternate function 1 = PWM
STMPE1601_GPIO_FUNCTION_COUNT = 4;  
 
STMPE1801_GPIO_MIN_FUNCTION = GPIO_FUNCTION_IN;  
STMPE1801_GPIO_MAX_FUNCTION = GPIO_FUNCTION_ALT0;  
STMPE1801_GPIO_FUNCTION_COUNT = 3;  
 
STMPE240X_GPIO_MIN_FUNCTION = GPIO_FUNCTION_IN;  
STMPE240X_GPIO_MAX_FUNCTION = GPIO_FUNCTION_ALT2;  
STMPE240X_GPIO_FUNCTION_COUNT = 5;  
 
STMPE610_MAX_POINTS = 1;  
STMPE610_MAX_X = $FFF;  
STMPE610_MAX_Y = $FFF;  
STMPE610_MAX_Z = $FF;  
 
STMPE811_MAX_POINTS = 1;  
STMPE811_MAX_X = $FFF;  
STMPE811_MAX_Y = $FFF;  
STMPE811_MAX_Z = $FF;  


STMPE chip STMPE_CHIP_*
STMPE_CHIP_STMPE610 = 1;  
STMPE_CHIP_STMPE801 = 2;  
STMPE_CHIP_STMPE811 = 3;  
STMPE_CHIP_STMPE1601 = 4;  
STMPE_CHIP_STMPE1801 = 5;  
STMPE_CHIP_STMPE2401 = 6;  
STMPE_CHIP_STMPE2403 = 7;  


STMPE direction STMPE_DIR_*
STMPE_DIR_ASCENDING = 0; Register addresses in ascending order (Bits go from LSB to MSB)
STMPE_DIR_DESCENDING = 1; Register addresses in descending order (Bits go from MSB to LSB)


STMPE I2C STMPE_I2C_*
STMPE_I2C_RATE = 400000; Default I2C clock rate (Device supports 100KHz and 400KHz)


STMPE SPI STMPE_SPI_*
STMPE_SPI_RATE = 500000; Default SPI clock rate (Device supports up to 1MHz)
 
STMPE_SPI_READ_CMD = (1 shl 7); First bit of address must be set for a read


STMPE register STMPE*_REG_*
STMPE610/STMPE811
STMPE811_REG_CHIP_ID = $00; Device identification
STMPE811_REG_ID_VER = $02; Revision number (0x01 for engineering sample/0x03 for final silicon)
STMPE811_REG_SYS_CTRL1 = $03; Reset control
STMPE811_REG_SYS_CTRL2 = $04; Clock control
STMPE811_REG_SPI_CFG = $08; SPI interface configuration
STMPE811_REG_INT_CTRL = $09; Interrupt control register
STMPE811_REG_INT_EN = $0A; Interrupt enable register
STMPE811_REG_INT_STA = $0B; Interrupt status register
 
STMPE811_REG_GPIO_INT_EN = $0C; GPIO interrupt enable register
STMPE811_REG_GPIO_INT_STA = $0D; GPIO interrupt status register
STMPE811_REG_ADC_INT_EN = $0E; ADC interrupt enable register
STMPE811_REG_ADC_INT_STA = $0F; ADC interrupt status register
STMPE811_REG_GPIO_SET_PIN = $10; GPIO set pin register
STMPE811_REG_GPIO_CLR_PIN = $11; GPIO clear pin register
STMPE811_REG_GPIO_MP_STA = $12; GPIO monitor pin state register
STMPE811_REG_GPIO_SET_DIR = $13; GPIO direction register
STMPE811_REG_GPIO_ED = $14; GPIO edge detect register
STMPE811_REG_GPIO_RE = $15; GPIO rising edge register
STMPE811_REG_GPIO_FE = $16; GPIO falling edge register
STMPE811_REG_GPIO_AF = $17; Alternate function register
 
STMPE811_REG_ADC_CTRL1 = $20; ADC control
STMPE811_REG_ADC_CTRL2 = $21; ADC control
STMPE811_REG_ADC_CAPT = $22; To initiate ADC data acquisition
STMPE811_REG_ADC_DATA_CH0 = $30; ADC channel 0
STMPE811_REG_ADC_DATA_CH1 = $32; ADC channel 1
STMPE811_REG_ADC_DATA_CH2 = $34; ADC channel 2
STMPE811_REG_ADC_DATA_CH3 = $36; ADC channel 3
STMPE811_REG_ADC_DATA_CH4 = $38; ADC channel 4
STMPE811_REG_ADC_DATA_CH5 = $3A; ADC channel 5
STMPE811_REG_ADC_DATA_CH6 = $3C; ADC channel 6
STMPE811_REG_ADC_DATA_CH7 = $3E; ADC channel 7
 
STMPE811_REG_TSC_CTRL = $40; 4-wire touchscreen controller setup
STMPE811_REG_TSC_CFG = $41; Touchscreen controller configuration
STMPE811_REG_WDW_TR_X = $42; Window setup for top right X
STMPE811_REG_WDW_TR_Y = $44; Window setup for top right Y
STMPE811_REG_WDW_BL_X = $46; Window setup for bottom left X
STMPE811_REG_WDW_BL_Y = $48; Window setup for bottom left Y
STMPE811_REG_FIFO_TH = $4A; FIFO level to generate interrupt
STMPE811_REG_FIFO_STA = $4B; Current status of FIFO
STMPE811_REG_FIFO_SIZE = $4C; Current filled level of FIFO
STMPE811_REG_TSC_DATA_X = $4D; Data port for touchscreen controller data access
STMPE811_REG_TSC_DATA_Y = $4F; Data port for touchscreen controller data access
STMPE811_REG_TSC_DATA_Z = $51; Data port for touchscreen controller data access
STMPE811_REG_TSC_DATA_XYZ = $52; Data port for touchscreen controller data access
STMPE811_REG_TSC_FRACTION_Z = $56; Touchscreen controller FRACTION_Z
STMPE811_REG_TSC_DATA = $57; Data port for touchscreen controller data access
STMPE811_REG_TSC_I_DRIVE = $58; Touchscreen controller drive I
STMPE811_REG_TSC_SHIELD = $59; Touchscreen controller shield
 
STMPE811
STMPE811_REG_TEMP_CTRL= $60; Temperature sensor setup
STMPE811_REG_TEMP_DATA = $61; Temperature data access port
STMPE811_REG_TEMP_TH = $62; Threshold for temperature controlled interrupt
 
STMPE811_REG_MAX = $62;  
STMPE811_REG_SIZE = 1;  
 
STMPE801
STMPE801_REG_CHIP_ID = $00; Device identification
STMPE801_REG_ID_VER = $02; Revision number (0x01 for engineering sample/0x02 for final silicon)
STMPE801_REG_SYS_CTRL = $04; Reset and interrupt control
STMPE801_REG_GPIO_INT_EN = $08; GPIO interrupt enable register
STMPE801_REG_GPIO_INT_STA = $09; GPIO interrupt status register
STMPE801_REG_GPIO_MP_STA = $10; GPIO monitor pin state register
STMPE801_REG_GPIO_SET_PIN = $11; GPIO set pin state register
STMPE801_REG_GPIO_SET_DIR = $12; GPIO set pin direction register
 
STMPE801_REG_MAX = $12;  
STMPE801_REG_SIZE = 1;  
 
STMPE1601
STMPE1601_REG_CHIP_ID = $80; Device identification
STMPE1601_REG_ID_VER = $81; Revision number
 
STMPE1601_REG_SYS_CTRL = $02; System control register
STMPE1601_REG_SYS_CTRL2 = $03; System control register 2
STMPE1601_REG_INT_CTRL_MSB = $10; Interrupt control register
STMPE1601_REG_INT_CTRL_LSB = $11;  
STMPE1601_REG_INT_EN_MSB = $12; Interrupt enable mask register
STMPE1601_REG_INT_EN_LSB = $13;  
STMPE1601_REG_INT_STA_MSB = $14; Interrupt status register
STMPE1601_REG_INT_STA_LSB = $15;  
 
STMPE1601_REG_GPIO_INT_EN_MSB = $16; Interrupt enable GPIO mask register
STMPE1601_REG_GPIO_INT_EN_LSB = $17;  
STMPE1601_REG_GPIO_INT_STA_MSB = $18; Interrupt status GPIO register
STMPE1601_REG_GPIO_INT_STA_LSB = $19;  
 
STMPE1601_REG_GPIO_SET_PIN_MSB = $82; GPIO set pin state register
STMPE1601_REG_GPIO_SET_PIN_LSB = $83;  
STMPE1601_REG_GPIO_CLR_PIN_MSB = $84; GPIO clear pin state register
STMPE1601_REG_GPIO_CLR_PIN_LSB = $85;  
STMPE1601_REG_GPIO_MP_STA_MSB = $86; GPIO monitor pin state register
STMPE1601_REG_GPIO_MP_STA_LSB = $87;  
STMPE1601_REG_GPIO_SET_DIR_MSB = $88; GPIO set pin direction register
STMPE1601_REG_GPIO_SET_DIR_LSB = $89;  
 
STMPE1601_REG_GPIO_ED_MSB = $8A; GPIO edge detect status register
STMPE1601_REG_GPIO_ED_LSB = $8B;  
STMPE1601_REG_GPIO_RE_MSB = $8C; GPIO rising edge register
STMPE1601_REG_GPIO_RE_LSB = $8D;  
STMPE1601_REG_GPIO_FE_MSB = $8E; GPIO falling edge register
STMPE1601_REG_GPIO_FE_LSB = $8F;  
STMPE1601_REG_GPIO_PU_MSB = $90; GPIO pull up register
STMPE1601_REG_GPIO_PU_LSB = $91;  
STMPE1601_REG_GPIO_AF_U_MSB = $92; GPIO alternate function register (upper word)
STMPE1601_REG_GPIO_AF_U_LSB = $93;  
STMPE1601_REG_GPIO_AF_L_MSB = $94; GPIO alternate function register (lower word)
STMPE1601_REG_GPIO_AF_L_LSB = $95;  
 
STMPE1601_REG_GPIO_LT_EN = $96; GPIO level translator enable
STMPE1601_REG_GPIO_LT_DIR = $97; GPIO level translator direction
 
STMPE1601_REG_MAX = $BF;  
STMPE1601_REG_SIZE = 2;  
 
STMPE1801
STMPE1801_REG_CHIP_ID = $00; Device identification
STMPE1801_REG_ID_VER = $01; Revision number
 
STMPE1801_REG_SYS_CTRL = $02; System control
STMPE1801_REG_INT_CTRL_LOW = $04; Interrupt control
STMPE1801_REG_INT_CTRL_HIGH = $05;  
STMPE1801_REG_INT_EN_LOW = $06; Interrupt enable mask
STMPE1801_REG_INT_EN_HIGH = $07;  
STMPE1801_REG_INT_STA_LOW = $08; Interrupt status
STMPE1801_REG_INT_STA_HIGH = $09;  
 
STMPE1801_REG_GPIO_INT_EN_LOW = $0A; Interrupt enable GPIO mask
STMPE1801_REG_GPIO_INT_EN_MID = $0B;  
STMPE1801_REG_GPIO_INT_EN_HIGH = $0C;  
STMPE1801_REG_GPIO_INT_STA_LOW = $0D; Interrupt status GPIO
STMPE1801_REG_GPIO_INT_STA_MID = $0E;  
STMPE1801_REG_GPIO_INT_STA_HIGH = $0F;  
STMPE1801_REG_GPIO_SET_PIN_LOW = $10; GPIO set pin state
STMPE1801_REG_GPIO_SET_PIN_MID = $11;  
STMPE1801_REG_GPIO_SET_PIN_HIGH = $12  
STMPE1801_REG_GPIO_CLR_PIN_LOW = $13; GPIO clear pin state
STMPE1801_REG_GPIO_CLR_PIN_MID = $14;  
STMPE1801_REG_GPIO_CLR_PIN_HIGH = $15;  
STMPE1801_REG_GPIO_MP_STA_LOW = $16; GPIO monitor pin state
STMPE1801_REG_GPIO_MP_STA_MID = $17;  
STMPE1801_REG_GPIO_MP_STA_HIGH = $18;  
STMPE1801_REG_GPIO_SET_DIR_LOW = $19; GPIO set pin direction register
STMPE1801_REG_GPIO_SET_DIR_MID = $1A;  
STMPE1801_REG_GPIO_SET_DIR_HIGH = $1B;  
 
STMPE1801_REG_GPIO_RE_LOW = $1C; GPIO rising edge
STMPE1801_REG_GPIO_RE_MID = $1D;  
STMPE1801_REG_GPIO_RE_HIGH = $1E;  
STMPE1801_REG_GPIO_FE_LOW = $1F; GPIO falling edge
STMPE1801_REG_GPIO_FE_MID = $20;  
STMPE1801_REG_GPIO_FE_HIGH = $21;  
STMPE1801_REG_GPIO_PULL_UP_LOW = $22; GPIO pull up
STMPE1801_REG_GPIO_PULL_UP_MID = $23;  
STMPE1801_REG_GPIO_PULL_UP_HIGH = $24;  
 
STMPE1801_REG_KPC_ROW = $30; Keypad row scanning
STMPE1801_REG_KPC_COL_LOW = $31; Keypad column scanning
STMPE1801_REG_KPC_COL_HIGH = $32;  
STMPE1801_REG_KPC_CTRL_LOW = $33; Key config: Scan count and dedicated key
STMPE1801_REG_KPC_CTRL_MID = $34;  
STMPE1801_REG_KPC_CTRL_HIGH = $35;  
STMPE1801_REG_KPC_CMD = $36; Keypad command
STMPE1801_REG_KPC_COMB_KEY_0 = $37; Keypad combination key mask
STMPE1801_REG_KPC_COMB_KEY_1 = $38;  
STMPE1801_REG_KPC_COMB_KEY_2 = $39;  
STMPE1801_REG_KPC_DATA_BYTE0 = $3A; Keypad data
STMPE1801_REG_KPC_DATA_BYTE1 = $3B;  
STMPE1801_REG_KPC_DATA_BYTE2 = $3C;  
STMPE1801_REG_KPC_DATA_BYTE3 = $3D;  
STMPE1801_REG_KPC_DATA_BYTE4 = $3E;  
 
STMPE1801_REG_MAX = $3E;  
STMPE1801_REG_SIZE = 3;  
 
STMPE2401/STMPE2403
STMPE240X_REG_CHIP_ID = $80; Device identification
STMPE240X_REG_ID_VER = $81; Revision number
 
STMPE240X_REG_SYS_CTRL = $02; System control register
STMPE240X_REG_INT_CTRL_MSB = $10; Interrupt Control Register
STMPE240X_REG_INT_CTRL_LSB = $11;  
STMPE240X_REG_INT_EN_MSB = $12; Interrupt Enable Mask Register
STMPE240X_REG_INT_EN_LSB = $13;  
STMPE240X_REG_INT_STA_MSB = $14; Interrupt Status Register
STMPE240X_REG_INT_STA_LSB = $15;  
 
STMPE240X_REG_GPIO_INT_EN_MSB = $16; Interrupt Enable GPIO Mask Register
STMPE240X_REG_GPIO_INT_EN_MID = $17;  
STMPE240X_REG_GPIO_INT_EN_LSB = $18;  
STMPE240X_REG_GPIO_INT_STA_MSB = $19; Interrupt Status GPIO Register
STMPE240X_REG_GPIO_INT_STA_MID = $1A;  
STMPE240X_REG_GPIO_INT_STA_LSB = $1B;  
STMPE240X_REG_GPIO_MP_STA_MSB = $A2; GPIO Monitor Pin State Register
STMPE240X_REG_GPIO_MP_STA_MID = $A3;  
STMPE240X_REG_GPIO_MP_STA_LSB = $A4;  
STMPE240X_REG_GPIO_SET_PIN_MSB = $83; GPIO Set Pin State Register
STMPE240X_REG_GPIO_SET_PIN_MID = $84;  
STMPE240X_REG_GPIO_SET_PIN_LSB = $85;  
STMPE240X_REG_GPIO_CLR_PIN_MSB = $86; GPIO Clear Pin State Register
STMPE240X_REG_GPIO_CLR_PIN_MID = $87;  
STMPE240X_REG_GPIO_CLR_PIN_LSB = $88;  
STMPE240X_REG_GPIO_SET_DIR_MSB = $89; GPIO Set Pin Direction Register
STMPE240X_REG_GPIO_SET_DIR_MID = $8A;  
STMPE240X_REG_GPIO_SET_DIR_LSB = $8B;  
STMPE240X_REG_GPIO_ED_MSB = $8C; GPIO Edge Detect Status Register
STMPE240X_REG_GPIO_ED_MID = $8D;  
STMPE240X_REG_GPIO_ED_LSB = $8E;  
STMPE240X_REG_GPIO_RE_MSB = $8F; GPIO Rising Edge Register
STMPE240X_REG_GPIO_RE_MID = $90;  
STMPE240X_REG_GPIO_RE_LSB = $91;  
STMPE240X_REG_GPIO_FE_MSB = $92; GPIO Falling Edge Register
STMPE240X_REG_GPIO_FE_MID = $93;  
STMPE240X_REG_GPIO_FE_LSB = $94;  
STMPE240X_REG_GPIO_PULL_UP_MSB = $95; GPIO Pull Up Register
STMPE240X_REG_GPIO_PULL_UP_MID = $96;  
STMPE240X_REG_GPIO_PULL_UP_LSB = $97;  
STMPE240X_REG_GPIO_PULL_DN_MSB = $98; GPIO Pull Down Register
STMPE240X_REG_GPIO_PULL_DN_MID = $99;  
STMPE240X_REG_GPIO_PULL_DN_LSB = $9A;  
STMPE240X_REG_GPIO_AF_U_MSB = $9B; GPIO Alternate Function Register (Upper Bit)
STMPE240X_REG_GPIO_AF_U_MID = $9C;  
STMPE240X_REG_GPIO_AF_U_LSB = $9D;  
STMPE240X_REG_GPIO_AF_L_MSB = $9E; GPIO Alternate Function Register(Lower Bit)
STMPE240X_REG_GPIO_AF_L_MID = $9F;  
STMPE240X_REG_GPIO_AF_L_LSB = $A0;  
 
STMPE240X_REG_PWMCS = $30; PWM Control and Status register
STMPE240X_REG_PWMIC0 = $38; PWM instructions are initialized through this data port
STMPE240X_REG_PWMIC1 = $39;  
STMPE240X_REG_PWMIC2 = $3A;  
 
STMPE240X_REG_KPC_COL = $60; Keypad column scanning register
STMPE240X_REG_KPC_ROW_MSB = $61; Keypad row scanning register
STMPE240X_REG_KPC_ROW_LSB = $62;  
STMPE240X_REG_KPC_CTRL_MSB = $63; Keypad control register
STMPE240X_REG_KPC_CTRL_LSB = $64;  
STMPE240X_REG_KPC_DATA_BYTE0 = $68; Keypad data register
STMPE240X_REG_KPC_DATA_BYTE1 = $69;  
STMPE240X_REG_KPC_DATA_BYTE2 = $6A;  
 
STMPE240X_REG_MAX = $BF;  
STMPE240X_REG_SIZE = 3;  
 
STMPE_REG_UNKNOWN = $FF;  


STMPE Id STMPE*_CHIP_ID
STMPE610/STMPE811
STMPE811_CHIP_ID = $0811;  
 
STMPE801
STMPE801_CHIP_ID = $0801;  
 
STMPE1601
STMPE1601_CHIP_ID = $02;  
 
STMPE1801
STMPE1801_CHIP_ID = $C1;  
 
STMPE2401/STMPE2403
STMPE240X_CHIP_ID = $01;  


STMPE system control STMPE*_SYS_CTRL*_*
STMPE610/STMPE811
STMPE811_SYS_CTRL2_TS_OFF = (1 shl 3); 1: Switches off the clock supply to the temperature sensor
STMPE811_SYS_CTRL2_GPIO_OFF (1 shl 2); 1: Switches off the clock supply to the GPIO
STMPE811_SYS_CTRL2_TSC_OFF = (1 shl 1); 1: Switches off the clock supply to the touchscreen controller
STMPE811_SYS_CTRL2_ADC_OFF = (1 shl 0); 1: Switches off the clock supply to the ADC
 
STMPE801
STMPE801_SYS_CTRL_RESET = (1 shl 7); Writing 1 to this bit causes a soft reset.
STMPE801_SYS_CTRL_INT_EN = (1 shl 2); INT Enable 1 to enable, 0 to disable INT output.
STMPE801_SYS_CTRL_INT_HI = (1 shl 0); INT Polarity 1 for active HI, 0 for active LOW.
 
STMPE1601
STMPE1601_SYS_CTRL_RESET = (1 shl 7); Writing a 1 to this bit will do a soft reset of the device. Once the reset is done, this bit will be cleared to 0 by the HW.
STMPE1601_SYS_CTRL_ENABLE_GPIO = (1 shl 3); Writing a 0 to this bit will gate off the clock to the GPIO module, thus stopping its operation.
STMPE1601_SYS_CTRL_ENABLE_KPC = (1 shl 1); Writing a 0 to this bit will gate off the clock to the keypad controller module, thus stopping its operation.
STMPE1601_SYS_CTRL_ENABLE_SPWM = (1 shl 0); Writing a 0 to this bit will gate off the clock to the simple PWM controller module, thus stopping its operation.
 
STMPE1801
STMPE1801_SYS_CTRL_RESET = (1 shl 7); Writing a 1 to this bit will do a soft reset of the device. Once the reset is done, this bit will be cleared to 0 by the HW.
 
STMPE240X
STMPE240X_SYS_CTRL_RESET = (1 shl 7); Writing a 1 to this bit will do a soft reset of the device. Once the reset is done, this bit will be cleared to 0 by the HW.
STMPE240X_SYS_CTRL_ENABLE_GPIO = (1 shl 3); Writing a 0 to this bit will gate off the clock to the GPIO module, thus stopping its operation.
STMPE240X_SYS_CTRL_ENABLE_PWM = (1 shl 2); Writing a 0 to this bit will gate off the clock to the PWM module, thus stopping its operation.
STMPE240X_SYS_CTRL_ENABLE_KPC = (1 shl 1); Writing a 0 to this bit will gate off the clock to the Keypad Controller module, thus stopping its operation.
STMPE240X_SYS_CTRL_ENABLE_ROT = (1 shl 0); Writing a 0 to this bit will gate off the clock to the Rotator module, thus stopping its operation.


STMPE touchscreen control STMPE*_TSC_CTRL_*
STMPE610/STMPE811
STMPE811_TSC_CTRL_TSC_STA = (1 shl 7); TSC status (Reads '1' when touch is detected/Reads '0' when touch is not detected)
STMPE811_TSC_CTRL_TRACK_MASK = (7 shl 4); TRACK: Tracking index
STMPE811_TSC_CTRL_OPMODE_XYZ = (0 shl 1); OP_MOD: TSC operating mode: X, Y, Z acquisition
STMPE811_TSC_CTRL_OPMODE_XY = (1 shl 1); OP_MOD: TSC operating mode: X, Y only
STMPE811_TSC_CTRL_OPMODE_X = (2 shl 1); OP_MOD: TSC operating mode: X only
STMPE811_TSC_CTRL_OPMODE_Y = (3 shl 1); OP_MOD: TSC operating mode: Y only
STMPE811_TSC_CTRL_OPMODE_Z = (4 shl 1); OP_MOD: TSC operating mode: Z only
STMPE811_TSC_CTRL_TSC_EN = (1 shl 0); Enable TSC


STMPE touchscreen configuration STMPE*_TSC_CFG_*
STMPE610/STMPE811
STMPE811_TSC_CFG_AVE_CTRL_1 = (0 shl 6); AVE_CTRL: Average control: 1 sample
STMPE811_TSC_CFG_AVE_CTRL_2 = (1 shl 6); AVE_CTRL: Average control: 2 samples
STMPE811_TSC_CFG_AVE_CTRL_4 = (2 shl 6); AVE_CTRL: Average control: 4 samples
STMPE811_TSC_CFG_AVE_CTRL_8 = (3 shl 6); AVE_CTRL: Average control: 8 samples
STMPE811_TSC_CFG_TOUCH_DET_DELAY_MASK = (7 shl 3); TOUCH_DET_DELAY: Touch detect delay
STMPE811_TSC_CFG_SETTLING_MASK = (7 shl 0); SETTLING: Panel driver settling time


STMPE ADC control 1 STMPE*_ADC_CTRL1_*
STMPE610/STMPE811
STMPE811_ADC_CTRL1_SAMPLE_TIME_MASK = (7 shl 4); SAMPLE_TIMEn: ADC conversion time in number of clock
STMPE811_ADC_CTRL1_MOD_12B = (1 shl 3); MOD_12B: Selects 10 or 12-bit ADC operation (1: 12 bit ADC/0: 10 bit ADC)
STMPE811_ADC_CTRL1_REF_SEL = (1 shl 1); REF_SEL: Selects between internal or external reference for the ADC (1: External reference/0: Internal reference)


STMPE ADC control 2 STMPE*_ADC_CTRL2_*
STMPE610/STMPE811
STMPE811_ADC_CTRL2_ADC_FREQ_MASK = (3 shl 0); ADC_FREQ: Selects the clock speed of ADC


STMPE FIFO control and status STMPE*_FIFO_STA_*
STMPE610/STMPE811
STMPE811_FIFO_STA_RESET = (1 shl 0); FIFO Reset (Write 0 : FIFO put out of reset mode/Write 1 : Resets FIFO. All data in FIFO will be cleared)


STMPE interrupt control STMPE*_INT_CTRL_*
STMPE610/STMPE811
STMPE811_INT_CTRL_POLARITY = (1 shl 2); This bit sets the INT pin polarity (1: Active high/rising edge/0: Active low/falling edge)
STMPE811_INT_CTRL_TYPE = (1 shl 1); This bit sets the type of interrupt signal required by the host (1: Edge interrupt/0: Level interrupt)
STMPE811_INT_CTRL_GLOBAL = (1 shl 0); This is master enable for the interrupt system (1: Global interrupt/0: Stops all interrupts)


STMPE interrupt enable STMPE*_INT_EN_*
STMPE610/STMPE811
STMPE811_INT_EN_GPIO = (1 shl 7); GPIO: Any enabled GPIO interrupts
STMPE811_INT_EN_ADC = (1 shl 6); ADC: Any enabled ADC interrupts
STMPE811_INT_EN_TEMP_SENS = (1 shl 5); TEMP_SENS: Temperature threshold triggering
STMPE811_INT_EN_FIFO_EMPTY = (1 shl 4); FIFO_EMPTY: FIFO is empty
STMPE811_INT_EN_FIFO_FULL = (1 shl 3); FIFO_FULL: FIFO is full
STMPE811_INT_EN_FIFO_OFLOW = (1 shl 2); FIFO_OFLOW: FIFO is overflowed
STMPE811_INT_EN_FIFO_TH = (1 shl 1); FIFO_TH: FIFO is equal or above threshold value
STMPE811_INT_EN_TOUCH_DET = (1 shl 0); TOUCH_DET: Touch is detected


STMPE interrupt status STMPE*_INT_STA_*
STMPE610/STMPE811
STMPE811_INT_STA_GPIO = (1 shl 7); GPIO: Any enabled GPIO interrupts
STMPE811_INT_STA_ADC = (1 shl 6); ADC: Any enabled ADC interrupts
STMPE811_INT_STA_TEMP_SENS = (1 shl 5); TEMP_SENS: Temperature threshold triggering
STMPE811_INT_STA_FIFO_EMPTY = (1 shl 4); FIFO_EMPTY: FIFO is empty
STMPE811_INT_STA_FIFO_FULL = (1 shl 3); FIFO_FULL: FIFO is full
STMPE811_INT_STA_FIFO_OFLOW = (1 shl 2); FIFO_OFLOW: FIFO is overflowed
STMPE811_INT_STA_FIFO_TH = (1 shl 1); FIFO_TH: FIFO is equal or above threshold value
STMPE811_INT_STA_TOUCH_DET = (1 shl 0); TOUCH_DET: Touch is detected
 
STMPE811_INT_STA_TOUCH_MASK = STMPE811_INT_STA_FIFO_EMPTY or STMPE811_INT_STA_FIFO_FULL or STMPE811_INT_STA_FIFO_OFLOW or STMPE811_INT_STA_FIFO_TH or STMPE811_INT_STA_TOUCH_DET;


STMPE offset STMPE*Offsets*
STMPE610/STMPE811 Offsets
STMPE811Offsets:TSTMPEOffsets = (
Control Register offsets
SysCtrl:STMPE811_REG_SYS_CTRL2;  
IntCtrl:STMPE811_REG_INT_CTRL;  
IntEnable:STMPE811_REG_INT_EN;  
IntStatus:STMPE811_REG_INT_STA;  
 
GPIO Registers offsets
GPIOIntEnable:STMPE811_REG_GPIO_INT_EN;  
GPIOIntStatus:STMPE811_REG_GPIO_INT_STA;  
GPIOPinGet:STMPE811_REG_GPIO_MP_STA;  
GPIOPinSet:STMPE811_REG_GPIO_SET_PIN;  
GPIOPinClr:STMPE811_REG_GPIO_CLR_PIN;  
GPIODirSet:STMPE811_REG_GPIO_SET_DIR;  
GPIOFuncSet:STMPE811_REG_GPIO_AF;  
GPIOPullUp:STMPE_REG_UNKNOWN;  
GPIOPullDown:STMPE_REG_UNKNOWN;  
GPIOEdgeDetect:STMPE811_REG_GPIO_ED;  
GPIORisingEdge:STMPE811_REG_GPIO_RE;  
GPIOFallingEdge:STMPE811_REG_GPIO_FE;  
 
Touchscreen Register offsets (610 and 811 Only)
ADCCtrl1:STMPE811_REG_ADC_CTRL1;  
ADCCtrl2:STMPE811_REG_ADC_CTRL2;  
TSCCtrl:STMPE811_REG_TSC_CTRL;  
TSCCfg:STMPE811_REG_TSC_CFG;  
FIFOThreshold:STMPE811_REG_FIFO_TH;  
FIFOStatus:STMPE811_REG_FIFO_STA;  
TSCDataXYZ:STMPE811_REG_TSC_DATA_XYZ;  
TSCFractionZ:STMPE811_REG_TSC_FRACTION_Z;  
TSCIDrive:STMPE811_REG_TSC_I_DRIVE );  
 
STMPE801 Offsets
STMPE801Offsets:TSTMPEOffsets = (
Control Register offsets
SysCtrl:STMPE801_REG_SYS_CTRL;  
IntCtrl:STMPE801_REG_SYS_CTRL;  
IntEnable:STMPE_REG_UNKNOWN;  
IntStatus:STMPE_REG_UNKNOWN;  
 
GPIO Registers offsets
GPIOIntEnable:STMPE801_REG_GPIO_INT_EN;  
GPIOIntStatus:STMPE801_REG_GPIO_INT_STA;  
GPIOPinGet:STMPE801_REG_GPIO_MP_STA;  
GPIOPinSet:STMPE801_REG_GPIO_SET_PIN;  
GPIOPinClr:STMPE801_REG_GPIO_SET_PIN;  
GPIODirSet:STMPE801_REG_GPIO_SET_DIR;  
GPIOFuncSet:STMPE_REG_UNKNOWN;  
GPIOPullUp:STMPE_REG_UNKNOWN;  
GPIOPullDown:STMPE_REG_UNKNOWN;  
GPIOEdgeDetect:STMPE_REG_UNKNOWN;  
GPIORisingEdge:STMPE_REG_UNKNOWN;  
GPIOFallingEdge:STMPE_REG_UNKNOWN;  
 
Touchscreen Register offsets (610 and 811 Only)
ADCCtrl1:STMPE_REG_UNKNOWN;  
ADCCtrl2:STMPE_REG_UNKNOWN;  
TSCCtrl:STMPE_REG_UNKNOWN;  
TSCCfg:STMPE_REG_UNKNOWN;  
FIFOThreshold:STMPE_REG_UNKNOWN;  
FIFOStatus:STMPE_REG_UNKNOWN;  
TSCDataXYZ:STMPE_REG_UNKNOWN;  
TSCFractionZ:STMPE_REG_UNKNOWN;  
TSCIDrive:STMPE_REG_UNKNOWN );  
 
 
STMPE1601 Offsets
STMPE1601Offsets:TSTMPEOffsets = (
Control Register offsets
SysCtrl:STMPE1601_REG_SYS_CTRL;  
IntCtrl:STMPE1601_REG_INT_CTRL_LSB;  
IntEnable:STMPE1601_REG_INT_EN_LSB;  
IntStatus:STMPE1601_REG_INT_STA_LSB;  
 
GPIO Registers offsets
GPIOIntEnable:STMPE1601_REG_GPIO_INT_EN_LSB;  
GPIOIntStatus:STMPE1601_REG_GPIO_INT_STA_LSB;  
GPIOPinGet:STMPE1601_REG_GPIO_MP_STA_LSB;  
GPIOPinSet:STMPE1601_REG_GPIO_SET_PIN_LSB;  
GPIOPinClr:STMPE1601_REG_GPIO_CLR_PIN_LSB;  
GPIODirSet:STMPE1601_REG_GPIO_SET_DIR_LSB;  
GPIOFuncSet:STMPE1601_REG_GPIO_AF_L_LSB;  
GPIOPullUp:STMPE1601_REG_GPIO_PU_LSB;  
GPIOPullDown:STMPE_REG_UNKNOWN;  
GPIOEdgeDetect:STMPE1601_REG_GPIO_ED_LSB;  
GPIORisingEdge:STMPE1601_REG_GPIO_RE_LSB;  
GPIOFallingEdge:STMPE1601_REG_GPIO_FE_LSB;  
 
Touchscreen Register offsets (610 and 811 Only)
ADCCtrl1:STMPE_REG_UNKNOWN;  
ADCCtrl2:STMPE_REG_UNKNOWN;  
TSCCtrl:STMPE_REG_UNKNOWN;  
TSCCfg:STMPE_REG_UNKNOWN;  
FIFOThreshold:STMPE_REG_UNKNOWN;  
FIFOStatus:STMPE_REG_UNKNOWN;  
TSCDataXYZ:STMPE_REG_UNKNOWN;  
TSCFractionZ:STMPE_REG_UNKNOWN;  
TSCIDrive:STMPE_REG_UNKNOWN );  
 
STMPE1801 Offsets
STMPE1801Offsets:TSTMPEOffsets = (
Control Register offsets
SysCtrl:STMPE1801_REG_SYS_CTRL;  
IntCtrl:STMPE1801_REG_INT_CTRL_LOW;  
IntEnable:STMPE1801_REG_INT_EN_LOW;  
IntStatus:STMPE1801_REG_INT_STA_LOW;  
 
GPIO Registers offsets
GPIOIntEnable:STMPE1801_REG_GPIO_INT_EN_LOW;  
GPIOIntStatus:STMPE1801_REG_GPIO_INT_STA_LOW;  
GPIOPinGet:STMPE1801_REG_GPIO_MP_STA_LOW;  
GPIOPinSet:STMPE1801_REG_GPIO_SET_PIN_LOW;  
GPIOPinClr:STMPE1801_REG_GPIO_CLR_PIN_LOW;  
GPIODirSet:STMPE1801_REG_GPIO_SET_DIR_LOW;  
GPIOFuncSet:STMPE_REG_UNKNOWN;  
GPIOPullUp:STMPE1801_REG_GPIO_PULL_UP_LOW;  
GPIOPullDown:STMPE_REG_UNKNOWN;  
GPIOEdgeDetect:STMPE_REG_UNKNOWN;  
GPIORisingEdge:STMPE1801_REG_GPIO_RE_LOW;  
GPIOFallingEdge:STMPE1801_REG_GPIO_FE_LOW;  
 
Touchscreen Register offsets (610 and 811 Only)
ADCCtrl1:STMPE_REG_UNKNOWN;  
ADCCtrl2:STMPE_REG_UNKNOWN;  
TSCCtrl:STMPE_REG_UNKNOWN;  
TSCCfg:STMPE_REG_UNKNOWN;  
FIFOThreshold:STMPE_REG_UNKNOWN;  
FIFOStatus:STMPE_REG_UNKNOWN;  
TSCDataXYZ:STMPE_REG_UNKNOWN;  
TSCFractionZ:STMPE_REG_UNKNOWN;  
TSCIDrive:STMPE_REG_UNKNOWN );  
 
STMPE2401/STMPE2403 Offsets
STMPE240XOffsets:TSTMPEOffsets = (
Control Register offsets
SysCtrl:STMPE240X_REG_SYS_CTRL;  
IntCtrl:STMPE240X_REG_INT_CTRL_LSB;  
IntEnable:STMPE240X_REG_INT_EN_LSB;  
IntStatus:STMPE240X_REG_INT_STA_LSB;  
 
GPIO Registers offsets
GPIOIntEnable:STMPE240X_REG_GPIO_INT_EN_LSB;  
GPIOIntStatus:STMPE240X_REG_GPIO_INT_STA_LSB;  
GPIOPinGet:STMPE240X_REG_GPIO_MP_STA_LSB;  
GPIOPinSet:STMPE240X_REG_GPIO_SET_PIN_LSB;  
GPIOPinClr:STMPE240X_REG_GPIO_CLR_PIN_LSB;  
GPIODirSet:STMPE240X_REG_GPIO_SET_DIR_LSB;  
GPIOFuncSet:STMPE240X_REG_GPIO_AF_L_LSB;  
GPIOPullUp:STMPE240X_REG_GPIO_PULL_UP_LSB;  
GPIOPullDown:STMPE240X_REG_GPIO_PULL_DN_LSB;  
GPIOEdgeDetect:STMPE240X_REG_GPIO_ED_LSB;  
GPIORisingEdge:STMPE240X_REG_GPIO_RE_LSB;  
GPIOFallingEdge:STMPE240X_REG_GPIO_FE_LSB;  
 
Touchscreen Register offsets (610 and 811 Only)
ADCCtrl1:STMPE_REG_UNKNOWN;  
ADCCtrl2:STMPE_REG_UNKNOWN;  
TSCCtrl:STMPE_REG_UNKNOWN;  
TSCCfg:STMPE_REG_UNKNOWN;  
FIFOThreshold:STMPE_REG_UNKNOWN;  
FIFOStatus:STMPE_REG_UNKNOWN;  
TSCDataXYZ:STMPE_REG_UNKNOWN;  
TSCFractionZ:STMPE_REG_UNKNOWN;  
TSCIDrive:STMPE_REG_UNKNOWN );  


Type definitions



STMPE control

PSTMPEControl = ^TSTMPEControl;

TSTMPEControl = record

General Properties
Chip:LongWord; The chip type (eg STMPE_CHIP_STMPE610)
IRQ:TGPIOInfo; The GPIO information for the IRQ line (Optional)
I2C Properties
I2C:PI2CDevice; The I2C device this device is connected to (Optional)
Address:Word; The I2C address of the device
SPI Properties
SPI:PSPIDevice; The SPI device this device is connected to (Optional)
ChipSelect:Word; The SPI chip select of the device
Register Properties
RegMax:LongWord; The maximum register address for read or write
RegDir:LongWord; The register address direction (Ascending/Descending)
RegSize:LongWord; The standard size of a register read or write

STMPE offsets

PSTMPEOffsets = ^TSTMPEOffsets;

TSTMPEOffsets = record

Control Register offsets
SysCtrl:Byte;  
IntCtrl:Byte;  
IntEnable:Byte;  
IntStatus:Byte;  
GPIO Registers offsets
GPIOIntEnable:Byte;  
GPIOIntStatus:Byte;  
GPIOPinGet:Byte;  
GPIOPinSet:Byte;  
GPIOPinClr:Byte;  
GPIODirSet:Byte;  
GPIOFuncSet:Byte;  
GPIOPullUp:Byte;  
GPIOPullDown:Byte;  
GPIOEdgeDetect:Byte;  
GPIORisingEdge:Byte;  
GPIOFallingEdge:Byte;  
Touchscreen Register offsets (610 and 811 Only)
ADCCtrl1:Byte;  
ADCCtrl2:Byte;  
TSCCtrl:Byte;  
TSCCfg:Byte;  
FIFOThreshold:Byte;  
FIFOStatus:Byte;  
TSCDataXYZ:Byte;  
TSCFractionZ:Byte;  
TSCIDrive:Byte;  

STMPE GPIO

PSTMPEGPIO = ^TSTMPEGPIO;

TSTMPEGPIO = record

GPIO Properties
GPIO:TGPIODevice;  
STMPE Properties
Control:TSTMPEControl; The control information (Chip, I2C, SPI etc) for this device
Offsets:TSTMPEOffsets; The register offsets for this device

STMPE touch

PSTMPETouch = ^TSTMPETouch;

TSTMPETouch = record

Touch Properties
Touch:TTouchDevice;  
General Properties
MaxX:Word; Maximum X value for this device
MaxY:Word; Maximum Y value for this device
MaxZ:Word; Maximum Z value for this device
Width:Word; Screen width for this device
Height:Word; Screen height for this device
MaxPoints:LongWord; Maximum touch points for this device
STMPE Properties
Control:TSTMPEControl; The control information (Chip, I2C, SPI etc) for this device
Offsets:TSTMPEOffsets; The register offsets for this device
Timer:TTimerHandle; Handle for touch release timer


Public variables



STMPE specific variables

STMPE_SAMPLE_TIME:Byte = 4;
STMPE_MOD_12B:Byte = 1;
STMPE_REF_SEL:Byte = 0;
STMPE_ADC_FREQ:Byte = 2;
STMPE_AVE_CTRL:Byte = 3;
STMPE_TOUCH_DET_DELAY:Byte = 4;
STMPE_SETTLING:Byte = 2;
STMPE_FRACTION_Z:Byte = 7;
STMPE_I_DRIVE:Byte = 0;


Function declarations



Initialization functions

procedure STMPEInit;
Description: Initialize the STMPE unit and parameters
Note Called internally by other functions


STMPE functions

function STMPE610GPIOCreate(I2C:PI2CDevice; SPI:PSPIDevice; Address,ChipSelect:Word; IRQ:PGPIOInfo):PGPIODevice;
Description: Create, register and start a new STMPE610 GPIO device connected to the specified I2C or SPI device
I2C The I2C device this STMPE610 is connected to (Optional)
SPI The SPI device this STMPE610 is connected to (Optional)
Address The I2C address for this STMPE610 (or I2C_ADDRESS_INVALID if SPI connected)
ChipSelect The SPI chip select for this STMPE610 (or SPI_CS_NONE if I2C connected)
IRQ The GPIO information for the IRQ line (Optional)
Return Pointer to the new GPIO device or nil on failure
Note Either I2C or SPI must be specified but not both


function STMPE801GPIOCreate(I2C:PI2CDevice; Address:Word; IRQ:PGPIOInfo):PGPIODevice;
Description: Create, register and start a new STMPE801 GPIO device connected to the specified I2C device
I2C The I2C device this STMPE801 is connected to
Address The I2C address for this STMPE801
IRQ The GPIO information for the IRQ line (Optional)
Return Pointer to the new GPIO device or nil on failure


function STMPE811GPIOCreate(I2C:PI2CDevice; SPI:PSPIDevice; Address,ChipSelect:Word; IRQ:PGPIOInfo):PGPIODevice;
Description: Create, register and start a new STMPE811 GPIO device connected to the specified I2C or SPI device
I2C The I2C device this STMPE811 is connected to (Optional)
SPI The SPI device this STMPE811 is connected to (Optional)
Address The I2C address for this STMPE811 (or I2C_ADDRESS_INVALID if SPI connected)
ChipSelect The SPI chip select for this STMPE811 (or SPI_CS_NONE if I2C connected)
IRQ The GPIO information for the IRQ line (Optional)
Return Pointer to the new GPIO device or nil on failure
Note Either I2C or SPI must be specified but not both


function STMPE1601GPIOCreate(I2C:PI2CDevice; Address:Word; IRQ:PGPIOInfo):PGPIODevice;
Description: Create, register and start a new STMPE1601 GPIO device connected to the specified I2C device
2C The I2C device this STMPE1601 is connected to
Address The I2C address for this STMPE1601
IRQ The GPIO information for the IRQ line (Optional)
Return Pointer to the new GPIO device or nil on failure


function STMPE1801GPIOCreate(I2C:PI2CDevice; Address:Word; IRQ:PGPIOInfo):PGPIODevice;
Description: Create, register and start a new STMPE1801 GPIO device connected to the specified I2C device
I2C The I2C device this STMPE1801 is connected to
Address The I2C address for this STMPE1801
IRQ The GPIO information for the IRQ line (Optional)
Return Pointer to the new GPIO device or nil on failure


function STMPE2401GPIOCreate(I2C:PI2CDevice; Address:Word; IRQ:PGPIOInfo):PGPIODevice;
Description: Create, register and start a new STMPE2401 GPIO device connected to the specified I2C device
I2C The I2C device this STMPE2401 is connected to
Address The I2C address for this STMPE2401
IRQ The GPIO information for the IRQ line (Optional)
Return Pointer to the new GPIO device or nil on failure


function STMPEGPIODestroy(GPIO:PGPIODevice):LongWord;
Description: Stop, deregister and destroy an STMPE GPIO device created by this driver
GPIO The GPIO device to destroy
Return ERROR_SUCCESS if completed or another error code on failure


function STMPE610TouchCreate(I2C:PI2CDevice; SPI:PSPIDevice; Address,ChipSelect:Word; Width,Height:LongWord; IRQ:PGPIOInfo):PTouchDevice;
Description: Create, register and start a new STMPE610 Touch device connected to the specified I2C or SPI device
I2C The I2C device this STMPE610 is connected to (Optional)
SPI The SPI device this STMPE610 is connected to (Optional)
Address The I2C address for this STMPE610 (or I2C_ADDRESS_INVALID if SPI connected)
ChipSelect The SPI chip select for this STMPE610 (or SPI_CS_NONE if I2C connected)
Width The width of the screen in pixels
Height The height of the screen in pixels
IRQ The GPIO information for the IRQ line (Optional)
Return Pointer to the new Touch device or nil on failure
Note Either I2C or SPI must be specified but not both


function STMPE811TouchCreate(I2C:PI2CDevice; SPI:PSPIDevice; Address,ChipSelect:Word; Width,Height:LongWord; IRQ:PGPIOInfo):PTouchDevice;
Description: Create, register and start a new STMPE811 Touch device connected to the specified I2C or SPI device
I2C The I2C device this STMPE811 is connected to (Optional)
SPI The SPI device this STMPE811 is connected to (Optional)
Address The I2C address for this STMPE811 (or I2C_ADDRESS_INVALID if SPI connected)
ChipSelect The SPI chip select for this STMPE811 (or SPI_CS_NONE if I2C connected)
Width The width of the screen in pixels
Height The height of the screen in pixels
IRQ The GPIO information for the IRQ line (Optional)
Return Pointer to the new Touch device or nil on failure
Note Either I2C or SPI must be specified but not both


function STMPETouchDestroy(Touch:PTouchDevice):LongWord;
Description: Stop, deregister and destroy an STMPE Touch device created by this driver
Touch The Touch device to destroy
Return ERROR_SUCCESS if completed or another error code on failure


STMPE GPIO functions

function STMPEGPIOStart(GPIO:PGPIODevice):LongWord;
Description: Implementation of GPIODeviceStart API for STMPE
Note Not intended to be called directly by applications, use GPIODeviceStart instead.


function STMPEGPIOStop(GPIO:PGPIODevice):LongWord;
Description: Implementation of GPIODeviceStop API for STMPE
Note Not intended to be called directly by applications, use GPIODeviceStop instead.


function STMPEGPIORead(GPIO:PGPIODevice; Reg:LongWord):LongWord;
Description: Implementation of GPIODeviceRead API for STMPE
Note Not intended to be called directly by applications, use GPIODeviceRead instead.


procedure STMPEGPIOWrite(GPIO:PGPIODevice; Reg,Value:LongWord);
Description: Implementation of GPIODeviceWrite API for STMPE
Note Not intended to be called directly by applications, use GPIODeviceWrite instead.


function STMPEGPIOInputGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: Implementation of GPIODeviceInputGet API for STMPE
Note Not intended to be called directly by applications, use GPIODeviceInputGet instead.


function STMPEGPIOOutputSet(GPIO:PGPIODevice; Pin,Level:LongWord):LongWord;
Description: Implementation of GPIODeviceOutputSet API for STMPE
Note Not intended to be called directly by applications, use GPIODeviceOutputSet instead.


function STMPEGPIOPullGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: Implementation of GPIODevicePullGet API for STMPE
Note Not intended to be called directly by applications, use GPIODevicePullGet instead.


function STMPEGPIOPullSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
Description: Implementation of GPIODevicePullSelect API for STMPE
Note Not intended to be called directly by applications, use GPIODevicePullSelect instead.


function STMPEGPIOFunctionGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: Implementation of GPIODeviceFunctionGet API for STMPE
Note Not intended to be called directly by applications, use GPIODeviceFunctionGet instead.


function STMPEGPIOFunctionSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
Description: Implementation of GPIODeviceFunctionSelect API for STMPE
Note Not intended to be called directly by applications, use GPIODeviceFunctionSelect instead.


STMPE touch functions

function STMPETouchStart(Touch:PTouchDevice):LongWord;
Description: Implementation of TouchDeviceStart API for STMPE
Note Not intended to be called directly by applications, use TouchDeviceStart instead.


function STMPETouchStop(Touch:PTouchDevice):LongWord;
Description: Implementation of TouchDeviceStop API for STMPE
Note Not intended to be called directly by applications, use TouchDeviceStop instead.


function STMPETouchUpdate(Touch:PTouchDevice):LongWord;
Description: Implementation of TouchDeviceUpdate API for STMPE
Note Not intended to be called directly by applications, use TouchDeviceUpdate instead.


procedure STMPETouchTimer(Touch:PSTMPETouch);
Description: Touch device timer event handler for STMPE
Note Not intended to be called directly by applications


procedure STMPETouchCallback(Touch:PSTMPETouch; Pin,Trigger:LongWord);
Description: Touch device event callback (Interrupt) handler for STMPE
Note Not intended to be called directly by applications


STMPE helper functions

function STMPEReadByte(Control:PSTMPEControl; Reg:Byte; Value:PByte):LongWord;
Description: To be documented
Note None documented


function STMPEWriteByte(Control:PSTMPEControl; Reg,Value:Byte):LongWord;
Description: To be documented
Note None documented


function STMPEReadWord(Control:PSTMPEControl; Reg:Byte; Value:PWord):LongWord;
Description: To be documented
Note None documented


function STMPEWriteWord(Control:PSTMPEControl; Reg:Byte; Value:Word):LongWord;
Description: To be documented
Note None documented


function STMPEReadBytes(Control:PSTMPEControl; Reg,Len:Byte; Values:PByte):LongWord;
Description: To be documented
Note None documented


function STMPEWriteBytes(Control:PSTMPEControl; Reg,Len:Byte; Values:PByte):LongWord;
Description: To be documented
Note None documented


function STMPESetBits(Control:PSTMPEControl; Reg,Mask,Value:Byte):LongWord;
Description: To be documented
Note None documented


function STMPEResetFIFO(Control:PSTMPEControl; Reg:Byte):LongWord;
Description: To be documented
Note None documented


Return to Unit Reference