Loading...
Searching...
No Matches
BH1750FVI Light Sensor

Driver for the Rohm BH1750FVI ambient light sensor. More...

Detailed Description

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.
 
uint16_t bh1750fvi_sample (const bh1750fvi_t *dev)
 Read a ambient light value from the given device [in LUX].
 

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.
 

Macro Definition Documentation

◆ BH1750FVI_ADDR_PIN_HIGH

#define BH1750FVI_ADDR_PIN_HIGH   (0x5c)

ADDR pin := 1.

Definition at line 37 of file bh1750fvi.h.

◆ BH1750FVI_ADDR_PIN_LOW

#define BH1750FVI_ADDR_PIN_LOW   (0x23)

ADDR pin := 0.

Definition at line 36 of file bh1750fvi.h.

◆ BH1750FVI_DEFAULT_ADDR

#define BH1750FVI_DEFAULT_ADDR   BH1750FVI_ADDR_PIN_LOW

Default address of BH1750FVI sensors.

Definition at line 43 of file bh1750fvi.h.

◆ BH1750FVI_I2C_MAX_CLK

#define BH1750FVI_I2C_MAX_CLK   I2C_SPEED_FAST

Maximum I2C bus speed to use with the device.

Definition at line 48 of file bh1750fvi.h.

Enumeration Type Documentation

◆ anonymous enum

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.

Function Documentation

◆ bh1750fvi_init()

int bh1750fvi_init ( bh1750fvi_t dev,
const bh1750fvi_params_t params 
)

Initialize the given BH1750FVI device.

Parameters
[out]devdevice descriptor of the targeted device
[in]paramsdevice configuration (i2c bus, address and bus clock)
Returns
0 on success
-1 if unable to speak to the device

◆ bh1750fvi_sample()

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.

Parameters
[in]devdevice descriptor of the targeted device
Returns
ambient light intensity in LUX