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
54 typedef enum {
56  ISL29020_MODE_IR = 1
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 */
int isl29020_init(isl29020_t *dev, const isl29020_params_t *params)
Initialize a new ISL29020 device.
isl29020_mode_t
Possible modes for the ISL29020 sensor.
Definition: isl29020.h:54
int isl29020_disable(const isl29020_t *dev)
Disable the given sensor.
int isl29020_enable(const isl29020_t *dev)
Enable the given sensor.
int isl29020_read(const isl29020_t *dev)
Read a lighting value from the sensor, the result is given in lux.
isl29020_range_t
Possible range values for the ISL29020 sensor.
Definition: isl29020.h:62
@ ISL29020_MODE_AMBIENT
set sensor to detect ambient light
Definition: isl29020.h:55
@ ISL29020_MODE_IR
set sensor to detect infrared light
Definition: isl29020.h:56
@ ISL29020_RANGE_64K
set range to 0-64000 lux
Definition: isl29020.h:66
@ ISL29020_RANGE_16K
set range to 0-16000 lux
Definition: isl29020.h:65
@ ISL29020_RANGE_1K
set range to 0-1000 lux
Definition: isl29020.h:63
@ ISL29020_RANGE_4K
set range to 0-4000 lux
Definition: isl29020.h:64
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition: i2c.h:145
Low-level I2C peripheral driver interface definition.
Data structure holding the full set of configuration parameters.
Definition: isl29020.h:72
isl29020_range_t range
range setting to use
Definition: isl29020.h:75
uint8_t addr
address on that bus
Definition: isl29020.h:74
isl29020_mode_t mode
measurement mode to use
Definition: isl29020.h:76
i2c_t i2c
I2C bus the device is connected to.
Definition: isl29020.h:73
Device descriptor for ISL29020 sensors.
Definition: isl29020.h:82
isl29020_params_t params
device initialization parameters
Definition: isl29020.h:83
float lux_fac
factor to calculate actual lux value
Definition: isl29020.h:84