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 "saul.h"
32 #include "periph/i2c.h"
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38 
39 #ifndef TCS37727_I2C_ADDRESS
40 #define TCS37727_I2C_ADDRESS 0x29
41 #endif
42 
43 #ifndef TCS37727_ATIME_DEFAULT
44 #define TCS37727_ATIME_DEFAULT 200000
45 #endif
46 
50 typedef struct {
51  uint32_t red;
52  uint32_t green;
53  uint32_t blue;
54  uint32_t clear;
55  uint32_t lux;
56  uint32_t ct;
58 
62 typedef struct {
64  uint8_t addr;
65  uint32_t atime;
67 
71 typedef struct {
73  int again;
74 } tcs37727_t;
75 
79 enum {
83 };
84 
89 
108 int tcs37727_init(tcs37727_t *dev, const tcs37727_params_t *params);
109 
115 void tcs37727_set_rgbc_active(const tcs37727_t *dev);
116 
124 void tcs37727_set_rgbc_standby(const tcs37727_t *dev);
125 
136 void tcs37727_read(const tcs37727_t *dev, tcs37727_data_t *data);
137 
138 #ifdef __cplusplus
139 }
140 #endif
141 
142 #endif /* TCS37727_H */
143 
uint8_t addr
the sensors address on the I2C bus
Definition: tcs37727.h:64
int again
amount of gain
Definition: tcs37727.h:73
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:113
void tcs37727_read(const tcs37727_t *dev, tcs37727_data_t *data)
Read sensor&#39;s data.
uint32_t ct
Color temperature.
Definition: tcs37727.h:56
Definition of the RIOT actuator/sensor interface.
Definition: saul.h:140
Definition of the generic [S]ensor [A]ctuator [U]ber [L]ayer.
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:53
tcs37727_params_t p
device configuration
Definition: tcs37727.h:72
uint32_t red
IR compensated channels red.
Definition: tcs37727.h:51
uint32_t atime
conversion time in microseconds
Definition: tcs37727.h:65
everything worked as expected
Definition: tcs37727.h:80
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:52
i2c_t i2c
I2C bus the sensor is connected to.
Definition: tcs37727.h:63
uint32_t lux
Lux.
Definition: tcs37727.h:55
Device descriptor for TCS37727 sensors.
Definition: tcs37727.h:71
TCS37727 configuration parameters.
Definition: tcs37727.h:62
no TCS37727 device found on the bus
Definition: tcs37727.h:82
access to the configured I2C bus failed
Definition: tcs37727.h:81
uint32_t clear
channels clear
Definition: tcs37727.h:54
Struct for storing TCS37727 sensor data.
Definition: tcs37727.h:50
const saul_driver_t tcs37727_saul_driver
Export the sensor&#39;s SAUL interface.
Low-level I2C peripheral driver interface definition.