tcs37727-internal.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 PHYTEC Messtechnik GmbH
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 
21 #ifndef TCS37727_INTERNAL_H
22 #define TCS37727_INTERNAL_H
23 
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28 
29 #ifndef TCS37727_AG_THRESHOLD_LOW
30 #define TCS37727_AG_THRESHOLD_LOW 200
31 #endif
32 
33 #ifndef TCS37727_AG_THRESHOLD_HIGH
34 #define TCS37727_AG_THRESHOLD_HIGH (65535 - TCS37727_AG_THRESHOLD_LOW)
35 #endif
36 
43 #define TCS37727_ENABLE 0x80
44 #define TCS37727_ATIME 0x81
45 #define TCS37727_PTIME 0x82
46 #define TCS37727_WTIME 0x83
47 #define TCS37727_AILTL 0x04
48 #define TCS37727_AILTH 0x05
49 #define TCS37727_AIHTL 0x06
50 #define TCS37727_AIHTH 0x07
51 #define TCS37727_PILTL 0x08
52 #define TCS37727_PILTH 0x09
53 #define TCS37727_PIHTL 0x0A
54 #define TCS37727_PIHTH 0x0B
55 #define TCS37727_PERS 0x8C
56 #define TCS37727_CONFIG 0x8D
57 #define TCS37727_PPULSE 0x8E
58 #define TCS37727_CONTROL 0x8F
59 #define TCS37727_ID 0x92
60 #define TCS37727_STATUS 0x93
61 #define TCS37727_CDATA 0x14
62 #define TCS37727_CDATAH 0x15
63 #define TCS37727_RDATA 0x16
64 #define TCS37727_RDATAH 0x17
65 #define TCS37727_GDATA 0x18
66 #define TCS37727_GDATAH 0x19
67 #define TCS37727_BDATA 0x1A
68 #define TCS37727_BDATAH 0x1B
69 #define TCS37727_PDATA 0x1C
70 #define TCS37727_PDATAH 0x1D
77 #define TCS37727_BYTE_TRANS 0x80
78 #define TCS37727_INC_TRANS 0xA0
79 #define TCS37727_SF_PICLR 0xE5
80 #define TCS37727_SF_CICLR 0xE6
81 #define TCS37727_SF_PCICLR 0xE7
88 #define TCS37727_ENABLE_PIEN (1 << 5)
89 #define TCS37727_ENABLE_AIEN (1 << 4)
90 #define TCS37727_ENABLE_WEN (1 << 3)
91 #define TCS37727_ENABLE_PEN (1 << 2)
92 #define TCS37727_ENABLE_AEN (1 << 1)
93 #define TCS37727_ENABLE_PON (1 << 0)
100 #define TCS37727_CONTROL_PDRIVE_100 0x00
101 #define TCS37727_CONTROL_PDRIVE_50 0x04
102 #define TCS37727_CONTROL_PDRIVE_25 0x08
103 #define TCS37727_CONTROL_PDRIVE_12 0x0C
104 #define TCS37727_CONTROL_PDRIVE_MASK 0x0C
105 #define TCS37727_CONTROL_AGAIN_1 0x00
106 #define TCS37727_CONTROL_AGAIN_4 0x01
107 #define TCS37727_CONTROL_AGAIN_16 0x02
108 #define TCS37727_CONTROL_AGAIN_60 0x03
109 #define TCS37727_CONTROL_AGAIN_MASK 0x03
116 #define TCS37727_ID_VALUE 0x49
117 
123 #define TCS37727_ATIME_MIN 2400 /* 2.4ms integration time, max count 1024 */
124 #define TCS37727_ATIME_MAX 614000 /* 614ms integration time, max count 0xffff */
125 
126 #define TCS37727_ATIME_TO_REG(val) (256 - (uint8_t)((val) / 2400))
127 #define TCS37727_ATIME_TO_US(reg) ((256 - (uint8_t)(reg)) * 2400)
128 
136 #define DGF_IF 310
137 #define R_COEF_IF 136
138 #define G_COEF_IF 1000
139 #define B_COEF_IF -444
140 #define CT_COEF_IF 3810
141 #define CT_OFFSET_IF 1391
142 
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #endif /* TCS37727_INTERNAL_H */
149