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.
VL6180XA1/STMPE1600/STMPE1600.cpp@0:293917667c17, 2019-03-21 (annotated)
- Committer:
- ThunderSoft
- Date:
- Thu Mar 21 09:19:56 2019 +0000
- Revision:
- 0:293917667c17
Add VL6180XA1's code for TT_Mxx
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ThunderSoft | 0:293917667c17 | 1 | #include "STMPE1600.h" |
| ThunderSoft | 0:293917667c17 | 2 | #include "common_define.h" |
| ThunderSoft | 0:293917667c17 | 3 | |
| ThunderSoft | 0:293917667c17 | 4 | |
| ThunderSoft | 0:293917667c17 | 5 | |
| ThunderSoft | 0:293917667c17 | 6 | STMPE1600::STMPE1600 (I2C *i2c, uint8_t DevAddr) : _dev_i2c(i2c) , address(DevAddr) |
| ThunderSoft | 0:293917667c17 | 7 | { |
| ThunderSoft | 0:293917667c17 | 8 | write_sys_ctrl (SOFT_RESET); |
| ThunderSoft | 0:293917667c17 | 9 | _gpdro_15 = (uint16_t)0; // gpio dir all IN |
| ThunderSoft | 0:293917667c17 | 10 | write_16_bit_reg (GPDR_0_7, &_gpdro_15); |
| ThunderSoft | 0:293917667c17 | 11 | _gpsro_15 = (uint16_t)0x0ffff; // gpio status all 1 |
| ThunderSoft | 0:293917667c17 | 12 | write_16_bit_reg (GPSR_0_7, &_gpsro_15); |
| ThunderSoft | 0:293917667c17 | 13 | } |
| ThunderSoft | 0:293917667c17 | 14 | |
| ThunderSoft | 0:293917667c17 | 15 | |
| ThunderSoft | 0:293917667c17 | 16 | void STMPE1600::read(uint8_t* pBuffer, uint8_t RegisterAddr, uint16_t NumByteToRead) |
| ThunderSoft | 0:293917667c17 | 17 | { |
| ThunderSoft | 0:293917667c17 | 18 | i2cRead(_dev_i2c,address,pBuffer,RegisterAddr,NumByteToRead); |
| ThunderSoft | 0:293917667c17 | 19 | } |
| ThunderSoft | 0:293917667c17 | 20 | |
| ThunderSoft | 0:293917667c17 | 21 | void STMPE1600::write(uint8_t* pBuffer, uint8_t RegisterAddr, uint16_t NumByteToWrite) |
| ThunderSoft | 0:293917667c17 | 22 | { |
| ThunderSoft | 0:293917667c17 | 23 | i2cWrite(_dev_i2c,address,pBuffer,RegisterAddr,NumByteToWrite); |
| ThunderSoft | 0:293917667c17 | 24 | } |
| ThunderSoft | 0:293917667c17 | 25 | |
| ThunderSoft | 0:293917667c17 | 26 | uint8_t STMPE1600::readID() |
| ThunderSoft | 0:293917667c17 | 27 | { |
| ThunderSoft | 0:293917667c17 | 28 | uint8_t device_id; |
| ThunderSoft | 0:293917667c17 | 29 | read(&device_id,VersionId,1); |
| ThunderSoft | 0:293917667c17 | 30 | return device_id; |
| ThunderSoft | 0:293917667c17 | 31 | } |
| ThunderSoft | 0:293917667c17 | 32 | |
| ThunderSoft | 0:293917667c17 | 33 |