Loading...
Searching...
No Matches
tcs37727-internal.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 PHYTEC Messtechnik GmbH
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
18
19#ifdef __cplusplus
20extern "C"
21{
22#endif
23
24#ifndef TCS37727_AG_THRESHOLD_LOW
25#define TCS37727_AG_THRESHOLD_LOW 200
26#endif
27
28#ifndef TCS37727_AG_THRESHOLD_HIGH
29#define TCS37727_AG_THRESHOLD_HIGH (65535 - TCS37727_AG_THRESHOLD_LOW)
30#endif
31
38#define TCS37727_ENABLE 0x80
39#define TCS37727_ATIME 0x81
40#define TCS37727_PTIME 0x82
41#define TCS37727_WTIME 0x83
42#define TCS37727_AILTL 0x04
43#define TCS37727_AILTH 0x05
44#define TCS37727_AIHTL 0x06
45#define TCS37727_AIHTH 0x07
46#define TCS37727_PILTL 0x08
47#define TCS37727_PILTH 0x09
48#define TCS37727_PIHTL 0x0A
49#define TCS37727_PIHTH 0x0B
50#define TCS37727_PERS 0x8C
51#define TCS37727_CONFIG 0x8D
52#define TCS37727_PPULSE 0x8E
53#define TCS37727_CONTROL 0x8F
54#define TCS37727_ID 0x92
55#define TCS37727_STATUS 0x93
56#define TCS37727_CDATA 0x14
57#define TCS37727_CDATAH 0x15
58#define TCS37727_RDATA 0x16
59#define TCS37727_RDATAH 0x17
60#define TCS37727_GDATA 0x18
61#define TCS37727_GDATAH 0x19
62#define TCS37727_BDATA 0x1A
63#define TCS37727_BDATAH 0x1B
64#define TCS37727_PDATA 0x1C
65#define TCS37727_PDATAH 0x1D
67
72#define TCS37727_BYTE_TRANS 0x80
73#define TCS37727_INC_TRANS 0xA0
74#define TCS37727_SF_PICLR 0xE5
75#define TCS37727_SF_CICLR 0xE6
76#define TCS37727_SF_PCICLR 0xE7
78
83#define TCS37727_ENABLE_PIEN (1 << 5)
84#define TCS37727_ENABLE_AIEN (1 << 4)
85#define TCS37727_ENABLE_WEN (1 << 3)
86#define TCS37727_ENABLE_PEN (1 << 2)
87#define TCS37727_ENABLE_AEN (1 << 1)
88#define TCS37727_ENABLE_PON (1 << 0)
90
95#define TCS37727_CONTROL_PDRIVE_100 0x00
96#define TCS37727_CONTROL_PDRIVE_50 0x04
97#define TCS37727_CONTROL_PDRIVE_25 0x08
98#define TCS37727_CONTROL_PDRIVE_12 0x0C
99#define TCS37727_CONTROL_PDRIVE_MASK 0x0C
100#define TCS37727_CONTROL_AGAIN_1 0x00
101#define TCS37727_CONTROL_AGAIN_4 0x01
102#define TCS37727_CONTROL_AGAIN_16 0x02
103#define TCS37727_CONTROL_AGAIN_60 0x03
104#define TCS37727_CONTROL_AGAIN_MASK 0x03
106
111#define TCS37727_ID_VALUE 0x49
113
118#define TCS37727_ATIME_MIN 2400 /* 2.4ms integration time, max count 1024 */
119#define TCS37727_ATIME_MAX 614000 /* 614ms integration time, max count 0xffff */
120
121#define TCS37727_ATIME_TO_REG(val) (256 - (uint8_t)((val) / 2400))
122#define TCS37727_ATIME_TO_US(reg) ((256 - (uint8_t)(reg)) * 2400)
124
131#define DGF_IF 310
132#define R_COEF_IF 136
133#define G_COEF_IF 1000
134#define B_COEF_IF -444
135#define CT_COEF_IF 3810
136#define CT_OFFSET_IF 1391
138
139#ifdef __cplusplus
140}
141#endif
142