isl29020.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freie Universit├Ąt Berlin
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 
21 #ifndef ISL29020_H
22 #define ISL29020_H
23 
24 #include <stdint.h>
25 #include "periph/i2c.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
34 #define ISL29020_DEFAULT_ADDRESS 0x44
35 
39 typedef struct {
41  uint8_t address;
42  float lux_fac;
43 } isl29020_t;
44 
48 typedef enum {
52 
56 typedef enum {
62 
66 typedef struct {
68  uint8_t addr;
72 
85 int isl29020_init(isl29020_t *dev, i2c_t i2c, uint8_t address,
86  isl29020_range_t range, isl29020_mode_t mode);
87 
96 int isl29020_read(const isl29020_t *dev);
97 
106 int isl29020_enable(const isl29020_t *dev);
107 
116 int isl29020_disable(const isl29020_t *dev);
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* ISL29020_H */
123 
set range to 0-1000 lux
Definition: isl29020.h:57
i2c_t i2c
I2C bus the device is connected to.
Definition: isl29020.h:67
uint8_t address
I2C bus address of the sensor.
Definition: isl29020.h:41
int isl29020_disable(const isl29020_t *dev)
Disable the given sensor.
int isl29020_enable(const isl29020_t *dev)
Enable the given sensor.
isl29020_mode_t
Possible modes for the ISL29020 sensor.
Definition: isl29020.h:48
isl29020_range_t
Possible range values for the ISL29020 sensor.
Definition: isl29020.h:56
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:108
set range to 0-16000 lux
Definition: isl29020.h:59
set sensor to detect ambient light
Definition: isl29020.h:49
Device descriptor for ISL29020 sensors.
Definition: isl29020.h:39
Data structure holding the full set of configuration parameters.
Definition: isl29020.h:66
set sensor to detect infrared light
Definition: isl29020.h:50
int isl29020_read(const isl29020_t *dev)
Read a lighting value from the sensor, the result is given in lux.
i2c_t i2c
I2C device the sensor is connected to.
Definition: isl29020.h:40
uint8_t addr
address on that bus
Definition: isl29020.h:68
float lux_fac
factor to calculate actual lux value
Definition: isl29020.h:42
set range to 0-64000 lux
Definition: isl29020.h:60
isl29020_mode_t mode
measurement mode to use
Definition: isl29020.h:70
isl29020_range_t range
range setting to use
Definition: isl29020.h:69
set range to 0-4000 lux
Definition: isl29020.h:58
int isl29020_init(isl29020_t *dev, i2c_t i2c, uint8_t address, isl29020_range_t range, isl29020_mode_t mode)
Initialize a new ISL29020 device.
Low-level I2C peripheral driver interface definition.