Loading...
Searching...
No Matches
pca9685_regs.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 Gunar Schorcht
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
9#pragma once
10
18
19#ifdef __cplusplus
20extern "C"
21{
22#endif
23
28#define PCA9685_REG_MODE1 (0x00)
29#define PCA9685_REG_MODE2 (0x01)
30#define PCA9685_REG_SUBADR1 (0x02)
31#define PCA9685_REG_SUBADR2 (0x03)
32#define PCA9685_REG_SUBADR3 (0x04)
33#define PCA9685_REG_ALLCALLADDR (0x05)
34#define PCA9685_REG_LED0_ON_L (0x06)
35
36#define PCA9685_REG_ALL_LED_ON_L (0xfa)
37#define PCA9685_REG_ALL_LED_ON_H (0xfb)
38#define PCA9685_REG_ALL_LED_OFF_L (0xfc)
39#define PCA9685_REG_ALL_LED_OFF_H (0xfd)
40
41#define PCA9685_REG_ALL_LED_ON (0xfa)
42#define PCA9685_REG_ALL_LED_OFF (0xfc)
43
44#define PCA9685_REG_PRE_SCALE (0xfe)
45#define PCA9685_REG_TEST_MODE (0xff)
46
47#define PCA9685_REG_LED_ON(n) (0x06 + (n << 2))
48#define PCA9685_REG_LED_OFF(n) (0x08 + (n << 2))
49
50#define PCA9685_REG_LED_ON_L(n) (0x06 + (n << 2))
51#define PCA9685_REG_LED_ON_H(n) (0x07 + (n << 2))
52#define PCA9685_REG_LED_OFF_L(n) (0x08 + (n << 2))
53#define PCA9685_REG_LED_OFF_H(n) (0x09 + (n << 2))
55
60
61/* PCA9685_REG_MODE1 */
62#define PCA9685_MODE1_RESTART (0x80)
63#define PCA9685_MODE1_EXTCLK (0x40)
64#define PCA9685_MODE1_AI (0x20)
65#define PCA9685_MODE1_SLEEP (0x10)
66#define PCA9685_MODE1_SUB1 (0x08)
67#define PCA9685_MODE1_SUB2 (0x04)
68#define PCA9685_MODE1_SUB3 (0x02)
69#define PCA9685_MODE1_ALLCALL (0x01)
70
71/* PCA9685_REG_MODE2 */
72#define PCA9685_MODE2_INVERT (0x10)
73#define PCA9685_MODE2_OCH (0x08)
74#define PCA9685_MODE2_OUTDRV (0x04)
75#define PCA9685_MODE2_OUTNE (0x03)
77
82#define PCA9685_LED_ON (0x1000) /* LEDs on word */
83#define PCA9685_LED_OFF (0x1000) /* LEDs off word */
84#define PCA9685_LED_ON_H (0x10) /* LEDs on high byte */
85#define PCA9685_LED_OFF_H (0x10) /* LEDs off high byte */
86#define PCA9685_ALL_LED_ON (0x1000) /* All LEDs on word */
87#define PCA9685_ALL_LED_OFF (0x1000) /* All LEDs off word */
88#define PCA9685_ALL_LED_ON_H (0x10) /* All LEDs on high byte */
89#define PCA9685_ALL_LED_OFF_H (0x10) /* All LEDs off word */
91
92#ifdef __cplusplus
93}
94#endif
95