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 
24 #ifndef ISL29020_H
25 #define ISL29020_H
26 
27 #include <stdint.h>
28 #include "periph/i2c.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
46 #ifndef CONFIG_ISL29020_DEFAULT_ADDRESS
47 #define CONFIG_ISL29020_DEFAULT_ADDRESS 0x44
48 #endif
49 
54 typedef enum {
58 
62 typedef enum {
68 
72 typedef struct {
74  uint8_t addr;
78 
82 typedef struct {
84  float lux_fac;
85 } isl29020_t;
86 
96 int isl29020_init(isl29020_t *dev, const isl29020_params_t *params);
97 
106 int isl29020_read(const isl29020_t *dev);
107 
116 int isl29020_enable(const isl29020_t *dev);
117 
126 int isl29020_disable(const isl29020_t *dev);
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif /* ISL29020_H */
133 
ISL29020_RANGE_64K
@ ISL29020_RANGE_64K
set range to 0-64000 lux
Definition: isl29020.h:66
isl29020_init
int isl29020_init(isl29020_t *dev, const isl29020_params_t *params)
Initialize a new ISL29020 device.
isl29020_t
Device descriptor for ISL29020 sensors.
Definition: isl29020.h:82
isl29020_t::lux_fac
float lux_fac
factor to calculate actual lux value
Definition: isl29020.h:84
isl29020_enable
int isl29020_enable(const isl29020_t *dev)
Enable the given sensor.
i2c_t
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:151
isl29020_disable
int isl29020_disable(const isl29020_t *dev)
Disable the given sensor.
ISL29020_RANGE_16K
@ ISL29020_RANGE_16K
set range to 0-16000 lux
Definition: isl29020.h:65
isl29020_mode_t
isl29020_mode_t
Possible modes for the ISL29020 sensor.
Definition: isl29020.h:54
isl29020_params_t::addr
uint8_t addr
address on that bus
Definition: isl29020.h:74
isl29020_range_t
isl29020_range_t
Possible range values for the ISL29020 sensor.
Definition: isl29020.h:62
ISL29020_MODE_IR
@ ISL29020_MODE_IR
set sensor to detect infrared light
Definition: isl29020.h:56
isl29020_params_t::mode
isl29020_mode_t mode
measurement mode to use
Definition: isl29020.h:76
isl29020_params_t::i2c
i2c_t i2c
I2C bus the device is connected to.
Definition: isl29020.h:73
isl29020_params_t
Data structure holding the full set of configuration parameters.
Definition: isl29020.h:72
ISL29020_MODE_AMBIENT
@ ISL29020_MODE_AMBIENT
set sensor to detect ambient light
Definition: isl29020.h:55
isl29020_t::params
isl29020_params_t params
device initialization parameters
Definition: isl29020.h:83
isl29020_read
int isl29020_read(const isl29020_t *dev)
Read a lighting value from the sensor, the result is given in lux.
ISL29020_RANGE_4K
@ ISL29020_RANGE_4K
set range to 0-4000 lux
Definition: isl29020.h:64
ISL29020_RANGE_1K
@ ISL29020_RANGE_1K
set range to 0-1000 lux
Definition: isl29020.h:63
isl29020_params_t::range
isl29020_range_t range
range setting to use
Definition: isl29020.h:75
i2c.h
Low-level I2C peripheral driver interface definition.