Difference between revisions of "Unit STMPE"
Line 9: | Line 9: | ||
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: | 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 | + | STMPE610 - 6 GPIO/4-wire Touch/I2C/SPI |
− | STMPE801 - 8 GPIO / I2C | + | STMPE801 - 8 GPIO/I2C |
− | STMPE811 - 8 GPIO / 4-wire Touch / I2C / SPI | + | STMPE811 - 8 GPIO/4-wire Touch/I2C/SPI |
− | STMPE1601 - 16 GPIO / 4 PWM / I2C | + | STMPE1601 - 16 GPIO/4 PWM/I2C |
− | STMPE1801 - 18 GPIO / I2C | + | STMPE1801 - 18 GPIO/I2C |
− | STMPE2401 - 24 GPIO / 3 PWM / I2C | + | STMPE2401 - 24 GPIO/3 PWM/I2C |
− | STMPE2403 - 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. | Note: A number of variations also support Keypad, Temperature and other features which are not currently handled by this driver. | ||
Line 178: | Line 178: | ||
|- | |- | ||
| <code>STMPE1601_GPIO_MAX_FUNCTION = GPIO_FUNCTION_ALT1;</code> | | <code>STMPE1601_GPIO_MAX_FUNCTION = GPIO_FUNCTION_ALT1;</code> | ||
− | | Alternate function 0 = Keypad / Alternate function 1 = PWM | + | | Alternate function 0 = Keypad/Alternate function 1 = PWM |
|- | |- | ||
| <code>STMPE1601_GPIO_FUNCTION_COUNT = 4;</code> | | <code>STMPE1601_GPIO_FUNCTION_COUNT = 4;</code> | ||
Line 314: | Line 314: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | |colspan="2"|''STMPE610 / STMPE811'' | + | |colspan="2"|''STMPE610/STMPE811'' |
|- | |- | ||
| <code>STMPE811_REG_CHIP_ID = $00;</code> | | <code>STMPE811_REG_CHIP_ID = $00;</code> | ||
Line 320: | Line 320: | ||
|- | |- | ||
| <code>STMPE811_REG_ID_VER = $02;</code> | | <code>STMPE811_REG_ID_VER = $02;</code> | ||
− | | Revision number (0x01 for engineering sample / 0x03 for final silicon) | + | | Revision number (0x01 for engineering sample/0x03 for final silicon) |
|- | |- | ||
| <code>STMPE811_REG_SYS_CTRL1 = $03;</code> | | <code>STMPE811_REG_SYS_CTRL1 = $03;</code> | ||
Line 495: | Line 495: | ||
|- | |- | ||
| <code>STMPE801_REG_ID_VER = $02;</code> | | <code>STMPE801_REG_ID_VER = $02;</code> | ||
− | | Revision number (0x01 for engineering sample / 0x02 for final silicon) | + | | Revision number (0x01 for engineering sample/0x02 for final silicon) |
|- | |- | ||
| <code>STMPE801_REG_SYS_CTRL = $04;</code> | | <code>STMPE801_REG_SYS_CTRL = $04;</code> | ||
Line 828: | Line 828: | ||
|colspan="2"| | |colspan="2"| | ||
|- | |- | ||
− | |colspan="2"|''STMPE2401 / STMPE2403'' | + | |colspan="2"|''STMPE2401/STMPE2403'' |
|- | |- | ||
| <code>STMPE240X_REG_CHIP_ID = $80;</code> | | <code>STMPE240X_REG_CHIP_ID = $80;</code> | ||
Line 1,039: | Line 1,039: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | |colspan="2"|''STMPE610 / STMPE811'' | + | |colspan="2"|''STMPE610/STMPE811'' |
|- | |- | ||
| <code>STMPE811_CHIP_ID = $0811;</code> | | <code>STMPE811_CHIP_ID = $0811;</code> | ||
Line 1,067: | Line 1,067: | ||
|colspan="2"| | |colspan="2"| | ||
|- | |- | ||
− | |colspan="2"|''STMPE2401 / STMPE2403'' | + | |colspan="2"|''STMPE2401/STMPE2403'' |
|- | |- | ||
| <code>STMPE240X_CHIP_ID = $01;</code> | | <code>STMPE240X_CHIP_ID = $01;</code> | ||
Line 1,080: | Line 1,080: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | |colspan="2"|''STMPE610 / STMPE811'' | + | |colspan="2"|''STMPE610/STMPE811'' |
|- | |- | ||
| <code>STMPE811_SYS_CTRL2_TS_OFF = (1 shl 3);</code> | | <code>STMPE811_SYS_CTRL2_TS_OFF = (1 shl 3);</code> | ||
Line 1,157: | Line 1,157: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | |colspan="2"|''STMPE610 / STMPE811'' | + | |colspan="2"|''STMPE610/STMPE811'' |
|- | |- | ||
| <code>STMPE811_TSC_CTRL_TSC_STA = (1 shl 7);</code> | | <code>STMPE811_TSC_CTRL_TSC_STA = (1 shl 7);</code> | ||
− | | TSC status (Reads '1' when touch is detected / Reads '0' when touch is not detected) | + | | TSC status (Reads '1' when touch is detected/Reads '0' when touch is not detected) |
|- | |- | ||
| <code>STMPE811_TSC_CTRL_TRACK_MASK = (7 shl 4);</code> | | <code>STMPE811_TSC_CTRL_TRACK_MASK = (7 shl 4);</code> | ||
Line 1,191: | Line 1,191: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | |colspan="2"|''STMPE610 / STMPE811'' | + | |colspan="2"|''STMPE610/STMPE811'' |
|- | |- | ||
| <code>STMPE811_TSC_CFG_AVE_CTRL_1 = (0 shl 6);</code> | | <code>STMPE811_TSC_CFG_AVE_CTRL_1 = (0 shl 6);</code> | ||
Line 1,219: | Line 1,219: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | |colspan="2"|''STMPE610 / STMPE811'' | + | |colspan="2"|''STMPE610/STMPE811'' |
|- | |- | ||
| <code>STMPE811_ADC_CTRL1_SAMPLE_TIME_MASK = (7 shl 4);</code> | | <code>STMPE811_ADC_CTRL1_SAMPLE_TIME_MASK = (7 shl 4);</code> | ||
Line 1,225: | Line 1,225: | ||
|- | |- | ||
| <code>STMPE811_ADC_CTRL1_MOD_12B = (1 shl 3);</code> | | <code>STMPE811_ADC_CTRL1_MOD_12B = (1 shl 3);</code> | ||
− | | MOD_12B: Selects 10 or 12-bit ADC operation (1: 12 bit ADC / 0: 10 bit ADC) | + | | MOD_12B: Selects 10 or 12-bit ADC operation (1: 12 bit ADC/0: 10 bit ADC) |
|- | |- | ||
| <code>STMPE811_ADC_CTRL1_REF_SEL = (1 shl 1);</code> | | <code>STMPE811_ADC_CTRL1_REF_SEL = (1 shl 1);</code> | ||
− | | REF_SEL: Selects between internal or external reference for the ADC (1: External reference / 0: Internal reference) | + | | REF_SEL: Selects between internal or external reference for the ADC (1: External reference/0: Internal reference) |
|- | |- | ||
|} | |} | ||
Line 1,238: | Line 1,238: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | |colspan="2"|''STMPE610 / STMPE811'' | + | |colspan="2"|''STMPE610/STMPE811'' |
|- | |- | ||
| <code>STMPE811_ADC_CTRL2_ADC_FREQ_MASK = (3 shl 0);</code> | | <code>STMPE811_ADC_CTRL2_ADC_FREQ_MASK = (3 shl 0);</code> | ||
Line 1,251: | Line 1,251: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | |colspan="2"|''STMPE610 / STMPE811'' | + | |colspan="2"|''STMPE610/STMPE811'' |
|- | |- | ||
| <code>STMPE811_FIFO_STA_RESET = (1 shl 0);</code> | | <code>STMPE811_FIFO_STA_RESET = (1 shl 0);</code> | ||
− | | FIFO Reset (Write 0 : FIFO put out of reset mode | + | | FIFO Reset (Write 0 : FIFO put out of reset mode/Write 1 : Resets FIFO. All data in FIFO will be cleared) |
|- | |- | ||
|} | |} | ||
Line 1,264: | Line 1,264: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | |colspan="2"|''STMPE610 / STMPE811'' | + | |colspan="2"|''STMPE610/STMPE811'' |
|- | |- | ||
| <code>STMPE811_INT_CTRL_POLARITY = (1 shl 2);</code> | | <code>STMPE811_INT_CTRL_POLARITY = (1 shl 2);</code> | ||
− | | This bit sets the INT pin polarity (1: Active high/rising edge / 0: Active low/falling edge) | + | | This bit sets the INT pin polarity (1: Active high/rising edge/0: Active low/falling edge) |
|- | |- | ||
| <code>STMPE811_INT_CTRL_TYPE = (1 shl 1);</code> | | <code>STMPE811_INT_CTRL_TYPE = (1 shl 1);</code> | ||
− | | This bit sets the type of interrupt signal required by the host (1: Edge interrupt / 0: Level interrupt) | + | | This bit sets the type of interrupt signal required by the host (1: Edge interrupt/0: Level interrupt) |
|- | |- | ||
| <code>STMPE811_INT_CTRL_GLOBAL = (1 shl 0);</code> | | <code>STMPE811_INT_CTRL_GLOBAL = (1 shl 0);</code> | ||
− | | This is master enable for the interrupt system (1: Global interrupt / 0: Stops all interrupts) | + | | This is master enable for the interrupt system (1: Global interrupt/0: Stops all interrupts) |
|- | |- | ||
|} | |} | ||
Line 1,283: | Line 1,283: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | |colspan="2"|''STMPE610 / STMPE811'' | + | |colspan="2"|''STMPE610/STMPE811'' |
|- | |- | ||
| <code>STMPE811_INT_EN_GPIO = (1 shl 7);</code> | | <code>STMPE811_INT_EN_GPIO = (1 shl 7);</code> | ||
Line 1,317: | Line 1,317: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | |colspan="2"|''STMPE610 / STMPE811'' | + | |colspan="2"|''STMPE610/STMPE811'' |
|- | |- | ||
| <code>STMPE811_INT_STA_GPIO = (1 shl 7);</code> | | <code>STMPE811_INT_STA_GPIO = (1 shl 7);</code> | ||
Line 1,355: | Line 1,355: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | |colspan="2"|''STMPE610 / STMPE811 Offsets'' | + | |colspan="2"|''STMPE610/STMPE811 Offsets'' |
|- | |- | ||
|colspan="2"|<code>STMPE811Offsets:TSTMPEOffsets = (</code> | |colspan="2"|<code>STMPE811Offsets:TSTMPEOffsets = (</code> | ||
Line 1,719: | Line 1,719: | ||
|colspan="2"| | |colspan="2"| | ||
|- | |- | ||
− | |colspan="2"|''STMPE2401 / STMPE2403 Offsets'' | + | |colspan="2"|''STMPE2401/STMPE2403 Offsets'' |
|- | |- | ||
|colspan="2"|<code>STMPE240XOffsets:TSTMPEOffsets = (</code> | |colspan="2"|<code>STMPE240XOffsets:TSTMPEOffsets = (</code> | ||
Line 1,855: | Line 1,855: | ||
|- | |- | ||
| <code>RegDir:LongWord;</code> | | <code>RegDir:LongWord;</code> | ||
− | | The register address direction (Ascending / Descending) | + | | The register address direction (Ascending/Descending) |
|- | |- | ||
| <code>RegSize:LongWord;</code> | | <code>RegSize:LongWord;</code> |
Revision as of 04:26, 13 April 2017
Return to Unit Reference
Contents
[hide]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*_*
STMPE_CHIP_*
STMPE_DIR_*
STMPE_I2C_*
STMPE_SPI_*
STMPE*_REG_*
STMPE*_CHIP_ID
STMPE*_SYS_CTRL*_*
STMPE*_TSC_CTRL_*
STMPE*_TSC_CFG_*
STMPE*_ADC_CTRL1_*
STMPE*_ADC_CTRL2_*
STMPE*_FIFO_STA_*
STMPE*_INT_CTRL_*
STMPE*_INT_EN_*
STMPE*_INT_STA_*
STMPE*Offsets*
Type definitions
STMPE control
STMPE offsets
STMPE GPIO
STMPE touch
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
STMPE functions
function STMPE610GPIOCreate(I2C:PI2CDevice; SPI:PSPIDevice; Address,ChipSelect:Word; IRQ:PGPIOInfo):PGPIODevice;
function STMPE801GPIOCreate(I2C:PI2CDevice; Address:Word; IRQ:PGPIOInfo):PGPIODevice;
function STMPE811GPIOCreate(I2C:PI2CDevice; SPI:PSPIDevice; Address,ChipSelect:Word; IRQ:PGPIOInfo):PGPIODevice;
function STMPE1601GPIOCreate(I2C:PI2CDevice; Address:Word; IRQ:PGPIOInfo):PGPIODevice;
function STMPE1801GPIOCreate(I2C:PI2CDevice; Address:Word; IRQ:PGPIOInfo):PGPIODevice;
function STMPE2401GPIOCreate(I2C:PI2CDevice; Address:Word; IRQ:PGPIOInfo):PGPIODevice;
function STMPEGPIODestroy(GPIO:PGPIODevice):LongWord;
function STMPE610TouchCreate(I2C:PI2CDevice; SPI:PSPIDevice; Address,ChipSelect:Word; Width,Height:LongWord; IRQ:PGPIOInfo):PTouchDevice;
function STMPE811TouchCreate(I2C:PI2CDevice; SPI:PSPIDevice; Address,ChipSelect:Word; Width,Height:LongWord; IRQ:PGPIOInfo):PTouchDevice;
function STMPETouchDestroy(Touch:PTouchDevice):LongWord;
STMPE GPIO functions
function STMPEGPIOStart(GPIO:PGPIODevice):LongWord;
function STMPEGPIOStop(GPIO:PGPIODevice):LongWord;
function STMPEGPIORead(GPIO:PGPIODevice; Reg:LongWord):LongWord;
procedure STMPEGPIOWrite(GPIO:PGPIODevice; Reg,Value:LongWord);
function STMPEGPIOInputGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
function STMPEGPIOOutputSet(GPIO:PGPIODevice; Pin,Level:LongWord):LongWord;
function STMPEGPIOPullGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
function STMPEGPIOPullSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
function STMPEGPIOFunctionGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
function STMPEGPIOFunctionSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
STMPE touch functions
function STMPETouchStart(Touch:PTouchDevice):LongWord;
function STMPETouchStop(Touch:PTouchDevice):LongWord;
procedure STMPETouchTimer(Touch:PSTMPETouch);
procedure STMPETouchCallback(Touch:PSTMPETouch; Pin,Trigger:LongWord);
STMPE helper functions
function STMPEReadByte(Control:PSTMPEControl; Reg:Byte; Value:PByte):LongWord;
function STMPEWriteByte(Control:PSTMPEControl; Reg,Value:Byte):LongWord;
function STMPEReadWord(Control:PSTMPEControl; Reg:Byte; Value:PWord):LongWord;
function STMPEWriteWord(Control:PSTMPEControl; Reg:Byte; Value:Word):LongWord;
function STMPEReadBytes(Control:PSTMPEControl; Reg,Len:Byte; Values:PByte):LongWord;
function STMPEWriteBytes(Control:PSTMPEControl; Reg,Len:Byte; Values:PByte):LongWord;
function STMPESetBits(Control:PSTMPEControl; Reg,Mask,Value:Byte):LongWord;
function STMPEResetFIFO(Control:PSTMPEControl; Reg:Byte):LongWord;
Return to Unit Reference