STMPE610 touch sensor driver library
Dependents: TS_Eyes Tokei testUniGraphic_150217 AfficheurTFTAdafruit ... more
Revision 14:6740dfc84a8c, committed 2017-04-11
- Comitter:
- Rhyme
- Date:
- Tue Apr 11 05:12:47 2017 +0000
- Parent:
- 13:09fece599665
- Commit message:
- Support of MAX32600 added
Changed in this revision
SPI_STMPE610.cpp | Show annotated file Show diff for this revision Revisions of this file |
SPI_STMPE610.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 09fece599665 -r 6740dfc84a8c SPI_STMPE610.cpp --- a/SPI_STMPE610.cpp Thu Nov 26 00:38:55 2015 +0000 +++ b/SPI_STMPE610.cpp Tue Apr 11 05:12:47 2017 +0000 @@ -138,7 +138,7 @@ m_cs = 0 ; _mode = 0 ; m_spi.frequency(1000000) ; -#if defined (TARGET_NUCLEO_F411RE) || defined (TARGET_KL46Z) +#if defined (TARGET_NUCLEO_F411RE) || defined (TARGET_KL46Z) || defined (TARGET_MAX32600MBED) m_spi.format(8, 1) ; /* works with st nucleo F411RE */ #else m_spi.format(8, 0) ; /* works with freescale FRDMs */ @@ -214,6 +214,11 @@ return( value ) ; } +void SPI_STMPE610::spi_frequency(unsigned long freq) +{ + m_spi.frequency(freq) ; +} + void SPI_STMPE610::spi_format(int bits, int mode) { m_spi.format(bits, mode) ; @@ -231,6 +236,8 @@ readRegs(REG_TSC_CTRL, data, 1) ; touched = data[0] & 0x80 ; + + data[0] = 0 ; data[1] = 0 ; data[2] = 0 ; data[3] = 0 ; data[4] = 0 ; readRegs(REG_TSC_DATA_X, data,5) ; *x = (data[0] << 8) | data[1] ;
diff -r 09fece599665 -r 6740dfc84a8c SPI_STMPE610.h --- a/SPI_STMPE610.h Thu Nov 26 00:38:55 2015 +0000 +++ b/SPI_STMPE610.h Tue Apr 11 05:12:47 2017 +0000 @@ -87,7 +87,13 @@ void write8(int addr, uint8_t data) ; uint16_t read16(int addr) ; void write16(int addr, uint16_t data) ; - + + /** + * specify spi frequency from this class + * @param freq frequency in Hz + */ + void spi_frequency(unsigned long freq) ; + /** * specify spi format from this class * @param bits number of bits per spi frame