Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TS_Eyes Tokei testUniGraphic_150217 AfficheurTFTAdafruit ... more
SPI_STMPE610 Class Reference
SPI_STMPE610 Touch Sensor Example: More...
#include <SPI_STMPE610.h>
Public Member Functions | |
| SPI_STMPE610 (PinName mosi, PinName miso, PinName sclk, PinName cs) | |
| STMPE610 constructor. | |
| ~SPI_STMPE610 () | |
| Destructor. | |
| void | spi_frequency (unsigned long freq) |
| specify spi frequency from this class | |
| void | spi_format (int bits, int mode) |
| specify spi format from this class | |
| int | getRAWPoint (uint16_t *x, uint16_t *y, uint16_t *z) |
| get RAW value of x, y, z | |
| int | getPoint (uint16_t *x, uint16_t *y, uint16_t *z=0) |
| get value of x, y, z | |
Detailed Description
SPI_STMPE610 Touch Sensor Example:
#include "mbed.h" #include "SPI_STMPE610.h" #define PIN_MOSI PTD2 #define PIN_MISO PTD3 #define PIN_SCLK PTD1 #define PIN_CS_TSC PTA13 #define PIN_TSC_INTR PTC9 SPI_STMPE610 TSC(PIN_MOSI, PIN_MISO, PIN_SCLK, PIN_CS_TSC) ; int main() { uint16_t touched, x, y, z ; printf("Test SPI STMPE610\n\r") ; while (true) { touched = TSC.getRAWPoint(&x, &y, &z) ; if (touched) { printf("x = %d, y = %d, z = %d\n\r", x, y, z) ; } wait(0.1) ; } }
Definition at line 57 of file SPI_STMPE610.h.
Constructor & Destructor Documentation
| SPI_STMPE610 | ( | PinName | mosi, |
| PinName | miso, | ||
| PinName | sclk, | ||
| PinName | cs | ||
| ) |
STMPE610 constructor.
- Parameters:
-
mosi SPI_MOSI pin miso SPI_MISO pin sclk SPI_CLK pin cs SPI_CS pin
Definition at line 135 of file SPI_STMPE610.cpp.
| ~SPI_STMPE610 | ( | ) |
Destructor.
Definition at line 163 of file SPI_STMPE610.cpp.
Member Function Documentation
| int getPoint | ( | uint16_t * | x, |
| uint16_t * | y, | ||
| uint16_t * | z = 0 |
||
| ) |
get value of x, y, z
- Parameters:
-
*x x value relative to TFT *y y value relative to TFT *z z RAW value if non-null pointer is passed
- Note:
- default calibration was for my particular device
- for more accuracy measure your device and modify
- those values in SPI_STMPE610.c
Definition at line 260 of file SPI_STMPE610.cpp.
| int getRAWPoint | ( | uint16_t * | x, |
| uint16_t * | y, | ||
| uint16_t * | z | ||
| ) |
get RAW value of x, y, z
- Parameters:
-
*x raw value of x *y raw value of y *z raw value of z
- Returns:
- if touched
- Note:
- For my device usually the value seems to be between 300 ~ 3000
- when it fails to acquire value the value of 0 seems to be returned
Definition at line 227 of file SPI_STMPE610.cpp.
| void spi_format | ( | int | bits, |
| int | mode | ||
| ) |
specify spi format from this class
- Parameters:
-
bits number of bits per spi frame mode clock polarity and phase mode
- Note:
- please refer to the spi class for more details
Definition at line 222 of file SPI_STMPE610.cpp.
| void spi_frequency | ( | unsigned long | freq ) |
specify spi frequency from this class
- Parameters:
-
freq frequency in Hz
Definition at line 217 of file SPI_STMPE610.cpp.
Generated on Tue Jul 12 2022 19:25:25 by
1.7.2