Library for interfacing with the NXP PCA9685 PWM controller over an I2C connection. Designed with the Adafruit breakout board (of the same name) in mind.

Revision:
5:d44f88fa27a1
Parent:
4:3bcda7deb098
--- a/PCA9685.cpp	Tue May 10 12:14:55 2016 +0000
+++ b/PCA9685.cpp	Sat Jun 22 17:24:38 2019 +0000
@@ -7,7 +7,7 @@
 #include "definitions.h"
 
 
-PCA9685::PCA9685(uint8_t i2c_address, I2C i2c_object, float frequency) :
+PCA9685::PCA9685(uint8_t i2c_address, I2C *i2c_object, float frequency) :
 
     i2c_addr(i2c_address),
     freq(frequency),
@@ -68,7 +68,7 @@
     msg[3] = count_off;
     msg[4] = count_off >> 8;
 
-    i2c.write(i2c_addr, msg, 5);
+    i2c->write(i2c_addr, msg, 5);
 
 }
 
@@ -81,7 +81,7 @@
     msg[1] = count_off;
     msg[2] = count_off >> 8;
 
-    i2c.write(i2c_addr,msg,3);
+    i2c->write(i2c_addr,msg,3);
 
 }
 
@@ -123,7 +123,7 @@
 void PCA9685::update(void)
 {
 
-    i2c.stop();
+    i2c->stop();
 
 }
 
@@ -135,7 +135,7 @@
     char send[2]; //Store the address and data in an array
     send[0] = reg;
     send[1] = msg;
-    i2c.write(i2c_addr, send, 2);
+    i2c->write(i2c_addr, send, 2);
 
 }
 
@@ -144,9 +144,9 @@
 
     char send[1] ;
     send[0] = reg;
-    i2c.write(i2c_addr, send, 1);
+    i2c->write(i2c_addr, send, 1);
     char recieve[1];
-    i2c.read(i2c_addr, recieve, 1);
+    i2c->read(i2c_addr, recieve, 1);
     return recieve[0];
 
 }