Difference between revisions of "Unit STMPE"
Line 1,815: | Line 1,815: | ||
---- | ---- | ||
− | '' | + | |
+ | '''STMPE control''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSTMPEControl = ^TSTMPEControl;</code> | ||
+ | |||
+ | <code>TSTMPEControl = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''General Properties'' | ||
+ | |- | ||
+ | | <code>Chip:LongWord;</code> | ||
+ | | The chip type (eg STMPE_CHIP_STMPE610) | ||
+ | |- | ||
+ | | <code>IRQ:TGPIOInfo;</code> | ||
+ | | The GPIO information for the IRQ line (Optional) | ||
+ | |- | ||
+ | |colspan="2"|''I2C Properties'' | ||
+ | |- | ||
+ | | <code>I2C:PI2CDevice;</code> | ||
+ | | The I2C device this device is connected to (Optional) | ||
+ | |- | ||
+ | | <code>Address:Word;</code> | ||
+ | | The I2C address of the device | ||
+ | |- | ||
+ | |colspan="2"|''SPI Properties'' | ||
+ | |- | ||
+ | | <code>SPI:PSPIDevice;</code> | ||
+ | | The SPI device this device is connected to (Optional) | ||
+ | |- | ||
+ | | <code>ChipSelect:Word;</code> | ||
+ | | The SPI chip select of the device | ||
+ | |- | ||
+ | |colspan="2"|''Register Properties'' | ||
+ | |- | ||
+ | | <code>RegMax:LongWord;</code> | ||
+ | | The maximum register address for read or write | ||
+ | |- | ||
+ | | <code>RegDir:LongWord;</code> | ||
+ | | The register address direction (Ascending / Descending) | ||
+ | |- | ||
+ | | <code>RegSize:LongWord;</code> | ||
+ | | The standard size of a register read or write | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''STMPE offsets''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSTMPEOffsets = ^TSTMPEOffsets;</code> | ||
+ | |||
+ | <code>TSTMPEOffsets = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Control Register offsets'' | ||
+ | |- | ||
+ | | <code>SysCtrl:Byte;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>IntCtrl:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>IntEnable:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>IntStatus:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''GPIO Registers offsets'' | ||
+ | |- | ||
+ | | <code>GPIOIntEnable:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GPIOIntStatus:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GPIOPinGet:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GPIOPinSet:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GPIOPinClr:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GPIODirSet:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GPIOFuncSet:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GPIOPullUp:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GPIOPullDown:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GPIOEdgeDetect:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GPIORisingEdge:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>GPIOFallingEdge:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''Touchscreen Register offsets (610 and 811 Only)'' | ||
+ | |- | ||
+ | | <code>ADCCtrl1:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ADCCtrl2:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>TSCCtrl:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>TSCCfg:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FIFOThreshold:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FIFOStatus:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>TSCDataXYZ:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>TSCFractionZ:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>TSCIDrive:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''STMPE GPIO''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSTMPEGPIO = ^TSTMPEGPIO;</code> | ||
+ | |||
+ | <code>TSTMPEGPIO = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''GPIO Properties'' | ||
+ | |- | ||
+ | | <code>GPIO:TGPIODevice;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''STMPE Properties'' | ||
+ | |- | ||
+ | | <code>Control:TSTMPEControl;</code> | ||
+ | | The control information (Chip, I2C, SPI etc) for this device | ||
+ | |- | ||
+ | | <code>Offsets:TSTMPEOffsets;</code> | ||
+ | | The register offsets for this device | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''STMPE touch''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSTMPETouch = ^TSTMPETouch;</code> | ||
+ | |||
+ | <code>TSTMPETouch = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Touch Properties'' | ||
+ | |- | ||
+ | | <code>Touch:TTouchDevice;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''STMPE Properties'' | ||
+ | |- | ||
+ | | <code>Control:TSTMPEControl;</code> | ||
+ | | The control information (Chip, I2C, SPI etc) for this device | ||
+ | |- | ||
+ | | <code>Offsets:TSTMPEOffsets;</code> | ||
+ | | The register offsets for this device | ||
+ | |- | ||
+ | | <code>Timer:TTimerHandle;</code> | ||
+ | | Handle for touch release timer | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === |
Revision as of 04:01, 25 January 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