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