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 
27 #ifndef TCS37727_H
28 #define TCS37727_H
29 
30 #include <stdint.h>
31 
32 #include "periph/i2c.h"
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38 
42 #define TCS37727_I2C_ADDRESS 0x29
43 
56 #ifndef CONFIG_TCS37727_ATIME_DEFAULT
57 #define CONFIG_TCS37727_ATIME_DEFAULT 200000
58 #endif
59 
64 typedef struct {
65  uint32_t red;
66  uint32_t green;
67  uint32_t blue;
68  uint32_t clear;
69  uint32_t lux;
70  uint32_t ct;
72 
76 typedef struct {
78  uint8_t addr;
79  uint32_t atime;
81 
85 typedef struct {
87  int again;
88 } tcs37727_t;
89 
93 enum {
97 };
98 
117 int tcs37727_init(tcs37727_t *dev, const tcs37727_params_t *params);
118 
124 void tcs37727_set_rgbc_active(const tcs37727_t *dev);
125 
133 void tcs37727_set_rgbc_standby(const tcs37727_t *dev);
134 
145 void tcs37727_read(const tcs37727_t *dev, tcs37727_data_t *data);
146 
147 #ifdef __cplusplus
148 }
149 #endif
150 
151 #endif /* TCS37727_H */
152 
tcs37727_params_t::i2c
i2c_t i2c
I2C bus the sensor is connected to.
Definition: tcs37727.h:77
tcs37727_set_rgbc_standby
void tcs37727_set_rgbc_standby(const tcs37727_t *dev)
Set RGBC disable, this deactivates periodic RGBC measurements.
TCS37727_OK
@ TCS37727_OK
everything worked as expected
Definition: tcs37727.h:94
tcs37727_data_t::green
uint32_t green
IR compensated channels green.
Definition: tcs37727.h:66
tcs37727_data_t::lux
uint32_t lux
Lux.
Definition: tcs37727.h:69
tcs37727_params_t::atime
uint32_t atime
conversion time in microseconds
Definition: tcs37727.h:79
i2c_t
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:151
tcs37727_params_t
TCS37727 configuration parameters.
Definition: tcs37727.h:76
TCS37727_NODEV
@ TCS37727_NODEV
no TCS37727 device found on the bus
Definition: tcs37727.h:96
tcs37727_set_rgbc_active
void tcs37727_set_rgbc_active(const tcs37727_t *dev)
Set RGBC enable, this activates periodic RGBC measurements.
tcs37727_read
void tcs37727_read(const tcs37727_t *dev, tcs37727_data_t *data)
Read sensor's data.
tcs37727_t
Device descriptor for TCS37727 sensors.
Definition: tcs37727.h:85
tcs37727_data_t::red
uint32_t red
IR compensated channels red.
Definition: tcs37727.h:65
tcs37727_init
int tcs37727_init(tcs37727_t *dev, const tcs37727_params_t *params)
Initialize the given TCS37727 sensor.
TCS37727_NOBUS
@ TCS37727_NOBUS
access to the configured I2C bus failed
Definition: tcs37727.h:95
tcs37727_t::p
tcs37727_params_t p
device configuration
Definition: tcs37727.h:86
tcs37727_t::again
int again
amount of gain
Definition: tcs37727.h:87
tcs37727_data_t
Struct for storing TCS37727 sensor data.
Definition: tcs37727.h:64
tcs37727_params_t::addr
uint8_t addr
the sensors address on the I2C bus
Definition: tcs37727.h:78
tcs37727_data_t::blue
uint32_t blue
IR compensated channels blue.
Definition: tcs37727.h:67
tcs37727_data_t::ct
uint32_t ct
Color temperature.
Definition: tcs37727.h:70
i2c.h
Low-level I2C peripheral driver interface definition.
tcs37727_data_t::clear
uint32_t clear
channels clear
Definition: tcs37727.h:68