tcs37727.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 PHYTEC Messtechnik GmbH
3  * 2017 Freie Universit├Ąt Berlin
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
26 #ifndef TCS37727_H
27 #define TCS37727_H
28 
29 #include <stdint.h>
30 
31 #include "periph/i2c.h"
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37 
38 #ifndef TCS37727_I2C_ADDRESS
39 #define TCS37727_I2C_ADDRESS 0x29
40 #endif
41 
42 #ifndef TCS37727_ATIME_DEFAULT
43 #define TCS37727_ATIME_DEFAULT 200000
44 #endif
45 
49 typedef struct {
50  uint32_t red;
51  uint32_t green;
52  uint32_t blue;
53  uint32_t clear;
54  uint32_t lux;
55  uint32_t ct;
57 
61 typedef struct {
63  uint8_t addr;
64  uint32_t atime;
66 
70 typedef struct {
72  int again;
73 } tcs37727_t;
74 
78 enum {
82 };
83 
102 int tcs37727_init(tcs37727_t *dev, const tcs37727_params_t *params);
103 
109 void tcs37727_set_rgbc_active(const tcs37727_t *dev);
110 
118 void tcs37727_set_rgbc_standby(const tcs37727_t *dev);
119 
130 void tcs37727_read(const tcs37727_t *dev, tcs37727_data_t *data);
131 
132 #ifdef __cplusplus
133 }
134 #endif
135 
136 #endif /* TCS37727_H */
137 
uint8_t addr
the sensors address on the I2C bus
Definition: tcs37727.h:63
everything worked as expected
Definition: tcs37727.h:79
int again
amount of gain
Definition: tcs37727.h:72
access to the configured I2C bus failed
Definition: tcs37727.h:80
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:157
void tcs37727_read(const tcs37727_t *dev, tcs37727_data_t *data)
Read sensor&#39;s data.
uint32_t ct
Color temperature.
Definition: tcs37727.h:55
no TCS37727 device found on the bus
Definition: tcs37727.h:81
void tcs37727_set_rgbc_standby(const tcs37727_t *dev)
Set RGBC disable, this deactivates periodic RGBC measurements.
uint32_t blue
IR compensated channels blue.
Definition: tcs37727.h:52
tcs37727_params_t p
device configuration
Definition: tcs37727.h:71
uint32_t red
IR compensated channels red.
Definition: tcs37727.h:50
uint32_t atime
conversion time in microseconds
Definition: tcs37727.h:64
int tcs37727_init(tcs37727_t *dev, const tcs37727_params_t *params)
Initialize the given TCS37727 sensor.
void tcs37727_set_rgbc_active(const tcs37727_t *dev)
Set RGBC enable, this activates periodic RGBC measurements.
uint32_t green
IR compensated channels green.
Definition: tcs37727.h:51
i2c_t i2c
I2C bus the sensor is connected to.
Definition: tcs37727.h:62
uint32_t lux
Lux.
Definition: tcs37727.h:54
Device descriptor for TCS37727 sensors.
Definition: tcs37727.h:70
TCS37727 configuration parameters.
Definition: tcs37727.h:61
uint32_t clear
channels clear
Definition: tcs37727.h:53
Struct for storing TCS37727 sensor data.
Definition: tcs37727.h:49
Low-level I2C peripheral driver interface definition.