MAX14690 Library

Dependents:   MAX32630HSP3_IMU_HelloWorld MAX32630HSP3_IMU_HelloWorld max32630fthr max4146x_comp ... more

Fork of MAX14690 by Greg Steiert

Files at this revision

API Documentation at this revision

Comitter:
switches
Date:
Mon Oct 16 19:41:16 2017 +0000
Parent:
14:cbd2a00ff28f
Commit message:
Changed I2C to pointer

Changed in this revision

MAX14690.cpp Show annotated file Show diff for this revision Revisions of this file
MAX14690.h Show annotated file Show diff for this revision Revisions of this file
diff -r cbd2a00ff28f -r 264f38840873 MAX14690.cpp
--- a/MAX14690.cpp	Tue Jul 11 18:27:54 2017 +0000
+++ b/MAX14690.cpp	Mon Oct 16 19:41:16 2017 +0000
@@ -34,7 +34,7 @@
 #include "MAX14690.h"
 
 //******************************************************************************
-MAX14690::MAX14690(I2C &i2c): _i2c(i2c)
+MAX14690::MAX14690(I2C *i2c): _i2c(i2c)
 {
     resetToDefaults();
 }
@@ -310,7 +310,7 @@
 {
     char cmdData[2] = { (char)reg, value };
 
-    if (_i2c.write(MAX14690_I2C_ADDR, cmdData, sizeof(cmdData)) != 0) {
+    if ((*_i2c).write(MAX14690_I2C_ADDR, cmdData, sizeof(cmdData)) != 0) {
         return MAX14690_ERROR;
     }
 
@@ -322,11 +322,11 @@
 {
     char cmdData[1] = { (char)reg };
 
-    if (_i2c.write(MAX14690_I2C_ADDR, cmdData, sizeof(cmdData)) != 0) {
+    if ((*_i2c).write(MAX14690_I2C_ADDR, cmdData, sizeof(cmdData)) != 0) {
         return MAX14690_ERROR;
     }
 
-    if (_i2c.read(MAX14690_I2C_ADDR, value, 1) != 0) {
+    if ((*_i2c).read(MAX14690_I2C_ADDR, value, 1) != 0) {
         return MAX14690_ERROR;
     }
 
diff -r cbd2a00ff28f -r 264f38840873 MAX14690.h
--- a/MAX14690.h	Tue Jul 11 18:27:54 2017 +0000
+++ b/MAX14690.h	Mon Oct 16 19:41:16 2017 +0000
@@ -352,7 +352,7 @@
     	*
     	* @param i2c I2C object to use.
     	*/
-    MAX14690(I2C &i2c);
+    MAX14690(I2C *i2c);
 
     /**
     	* MAX14690 destructor.
@@ -552,7 +552,7 @@
 
 private:
     // Internal Resources
-    I2C &_i2c;
+    I2C *_i2c;
 
     /**
      * @brief   Converts mV to register bits