pca9633_regs.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Freie Universität Berlin
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 
19 #include "bitarithm.h"
20 
21 #ifdef __cplusplus
22 extern "C"
23 {
24 #endif
25 
26 /* Register definitions (page 11, table 7) */
27 
31 #define PCA9633_REG_MODE1 0x00
32 
36 #define PCA9633_REG_MODE2 0x01
37 
41 #define PCA9633_REG_PWM0 0x02
42 
46 #define PCA9633_REG_PWM1 0x03
47 
51 #define PCA9633_REG_PWM2 0x04
52 
56 #define PCA9633_REG_PWM3 0x05
57 
61 #define PCA9633_REG_GRPPWM 0x06
62 
66 #define PCA9633_REG_GRPFREQ 0x07
67 
71 #define PCA9633_REG_LEDOUT 0x08
72 
76 #define PCA9633_REG_SUBADR1 0x09
77 
81 #define PCA9633_REG_SUBADR2 0x0A
82 
86 #define PCA9633_REG_SUBADR3 0x0B
87 
91 #define PCA9633_REG_ALLCALLADR 0x0C
92 
93 /* Bits in REG_MODE1 (page 12, table 8) */
94 
100 #define PCA9633_BIT_AI2 BIT7
101 
105 #define PCA9633_BIT_AI1 BIT6
106 
110 #define PCA9633_BIT_AI0 BIT5
111 
116 #define PCA9633_BIT_SLEEP BIT4
117 
122 #define PCA9633_BIT_SUB1 BIT3
123 
128 #define PCA9633_BIT_SUB2 BIT2
129 
134 #define PCA9633_BIT_SUB3 BIT1
135 
140 #define PCA9633_BIT_ALLCALL BIT0
141 
142 /* Bits in REG_MODE2 (page 12-13, table 9) */
143 
147 #define PCA9633_BIT_DMBLNK BIT5
148 
153 #define PCA9633_BIT_INVRT BIT4
154 
159 #define PCA9633_BIT_OCH BIT3
160 
165 #define PCA9633_BIT_OUTDRV BIT2
166 
175 #define PCA9633_BITMASK_OUTNE 0x03
176 
177 /* Bits in REG_LEDOUT (page 14, table 13) */
178 
182 #define PCA9633_BITMASK_LDR3 0xC0
183 
187 #define PCA9633_BITMASK_LDR2 0x30
188 
192 #define PCA9633_BITMASK_LDR1 0x0C
193 
197 #define PCA9633_BITMASK_LDR0 0x03
198 
199 #ifdef __cplusplus
200 }
201 #endif
202 
Helper functions for bit arithmetic.