Driver for the AT42QT1070

Revision:
2:cee8b532fc22
Parent:
1:38001f05dab3
--- a/src/at42qt1070.cpp	Sun Dec 20 19:38:45 2015 +0000
+++ b/src/at42qt1070.cpp	Tue Dec 22 21:45:00 2015 +0000
@@ -29,18 +29,16 @@
 
 #include "at42qt1070.h"
 
-using namespace upm;
 using namespace std;
 
 const uint8_t AVE_KEY_MAX = 6;
 const uint8_t AKS_KEY_MAX = 3;
  
 
-AT42QT1070::AT42QT1070(PinName sda, PinName scl, int bus, uint8_t address):
-_i2cPort(sda, scl)
+AT42QT1070::AT42QT1070(PinName sda, PinName scl, uint8_t address)
+    :_i2cPort(sda, scl),
+    _addr(address<<1)
 {
-    _addr = address;
-
     _i2cPort.frequency(400000);
 
     if (readChipID() != 0x2E) {
@@ -48,8 +46,8 @@
     }
 
     _buttonStates = 0;
-    _calibrating = false;
-    _overflow = false;
+    _calibrating  = false;
+    _overflow     = false;
 }
 
 //--------------------------------------------------------------------------------
@@ -85,7 +83,7 @@
 {    
     char data = 0;
     const char cmd = reg;
-    _i2cPort.write(_addr, &cmd, 1, true );
+    _i2cPort.write(_addr, &cmd, 1);
     _i2cPort.read(_addr, &data, 1);
     
     return data;
@@ -98,7 +96,7 @@
     char data[]  = {0, 0};
     const char cmd = reg;
     
-    _i2cPort.write(_addr, &cmd, 1, true );
+    _i2cPort.write(_addr, &cmd, 1);
     _i2cPort.read(_addr, data, 2);  
     res = data[1]<<8 & data[0];