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 
9 #pragma once
10 
23 #include "periph/i2c.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
35 #define BH1750FVI_ADDR_PIN_LOW (0x23)
36 #define BH1750FVI_ADDR_PIN_HIGH (0x5c)
42 #define BH1750FVI_DEFAULT_ADDR BH1750FVI_ADDR_PIN_LOW
43 
47 #define BH1750FVI_I2C_MAX_CLK I2C_SPEED_FAST
48 
52 enum {
54  BH1750FVI_ERR_I2C = -1
55 };
56 
60 typedef struct {
62  uint8_t addr;
63 } bh1750fvi_t;
64 
68 typedef struct {
70  uint8_t addr;
72 
83 
95 uint16_t bh1750fvi_sample(const bh1750fvi_t *dev);
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
uint16_t bh1750fvi_sample(const bh1750fvi_t *dev)
Read a ambient light value from the given device [in LUX].
int bh1750fvi_init(bh1750fvi_t *dev, const bh1750fvi_params_t *params)
Initialize the given BH1750FVI device.
@ BH1750FVI_OK
everything was fine
Definition: bh1750fvi.h:53
@ BH1750FVI_ERR_I2C
error initializing the I2C bus
Definition: bh1750fvi.h:54
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition: i2c.h:144
Low-level I2C peripheral driver interface definition.
Set of configuration parameters for BH1750FV devices.
Definition: bh1750fvi.h:68
i2c_t i2c
I2C bus the device is connected to.
Definition: bh1750fvi.h:69
uint8_t addr
slave address of the device
Definition: bh1750fvi.h:70
Device descriptor for BH1570FVI devices.
Definition: bh1750fvi.h:60
i2c_t i2c
I2C bus the device is connected to.
Definition: bh1750fvi.h:61
uint8_t addr
slave address of the device
Definition: bh1750fvi.h:62