bh1750fvi.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 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 BH1750FVI_H
22 #define BH1750FVI_H
23 
24 #include "periph/i2c.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
36 #define BH1750FVI_ADDR_PIN_LOW (0x23)
37 #define BH1750FVI_ADDR_PIN_HIGH (0x5c)
43 #define BH1750FVI_DEFAULT_ADDR BH1750FVI_ADDR_PIN_LOW
44 
48 #define BH1750FVI_I2C_MAX_CLK I2C_SPEED_FAST
49 
53 enum {
56 };
57 
61 typedef struct {
63  uint8_t addr;
64 } bh1750fvi_t;
65 
69 typedef struct {
71  uint8_t addr;
73 
83 int bh1750fvi_init(bh1750fvi_t *dev, const bh1750fvi_params_t *params);
84 
96 uint16_t bh1750fvi_sample(const bh1750fvi_t *dev);
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif /* BH1750FVI_H */
103 
bh1750fvi_t::addr
uint8_t addr
slave address of the device
Definition: bh1750fvi.h:63
bh1750fvi_params_t::addr
uint8_t addr
slave address of the device
Definition: bh1750fvi.h:71
bh1750fvi_t
Device descriptor for BH1570FVI devices.
Definition: bh1750fvi.h:61
i2c_t
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:151
bh1750fvi_params_t
Set of configuration parameters for BH1750FV devices.
Definition: bh1750fvi.h:69
bh1750fvi_t::i2c
i2c_t i2c
I2C bus the device is connected to.
Definition: bh1750fvi.h:62
BH1750FVI_ERR_I2C
@ BH1750FVI_ERR_I2C
error initializing the I2C bus
Definition: bh1750fvi.h:55
bh1750fvi_sample
uint16_t bh1750fvi_sample(const bh1750fvi_t *dev)
Read a ambient light value from the given device [in LUX].
bh1750fvi_params_t::i2c
i2c_t i2c
I2C bus the device is connected to.
Definition: bh1750fvi.h:70
BH1750FVI_OK
@ BH1750FVI_OK
everything was fine
Definition: bh1750fvi.h:54
bh1750fvi_init
int bh1750fvi_init(bh1750fvi_t *dev, const bh1750fvi_params_t *params)
Initialize the given BH1750FVI device.
i2c.h
Low-level I2C peripheral driver interface definition.