Modified I2C api to work with NRF's dynamic pin asignment.

Dependents:   Seed_Barometer_Sensor_custom_I2C_lib

Note that the only changes are in the constructor. I tried extending the original I2C class, but could not find away to avoid the i2c_init from being called there.

Files at this revision

API Documentation at this revision

Comitter:
jaerts
Date:
Wed Oct 22 11:18:05 2014 +0000
Parent:
1:6e73259cca6e
Commit message:
Reset after changing pins on init

Changed in this revision

I2CX.cpp Show annotated file Show diff for this revision Revisions of this file
I2CX.h Show annotated file Show diff for this revision Revisions of this file
--- a/I2CX.cpp	Wed Oct 22 10:32:42 2014 +0000
+++ b/I2CX.cpp	Wed Oct 22 11:18:05 2014 +0000
@@ -37,6 +37,8 @@
     _i2c.sda = sda;
     _i2c.scl = scl;
     
+    i2c_reset(&_i2c);
+    
     // Used to avoid unnecessary frequency updates
     _owner = this;
 }
--- a/I2CX.h	Wed Oct 22 10:32:42 2014 +0000
+++ b/I2CX.h	Wed Oct 22 11:18:05 2014 +0000
@@ -29,11 +29,12 @@
  * Example:
  * @code
  * // Read from I2C slave at address 0x62
- *
+ *  
  * #include "mbed.h"
- *
- * I2C i2c(I2C_0, p28, p27);
- *
+ * #include "I2CX.h"
+ *  
+ * I2CX i2c(I2C_0, p28, p27);
+ *  
  * int main() {
  *     int address = 0x62;
  *     char data[2];