Driver for the Rohm BH1750FVI ambient light sensor. More...
Driver for the Rohm BH1750FVI ambient light sensor.
Files | |
file | bh1750fvi_internal.h |
Command definition for the BH1750FVI light sensor. | |
file | bh1750fvi_params.h |
Default configuration for BH1750FVI devices. | |
file | bh1750fvi.h |
Interface definition for the Rohm BH1750FVI ambient light sensor. | |
Data Structures | |
struct | bh1750fvi_t |
Device descriptor for BH1570FVI devices. More... | |
struct | bh1750fvi_params_t |
Set of configuration parameters for BH1750FV devices. More... | |
Macros | |
#define | BH1750FVI_DEFAULT_ADDR BH1750FVI_ADDR_PIN_LOW |
Default address of BH1750FVI sensors. | |
#define | BH1750FVI_I2C_MAX_CLK I2C_SPEED_FAST |
Maximum I2C bus speed to use with the device. | |
Enumerations | |
enum | { BH1750FVI_OK = 0, BH1750FVI_ERR_I2C = -1 } |
Status and error return codes. More... | |
Functions | |
int | bh1750fvi_init (bh1750fvi_t *dev, const bh1750fvi_params_t *params) |
Initialize the given BH1750FVI device. More... | |
uint16_t | bh1750fvi_sample (const bh1750fvi_t *dev) |
Read a ambient light value from the given device [in LUX]. More... | |
Possible I2C bus addresses of the device | |
The actual address of the device depends on the state of the ADDR pin. | |
#define | BH1750FVI_ADDR_PIN_LOW (0x23) |
ADDR pin := 0. | |
#define | BH1750FVI_ADDR_PIN_HIGH (0x5c) |
ADDR pin := 1. | |
anonymous enum |
Status and error return codes.
Enumerator | |
---|---|
BH1750FVI_OK | everything was fine |
BH1750FVI_ERR_I2C | error initializing the I2C bus |
Definition at line 53 of file bh1750fvi.h.
int bh1750fvi_init | ( | bh1750fvi_t * | dev, |
const bh1750fvi_params_t * | params | ||
) |
Initialize the given BH1750FVI device.
[out] | dev | device descriptor of the targeted device |
[in] | params | device configuration (i2c bus, address and bus clock) |
uint16_t bh1750fvi_sample | ( | const bh1750fvi_t * | dev | ) |
Read a ambient light value from the given device [in LUX].
The result value is the measured ambient light intensity in LUX and ranges from 0 to 54612. Taking one measurement takes ~120ms, so it takes this amount of time until the function returns.
[in] | dev | device descriptor of the targeted device |