28 #include <mraa/gpio.h>
30 #define PCA9685_I2C_BUS 0
31 #define PCA9685_DEFAULT_I2C_ADDR 0x60
33 #define PCA9685_INTERNAL_OSC 25000000.0
37 #define PCA9685_ALL_LED 0xff
72 typedef enum { REG_MODE1 = 0x00,
82 REG_LED0_OFF_L = 0x08,
83 REG_LED0_OFF_H = 0x09,
86 REG_LED1_OFF_L = 0x0c,
87 REG_LED1_OFF_H = 0x0d,
90 REG_LED2_OFF_L = 0x10,
91 REG_LED2_OFF_H = 0x11,
94 REG_LED3_OFF_L = 0x14,
95 REG_LED3_OFF_H = 0x15,
98 REG_LED4_OFF_L = 0x18,
99 REG_LED4_OFF_H = 0x19,
100 REG_LED5_ON_L = 0x1a,
101 REG_LED5_ON_H = 0x1b,
102 REG_LED5_OFF_L = 0x1c,
103 REG_LED5_OFF_H = 0x1d,
104 REG_LED6_ON_L = 0x1e,
105 REG_LED6_ON_H = 0x1f,
106 REG_LED6_OFF_L = 0x20,
107 REG_LED6_OFF_H = 0x21,
108 REG_LED7_ON_L = 0x22,
109 REG_LED7_ON_H = 0x23,
110 REG_LED7_OFF_L = 0x24,
111 REG_LED7_OFF_H = 0x25,
112 REG_LED8_ON_L = 0x26,
113 REG_LED8_ON_H = 0x27,
114 REG_LED8_OFF_L = 0x28,
115 REG_LED8_OFF_H = 0x29,
116 REG_LED9_ON_L = 0x2a,
117 REG_LED9_ON_H = 0x2b,
118 REG_LED9_OFF_L = 0x2c,
119 REG_LED9_OFF_H = 0x2d,
120 REG_LED10_ON_L = 0x2e,
121 REG_LED10_ON_H = 0x2f,
122 REG_LED10_OFF_L = 0x30,
123 REG_LED10_OFF_H = 0x31,
124 REG_LED11_ON_L = 0x32,
125 REG_LED11_ON_H = 0x33,
126 REG_LED11_OFF_L = 0x34,
127 REG_LED11_OFF_H = 0x35,
128 REG_LED12_ON_L = 0x36,
129 REG_LED12_ON_H = 0x37,
130 REG_LED12_OFF_L = 0x38,
131 REG_LED12_OFF_H = 0x39,
132 REG_LED13_ON_L = 0x3a,
133 REG_LED13_ON_H = 0x3b,
134 REG_LED13_OFF_L = 0x3c,
135 REG_LED13_OFF_H = 0x3d,
136 REG_LED14_ON_L = 0x3e,
137 REG_LED14_ON_H = 0x3f,
138 REG_LED14_OFF_L = 0x40,
139 REG_LED14_OFF_H = 0x41,
140 REG_LED15_ON_L = 0x42,
141 REG_LED15_ON_H = 0x43,
142 REG_LED15_OFF_L = 0x44,
143 REG_LED15_OFF_H = 0x45,
146 REG_ALL_LED_ON_L = 0xfa,
147 REG_ALL_LED_ON_H = 0xfb,
148 REG_ALL_LED_OFF_L = 0xfc,
149 REG_ALL_LED_OFF_H = 0xfd,
157 typedef enum { MODE1_ALL_CALL = 0x01,
170 typedef enum { MODE2_OUTNE0 = 0x01,
175 MODE2_RESERVE0 = 0x20,
176 MODE2_RESERVE1 = 0x40,
177 MODE2_RESERVE2 = 0x80
186 PCA9685(
int bus, uint8_t address = PCA9685_DEFAULT_I2C_ADDR,
bool raw =
false);
200 bool writeByte(uint8_t reg, uint8_t byte);
210 bool writeWord(uint8_t reg, uint16_t word);
264 bool ledOnTime(uint8_t led, uint16_t time);
294 float oscFreq=PCA9685_INTERNAL_OSC);
312 bool enableAutoIncrement(
bool ai);
314 bool m_restartEnabled;
315 mraa_i2c_context m_i2c;
bool ledOffTime(uint8_t led, uint16_t time)
Definition: pca9685.cxx:250
uint16_t readWord(uint8_t reg)
Definition: pca9685.cxx:113
PCA9685_MODE1_T
Definition: pca9685.h:157
bool ledFullOn(uint8_t led, bool val)
Definition: pca9685.cxx:161
PCA9685_MODE2_T
Definition: pca9685.h:170
void enableRestart(bool enabled)
Definition: pca9685.h:302
bool setPrescaleFromHz(float hz, float oscFreq=PCA9685_INTERNAL_OSC)
Definition: pca9685.cxx:289
uint8_t readByte(uint8_t reg)
Definition: pca9685.cxx:108
bool ledOnTime(uint8_t led, uint16_t time)
Definition: pca9685.cxx:217
bool writeByte(uint8_t reg, uint8_t byte)
Definition: pca9685.cxx:80
API for the PCA9685 16-channel, 12-bit PWM LED Controller.
Definition: pca9685.h:66
bool setPrescale(uint8_t prescale)
Definition: pca9685.cxx:283
bool writeWord(uint8_t reg, uint16_t word)
Definition: pca9685.cxx:94
PCA9685(int bus, uint8_t address=PCA9685_DEFAULT_I2C_ADDR, bool raw=false)
Definition: pca9685.cxx:37
bool ledFullOff(uint8_t led, bool val)
Definition: pca9685.cxx:189
bool setModeSleep(bool sleep)
Definition: pca9685.cxx:118
~PCA9685()
Definition: pca9685.cxx:74
PCA9685_REG_T
Definition: pca9685.h:72