Unit STMPE

From Ultibo.org
Revision as of 01:41, 14 October 2016 by Ultibo (Talk | contribs)

Jump to: navigation, search

Return to Unit Reference


Description


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


To be documented

Type definitions


To be documented

Public variables


To be documented

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
I2C 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


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