RegForge

All parts / PCA9685

PCA9685 register map

16-channel 12-bit PWM LED and servo controller with I2C — NXP Semiconductors

76 registers I2C I²C 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F 8-bit reg addresses 61% bit coverage not yet human-verified
I²C address conflict. On its default address(es) this part collides with ADS1115 (0x48, 0x49, 0x4A, 0x4B); ADXL345 (0x53); BME280 (0x76, 0x77); BMP280 (0x76, 0x77); DS1307 (0x68); DS3231 (0x68); INA219 (0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F); INA226 (0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F); MPU6050 (0x68, 0x69). You cannot put them on the same bus without changing a strap pin, using an I²C multiplexer, or moving one to a second bus. See the full address map.

Get it as a C header

pip install regforge
regforge gen PCA9685 --out ./src --driver --tests

Writes pca9685_regs.h with every address, mask and shift below, a bus-agnostic driver skeleton, and a file of compile-time assertions that make your compiler check the bit arithmetic. No API key needed — this part ships inside the package.

Not yet human-verified. Transcribed and mechanically validated — no overlapping fields, no out-of-range bits, reset values consistent with their fields — but not yet checked line-by-line against the datasheet. Verifying it is a useful half hour.

Registers

AddrRegisterAccessWidthResetDescription
0x00MODE1RW80x11Mode register 1. Note the reset value: SLEEP is set, so the internal oscillator is off and no PWM is produced until you clear it.
0x01MODE2RW80x04Mode register 2: output drive and inversion
0x02SUBADR1RW80xE2I2C subaddress 1
0x03SUBADR2RW80xE4I2C subaddress 2
0x04SUBADR3RW80xE8I2C subaddress 3
0x05ALLCALLADRRW80xE0LED All Call I2C address
0x06LED0_ON_LRW80x00Channel 0 turn-on count, bits [7:0]
0x07LED0_ON_HRW80x00Channel 0 turn-on count bits [11:8], plus the full-ON bit
0x08LED0_OFF_LRW80x00Channel 0 turn-off count, bits [7:0]
0x09LED0_OFF_HRW80x00Channel 0 turn-off count bits [11:8], plus the full-OFF bit
0x0ALED1_ON_LRW80x00Channel 1 turn-on count, bits [7:0]
0x0BLED1_ON_HRW80x00Channel 1 turn-on count bits [11:8], plus the full-ON bit
0x0CLED1_OFF_LRW80x00Channel 1 turn-off count, bits [7:0]
0x0DLED1_OFF_HRW80x00Channel 1 turn-off count bits [11:8], plus the full-OFF bit
0x0ELED2_ON_LRW80x00Channel 2 turn-on count, bits [7:0]
0x0FLED2_ON_HRW80x00Channel 2 turn-on count bits [11:8], plus the full-ON bit
0x10LED2_OFF_LRW80x00Channel 2 turn-off count, bits [7:0]
0x11LED2_OFF_HRW80x00Channel 2 turn-off count bits [11:8], plus the full-OFF bit
0x12LED3_ON_LRW80x00Channel 3 turn-on count, bits [7:0]
0x13LED3_ON_HRW80x00Channel 3 turn-on count bits [11:8], plus the full-ON bit
0x14LED3_OFF_LRW80x00Channel 3 turn-off count, bits [7:0]
0x15LED3_OFF_HRW80x00Channel 3 turn-off count bits [11:8], plus the full-OFF bit
0x16LED4_ON_LRW80x00Channel 4 turn-on count, bits [7:0]
0x17LED4_ON_HRW80x00Channel 4 turn-on count bits [11:8], plus the full-ON bit
0x18LED4_OFF_LRW80x00Channel 4 turn-off count, bits [7:0]
0x19LED4_OFF_HRW80x00Channel 4 turn-off count bits [11:8], plus the full-OFF bit
0x1ALED5_ON_LRW80x00Channel 5 turn-on count, bits [7:0]
0x1BLED5_ON_HRW80x00Channel 5 turn-on count bits [11:8], plus the full-ON bit
0x1CLED5_OFF_LRW80x00Channel 5 turn-off count, bits [7:0]
0x1DLED5_OFF_HRW80x00Channel 5 turn-off count bits [11:8], plus the full-OFF bit
0x1ELED6_ON_LRW80x00Channel 6 turn-on count, bits [7:0]
0x1FLED6_ON_HRW80x00Channel 6 turn-on count bits [11:8], plus the full-ON bit
0x20LED6_OFF_LRW80x00Channel 6 turn-off count, bits [7:0]
0x21LED6_OFF_HRW80x00Channel 6 turn-off count bits [11:8], plus the full-OFF bit
0x22LED7_ON_LRW80x00Channel 7 turn-on count, bits [7:0]
0x23LED7_ON_HRW80x00Channel 7 turn-on count bits [11:8], plus the full-ON bit
0x24LED7_OFF_LRW80x00Channel 7 turn-off count, bits [7:0]
0x25LED7_OFF_HRW80x00Channel 7 turn-off count bits [11:8], plus the full-OFF bit
0x26LED8_ON_LRW80x00Channel 8 turn-on count, bits [7:0]
0x27LED8_ON_HRW80x00Channel 8 turn-on count bits [11:8], plus the full-ON bit
0x28LED8_OFF_LRW80x00Channel 8 turn-off count, bits [7:0]
0x29LED8_OFF_HRW80x00Channel 8 turn-off count bits [11:8], plus the full-OFF bit
0x2ALED9_ON_LRW80x00Channel 9 turn-on count, bits [7:0]
0x2BLED9_ON_HRW80x00Channel 9 turn-on count bits [11:8], plus the full-ON bit
0x2CLED9_OFF_LRW80x00Channel 9 turn-off count, bits [7:0]
0x2DLED9_OFF_HRW80x00Channel 9 turn-off count bits [11:8], plus the full-OFF bit
0x2ELED10_ON_LRW80x00Channel 10 turn-on count, bits [7:0]
0x2FLED10_ON_HRW80x00Channel 10 turn-on count bits [11:8], plus the full-ON bit
0x30LED10_OFF_LRW80x00Channel 10 turn-off count, bits [7:0]
0x31LED10_OFF_HRW80x00Channel 10 turn-off count bits [11:8], plus the full-OFF bit
0x32LED11_ON_LRW80x00Channel 11 turn-on count, bits [7:0]
0x33LED11_ON_HRW80x00Channel 11 turn-on count bits [11:8], plus the full-ON bit
0x34LED11_OFF_LRW80x00Channel 11 turn-off count, bits [7:0]
0x35LED11_OFF_HRW80x00Channel 11 turn-off count bits [11:8], plus the full-OFF bit
0x36LED12_ON_LRW80x00Channel 12 turn-on count, bits [7:0]
0x37LED12_ON_HRW80x00Channel 12 turn-on count bits [11:8], plus the full-ON bit
0x38LED12_OFF_LRW80x00Channel 12 turn-off count, bits [7:0]
0x39LED12_OFF_HRW80x00Channel 12 turn-off count bits [11:8], plus the full-OFF bit
0x3ALED13_ON_LRW80x00Channel 13 turn-on count, bits [7:0]
0x3BLED13_ON_HRW80x00Channel 13 turn-on count bits [11:8], plus the full-ON bit
0x3CLED13_OFF_LRW80x00Channel 13 turn-off count, bits [7:0]
0x3DLED13_OFF_HRW80x00Channel 13 turn-off count bits [11:8], plus the full-OFF bit
0x3ELED14_ON_LRW80x00Channel 14 turn-on count, bits [7:0]
0x3FLED14_ON_HRW80x00Channel 14 turn-on count bits [11:8], plus the full-ON bit
0x40LED14_OFF_LRW80x00Channel 14 turn-off count, bits [7:0]
0x41LED14_OFF_HRW80x00Channel 14 turn-off count bits [11:8], plus the full-OFF bit
0x42LED15_ON_LRW80x00Channel 15 turn-on count, bits [7:0]
0x43LED15_ON_HRW80x00Channel 15 turn-on count bits [11:8], plus the full-ON bit
0x44LED15_OFF_LRW80x00Channel 15 turn-off count, bits [7:0]
0x45LED15_OFF_HRW80x00Channel 15 turn-off count bits [11:8], plus the full-OFF bit
0xFAALL_LED_ON_LWO8—Turn-on count for all channels, bits [7:0]
0xFBALL_LED_ON_HWO8—Turn-on count for all channels, bits [11:8] and full-ON
0xFCALL_LED_OFF_LWO8—Turn-off count for all channels, bits [7:0]
0xFDALL_LED_OFF_HWO8—Turn-off count for all channels, bits [11:8] and full-OFF
0xFEPRESCALERW80x1EPWM frequency prescaler. Writable only while MODE1.SLEEP is set. prescale = round(osc_clock / (4096 * pwm_freq)) - 1; the 0x1E default is 200 Hz with the internal 25 MHz oscillator.
0xFFTESTMODERW8—Factory test mode. Do not write.

Bit layouts

Drawn MSB-first, the way the datasheet draws them. [7:5] means shift 5, width 3, mask 0xE0 — this is the notation that costs people a day when they read it backwards.

MODE1  @  0x00  —  8 fields
RESTART[7]
EXTCLK[6]
AI[5]
SLEEP[4]
SUB1[3]
SUB2[2]
SUB3[1]
ALLCALL[0]
BitsFieldAccessMaskResetDescription
[7]RESTARTRW1C0x800x00Reads 1 when a restart is required; write 1 to clear
[6]EXTCLKRW0x400x00Use an external clock. Sticky until power cycle or SWRST.
[5]AIRW0x200x00Register auto-increment enable
[4]SLEEPRW0x100x01Low-power mode, oscillator off. Set at reset.
[3]SUB1RW0x080x00Respond to I2C subaddress 1
[2]SUB2RW0x040x00Respond to I2C subaddress 2
[1]SUB3RW0x020x00Respond to I2C subaddress 3
[0]ALLCALLRW0x010x01Respond to the LED All Call address
MODE2  @  0x01  —  4 fields
—7
—6
—5
INVRT[4]
OCH[3]
OUTDRV[2]
OUTNE[1:0]
BitsFieldAccessMaskResetDescription
[4]INVRTRW0x100x00Invert the output logic state
[3]OCHRW0x080x000 = outputs change on STOP, 1 = on ACK
[2]OUTDRVRW0x040x010 = open drain, 1 = totem pole
[1:0]OUTNERW0x030x00Output state when OE is high

MODE2.OUTNE values

ValueNameMeaning
0x00LOWOutputs go low
0x01OUTDRV_DEPENDENTHigh if OUTDRV=1, otherwise high-impedance
0x02HIGH_ZOutputs go high-impedance
LED0_ON_H  @  0x07  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED0_OFF_H  @  0x09  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
LED1_ON_H  @  0x0B  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED1_OFF_H  @  0x0D  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
LED2_ON_H  @  0x0F  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED2_OFF_H  @  0x11  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
LED3_ON_H  @  0x13  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED3_OFF_H  @  0x15  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
LED4_ON_H  @  0x17  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED4_OFF_H  @  0x19  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
LED5_ON_H  @  0x1B  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED5_OFF_H  @  0x1D  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
LED6_ON_H  @  0x1F  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED6_OFF_H  @  0x21  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
LED7_ON_H  @  0x23  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED7_OFF_H  @  0x25  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
LED8_ON_H  @  0x27  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED8_OFF_H  @  0x29  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
LED9_ON_H  @  0x2B  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED9_OFF_H  @  0x2D  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
LED10_ON_H  @  0x2F  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED10_OFF_H  @  0x31  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
LED11_ON_H  @  0x33  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED11_OFF_H  @  0x35  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
LED12_ON_H  @  0x37  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED12_OFF_H  @  0x39  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
LED13_ON_H  @  0x3B  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED13_OFF_H  @  0x3D  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
LED14_ON_H  @  0x3F  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED14_OFF_H  @  0x41  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
LED15_ON_H  @  0x43  —  2 fields
—7
—6
—5
FULL_ON[4]
ON_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_ONRW0x100x00Drive the output permanently high
[3:0]ON_COUNT_HRW0x0F0x00Turn-on count, bits [11:8]
LED15_OFF_H  @  0x45  —  2 fields
—7
—6
—5
FULL_OFF[4]
OFF_COUNT_H[3:0]
BitsFieldAccessMaskResetDescription
[4]FULL_OFFRW0x100x00Drive the output permanently low. Takes priority over FULL_ON.
[3:0]OFF_COUNT_HRW0x0F0x00Turn-off count, bits [11:8]
ALL_LED_ON_H  @  0xFB  —  1 fields
—7
—6
—5
FULL_ON[4]
—3
—2
—1
—0
BitsFieldAccessMaskResetDescription
[4]FULL_ONWO0x10—Drive all outputs permanently high
ALL_LED_OFF_H  @  0xFD  —  1 fields
—7
—6
—5
FULL_OFF[4]
—3
—2
—1
—0
BitsFieldAccessMaskResetDescription
[4]FULL_OFFWO0x10—Drive all outputs permanently low

Generated C header

What regforge gen PCA9685 writes for MODE1:

/* ------------------------------------------------------------------------ */
/* MODE1 @ 0x00u  rw  8-bit  reset 0x11u */
/* Mode register 1. Note the reset value: SLEEP is set, so the internal oscillator is off and no PWM is produced until you clear it. */
/* ------------------------------------------------------------------------ */

#define PCA9685_MODE1                                  0x00u
#define PCA9685_MODE1_WIDTH                            8u
#define PCA9685_MODE1_RESET                            0x11u

/*   RESTART bits [7] rw1c reset 0x00u -- Reads 1 when a restart is required; write 1 to clear */
#define PCA9685_MODE1_RESTART_SHIFT                    7u
#define PCA9685_MODE1_RESTART_WIDTH                    1u
#define PCA9685_MODE1_RESTART_MASK                     0x80u
#define PCA9685_MODE1_RESTART_GET(reg)                 (((uint8_t)(reg) & 0x80u) >> 7u)
#define PCA9685_MODE1_RESTART_SET(reg, val)            (((uint8_t)(reg) & (uint8_t)~0x80u) | (((uint8_t)(val) << 7u) & 0x80u))

/*   EXTCLK bits [6] rw reset 0x00u -- Use an external clock. Sticky until power cycle or SWRST. */
#define PCA9685_MODE1_EXTCLK_SHIFT                     6u
#define PCA9685_MODE1_EXTCLK_WIDTH                     1u
#define PCA9685_MODE1_EXTCLK_MASK                      0x40u
#define PCA9685_MODE1_EXTCLK_GET(reg)                  (((uint8_t)(reg) & 0x40u) >> 6u)
#define PCA9685_MODE1_EXTCLK_SET(reg, val)             (((uint8_t)(reg) & (uint8_t)~0x40u) | (((uint8_t)(val) << 6u) & 0x40u))

/*   AI bits [5] rw reset 0x00u -- Register auto-increment enable */
#define PCA9685_MODE1_AI_SHIFT                         5u
#define PCA9685_MODE1_AI_WIDTH                         1u
#define PCA9685_MODE1_AI_MASK                          0x20u
#define PCA9685_MODE1_AI_GET(reg)                      (((uint8_t)(reg) & 0x20u) >> 5u)
#define PCA9685_MODE1_AI_SET(reg, val)                 (((uint8_t)(reg) & (uint8_t)~0x20u) | (((uint8_t)(val) << 5u) & 0x20u))

/*   SLEEP bits [4] rw reset 0x01u -- Low-power mode, oscillator off. Set at reset. */
#define PCA9685_MODE1_SLEEP_SHIFT                      4u
#define PCA9685_MODE1_SLEEP_WIDTH                      1u
#define PCA9685_MODE1_SLEEP_MASK                       0x10u
#define PCA9685_MODE1_SLEEP_GET(reg)                   (((uint8_t)(reg) & 0x10u) >> 4u)
#define PCA9685_MODE1_SLEEP_SET(reg, val)              (((uint8_t)(reg) & (uint8_t)~0x10u) | (((uint8_t)(val) << 4u) & 0x10u))

/*   SUB1 bits [3] rw reset 0x00u -- Respond to I2C subaddress 1 */
#define PCA9685_MODE1_SUB1_SHIFT                       3u
#define PCA9685_MODE1_SUB1_WIDTH                       1u
#define PCA9685_MODE1_SUB1_MASK                        0x08u
#define PCA9685_MODE1_SUB1_GET(reg)                    (((uint8_t)(reg) & 0x08u) >> 3u)
#define PCA9685_MODE1_SUB1_SET(reg, val)               (((uint8_t)(reg) & (uint8_t)~0x08u) | (((uint8_t)(val) << 3u) & 0x08u))

Related parts

ADXL345
Analog Devices
30 registers
DS1307
Analog Devices
8 registers
DS3231
Analog Devices
19 registers

Source

Transcribed from NXP PCA9685 datasheet (hand-transcribed) (hand-transcribed). Hand-authored seed entry, not machine-extracted. The 64 per-channel LED registers are generated programmatically from the documented 4-per-channel layout starting at 0x06. Check against the datasheet before trusting it, then mark it verified.

Raw JSON · Report an error