Creating a project about VL6180XA1 for TT_Mxx

Committer:
ThunderSoft
Date:
Fri Apr 26 09:34:53 2019 +0000
Revision:
3:7a97a01bad5e
Parent:
0:293917667c17
"update the mbed-os code to support TT_M4G9"

Who changed what in which revision?

UserRevisionLine numberNew 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