|
PCA9685 Driver 0.1.0
API reference
|
PCA9685 register map: addresses, bit fields and reset values (datasheet section 7.3). More...
Go to the source code of this file.
Namespaces | |
| namespace | pca9685 |
The PCA9685 driver: everything it declares lives here; internals in detail. | |
| namespace | pca9685::reg |
| The PCA9685 register map. | |
Typedefs | |
| using | pca9685::reg::Mode2Outne = detail::Field< uint8_t, 0U, 2U > |
| MODE2.OUTNE[1:0], the level of every output while OE is high (table 11). | |
Functions | |
| constexpr uint8_t | pca9685::reg::ChannelBase (uint32_t channel) noexcept |
| The address of LEDn_ON_L of a channel (table 4). | |
Variables | |
| constexpr uint8_t | pca9685::reg::kMode1 = 0x00 |
| MODE1 (R/W): restart, clock, AI, sleep, group calls. | |
| constexpr uint8_t | pca9685::reg::kMode2 = 0x01 |
| MODE2 (R/W): output inversion, change, drive, OE. | |
| constexpr uint8_t | pca9685::reg::kSubAdr1 = 0x02 |
| SUBADR1 (R/W): I2C subaddress 1 (section 7.3.6). | |
| constexpr uint8_t | pca9685::reg::kSubAdr2 = 0x03 |
| SUBADR2 (R/W): I2C subaddress 2. | |
| constexpr uint8_t | pca9685::reg::kSubAdr3 = 0x04 |
| SUBADR3 (R/W): I2C subaddress 3. | |
| constexpr uint8_t | pca9685::reg::kAllCallAdr = 0x05 |
| ALLCALLADR (R/W): LED All Call address (7.3.7). | |
| constexpr uint8_t | pca9685::reg::kLed0OnL = 0x06 |
| LED0_ON_L (R/W): first of 16 x 4 channel bytes. | |
| constexpr uint8_t | pca9685::reg::kLed15OffH = 0x45 |
| LED15_OFF_H (R/W): the last channel byte. | |
| constexpr uint8_t | pca9685::reg::kAllLedOnL = 0xFA |
| ALL_LED_ON_L (W): loads every LEDn_ON_L (7.3.4). | |
| constexpr uint8_t | pca9685::reg::kAllLedOffH = 0xFD |
| ALL_LED_OFF_H (W): loads every LEDn_OFF_H. | |
| constexpr uint8_t | pca9685::reg::kPreScale = 0xFE |
| PRE_SCALE (R/W): PWM frequency; written in SLEEP. | |
| constexpr uint8_t | pca9685::reg::kBytesPerChannel = 4 |
| Bytes per channel: ON_L, ON_H, OFF_L, OFF_H (table 7). | |
| constexpr uint8_t | pca9685::reg::kChannels = 16 |
| Number of LED channels. | |
| constexpr uint8_t | pca9685::reg::kSubAdrReadOnly = 0x01 |
| SUBADR1 to 3 and ALLCALLADR bit 0: read only, reads 0 (tables 9, 10). | |
| constexpr uint8_t | pca9685::reg::kSubAdr1Reset = 0xE2 |
| SUBADR1 after a reset (table 9). | |
| constexpr uint8_t | pca9685::reg::kMode1Restart = 1U << 7 |
| constexpr uint8_t | pca9685::reg::kMode1ExtClk = 1U << 6 |
| EXTCLK: use the EXTCLK pin; sticky. | |
| constexpr uint8_t | pca9685::reg::kMode1Ai = 1U << 5 |
| AI: register auto-increment. | |
| constexpr uint8_t | pca9685::reg::kMode1Sleep = 1U << 4 |
| SLEEP: oscillator off, low-power mode. | |
| constexpr uint8_t | pca9685::reg::kMode1Sub1 = 1U << 3 |
| SUB1: answer I2C subaddress 1. | |
| constexpr uint8_t | pca9685::reg::kMode1Sub2 = 1U << 2 |
| SUB2: answer I2C subaddress 2. | |
| constexpr uint8_t | pca9685::reg::kMode1Sub3 = 1U << 1 |
| SUB3: answer I2C subaddress 3. | |
| constexpr uint8_t | pca9685::reg::kMode1AllCall = 1U << 0 |
| constexpr uint8_t | pca9685::reg::kMode1Reset = 0x11 |
| MODE1 after a power-on or software reset: SLEEP and ALLCALL set (table 5). | |
| constexpr uint8_t | pca9685::reg::kMode2Reserved = 0xE0 |
| Bits 7..5: reserved, read only, read 0. | |
| constexpr uint8_t | pca9685::reg::kMode2Invrt = 1U << 4 |
| INVRT: output logic inverted (OE = 0 only). | |
| constexpr uint8_t | pca9685::reg::kMode2Och = 1U << 3 |
| OCH: outputs change on ACK, not on STOP. | |
| constexpr uint8_t | pca9685::reg::kMode2OutDrv = 1U << 2 |
| constexpr uint8_t | pca9685::reg::kMode2Reset = 0x04 |
| MODE2 after a reset: change on STOP, totem pole, not inverted, LEDn = 0 when OE = 1. | |
| constexpr uint32_t | pca9685::reg::kOutneLow = 0U |
| OUTNE = 00: LEDn = 0. | |
| constexpr uint32_t | pca9685::reg::kOutneHigh |
| OUTNE = 01: LEDn = 1 (totem pole), Hi-Z (open drain). | |
| constexpr uint32_t | pca9685::reg::kOutneHiZ = 2U |
| OUTNE = 10: LEDn = high impedance. | |
| constexpr uint8_t | pca9685::reg::kLedHReserved = 0xE0 |
| Bits 7..5 of the _H bytes: read only, read 0. | |
| constexpr uint8_t | pca9685::reg::kLedFull = 1U << 4 |
| Bit 4: full ON (ON_H) or full OFF (OFF_H). | |
| constexpr uint8_t | pca9685::reg::kLedCountHigh = 0x0F |
| constexpr uint16_t | pca9685::reg::kMaxCount = 4095 |
| Highest LEDn_ON and LEDn_OFF count: the 12-bit counter runs 0 to 4095 (section 7.3.3). | |
| constexpr uint8_t | pca9685::reg::kLedOffHReset = 0x10 |
| LEDn_OFF_H after a reset: full OFF (table 7). The other three bytes reset to 0. | |
| constexpr uint8_t | pca9685::reg::kPreScaleReset = 0x1E |
| 30: about 200 Hz from the 25 MHz oscillator. | |
| constexpr uint8_t | pca9685::reg::kPreScaleMin = 3 |
| The hardware forces at least 3 (1526 Hz). | |
PCA9685 register map: addresses, bit fields and reset values (datasheet section 7.3).
Registers are 8 bits wide. The control register (the first byte after the address) points at one; with MODE1.AI set the pointer moves to the next register after every byte, from LED15_OFF_H (0x45) back to MODE1 and from PRE_SCALE (0xFE) back to MODE1 (table 4, remark). With AI clear every byte of a transfer goes to, or comes from, the same register. Addresses 0x46 to 0xF9 are reserved and not acknowledged; 0xFF (TestMode) is reserved and never touched by the driver.
Section, table and figure numbers refer to the NXP PCA9685 product data sheet, Rev. 4 (16 April 2015).