LibDriver BH1750FVI  1.0.0
BH1750FVI full-featured driver
bh1750fvi basic driver function

bh1750fvi basic driver modules More...

Data Structures

struct  bh1750fvi_handle_s
 bh1750fvi handle structure definition More...
 
struct  bh1750fvi_info_s
 bh1750fvi information structure definition More...
 

Typedefs

typedef struct bh1750fvi_handle_s bh1750fvi_handle_t
 bh1750fvi handle structure definition More...
 
typedef struct bh1750fvi_info_s bh1750fvi_info_t
 bh1750fvi information structure definition More...
 

Enumerations

enum  bh1750fvi_address_t { BH1750FVI_ADDRESS_LOW = 0x46 , BH1750FVI_ADDRESS_HIGH = 0xB8 }
 bh1750fvi address enumeration definition More...
 
enum  bh1750fvi_mode_t { BH1750FVI_MODE_HIGH_RESOLUTION_MODE = 0x0 , BH1750FVI_MODE_HIGH_RESOLUTION_MODE2 = 0x1 , BH1750FVI_MODE_LOW_RESOLUTION_MODE = 0x2 }
 bh1750fvi mode enumeration definition More...
 

Functions

uint8_t bh1750fvi_info (bh1750fvi_info_t *info)
 get chip's information More...
 
uint8_t bh1750fvi_set_addr_pin (bh1750fvi_handle_t *handle, bh1750fvi_address_t addr_pin)
 set the address pin More...
 
uint8_t bh1750fvi_get_addr_pin (bh1750fvi_handle_t *handle, bh1750fvi_address_t *addr_pin)
 get the address pin More...
 
uint8_t bh1750fvi_set_mode (bh1750fvi_handle_t *handle, bh1750fvi_mode_t mode)
 set the mode More...
 
uint8_t bh1750fvi_get_mode (bh1750fvi_handle_t *handle, bh1750fvi_mode_t *mode)
 get the mode More...
 
uint8_t bh1750fvi_init (bh1750fvi_handle_t *handle)
 initialize the chip More...
 
uint8_t bh1750fvi_deinit (bh1750fvi_handle_t *handle)
 close the chip More...
 
uint8_t bh1750fvi_single_read (bh1750fvi_handle_t *handle, uint16_t *raw, float *lux)
 read data from the chip once More...
 
uint8_t bh1750fvi_continuous_read (bh1750fvi_handle_t *handle, uint16_t *raw, float *lux)
 read data from the chip continuously More...
 
uint8_t bh1750fvi_start_continuous_read (bh1750fvi_handle_t *handle)
 start chip reading More...
 
uint8_t bh1750fvi_stop_continuous_read (bh1750fvi_handle_t *handle)
 stop chip reading More...
 
uint8_t bh1750fvi_power_down (bh1750fvi_handle_t *handle)
 power down More...
 
uint8_t bh1750fvi_power_on (bh1750fvi_handle_t *handle)
 power on More...
 
uint8_t bh1750fvi_reset (bh1750fvi_handle_t *handle)
 reset More...
 
uint8_t bh1750fvi_set_measurement_time (bh1750fvi_handle_t *handle, uint8_t t)
 set the measurement time More...
 

Detailed Description

bh1750fvi basic driver modules

Typedef Documentation

◆ bh1750fvi_handle_t

bh1750fvi handle structure definition

◆ bh1750fvi_info_t

bh1750fvi information structure definition

Enumeration Type Documentation

◆ bh1750fvi_address_t

bh1750fvi address enumeration definition

Enumerator
BH1750FVI_ADDRESS_LOW 

addr low

BH1750FVI_ADDRESS_HIGH 

addr high

Definition at line 62 of file driver_bh1750fvi.h.

◆ bh1750fvi_mode_t

bh1750fvi mode enumeration definition

Enumerator
BH1750FVI_MODE_HIGH_RESOLUTION_MODE 

1lx resolution

BH1750FVI_MODE_HIGH_RESOLUTION_MODE2 

0.5lx resolution

BH1750FVI_MODE_LOW_RESOLUTION_MODE 

4lx resolution

Definition at line 71 of file driver_bh1750fvi.h.

Function Documentation

◆ bh1750fvi_continuous_read()

uint8_t bh1750fvi_continuous_read ( bh1750fvi_handle_t handle,
uint16_t *  raw,
float *  lux 
)

read data from the chip continuously

Parameters
[in]*handlepointer to a bh1750fvi handle structure
[out]*rawpointer to a raw lux buffer
[out]*luxpointer to a converted lux buffer
Returns
status code
  • 0 success
  • 1 continuous read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
this function can be used only after run bh1750fvi_start_continuous_read and can be stopped by bh1750fvi_stop_continuous_read

Definition at line 620 of file driver_bh1750fvi.c.

◆ bh1750fvi_deinit()

uint8_t bh1750fvi_deinit ( bh1750fvi_handle_t handle)

close the chip

Parameters
[in]*handlepointer to a bh1750fvi handle structure
Returns
status code
  • 0 success
  • 1 iic deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 power down failed
Note
none

Definition at line 322 of file driver_bh1750fvi.c.

◆ bh1750fvi_get_addr_pin()

uint8_t bh1750fvi_get_addr_pin ( bh1750fvi_handle_t handle,
bh1750fvi_address_t addr_pin 
)

get the address pin

Parameters
[in]*handlepointer to a bh1750fvi handle structure
[out]*addr_pinpointer to a chip address pins buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 140 of file driver_bh1750fvi.c.

◆ bh1750fvi_get_mode()

uint8_t bh1750fvi_get_mode ( bh1750fvi_handle_t handle,
bh1750fvi_mode_t mode 
)

get the mode

Parameters
[in]*handlepointer to a bh1750fvi handle structure
[out]*modepointer to a mode buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 188 of file driver_bh1750fvi.c.

◆ bh1750fvi_info()

uint8_t bh1750fvi_info ( bh1750fvi_info_t info)

get chip's information

Parameters
[out]*infopointer to a bh1750fvi info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 828 of file driver_bh1750fvi.c.

◆ bh1750fvi_init()

uint8_t bh1750fvi_init ( bh1750fvi_handle_t handle)

initialize the chip

Parameters
[in]*handlepointer to a bh1750fvi handle structure
Returns
status code
  • 0 success
  • 1 iic failed
  • 2 handle is NULL
  • 3 linked functions is NULL
  • 4 power on failed
  • 5 reset failed
Note
none

Definition at line 216 of file driver_bh1750fvi.c.

◆ bh1750fvi_power_down()

uint8_t bh1750fvi_power_down ( bh1750fvi_handle_t handle)

power down

Parameters
[in]*handlepointer to a bh1750fvi handle structure
Returns
status code
  • 0 success
  • 1 power down failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 366 of file driver_bh1750fvi.c.

◆ bh1750fvi_power_on()

uint8_t bh1750fvi_power_on ( bh1750fvi_handle_t handle)

power on

Parameters
[in]*handlepointer to a bh1750fvi handle structure
Returns
status code
  • 0 success
  • 1 power on failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 402 of file driver_bh1750fvi.c.

◆ bh1750fvi_reset()

uint8_t bh1750fvi_reset ( bh1750fvi_handle_t handle)

reset

Parameters
[in]*handlepointer to a bh1750fvi handle structure
Returns
status code
  • 0 success
  • 1 reset failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 438 of file driver_bh1750fvi.c.

◆ bh1750fvi_set_addr_pin()

uint8_t bh1750fvi_set_addr_pin ( bh1750fvi_handle_t handle,
bh1750fvi_address_t  addr_pin 
)

set the address pin

Parameters
[in]*handlepointer to a bh1750fvi handle structure
[in]addr_pinchip address pins
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 119 of file driver_bh1750fvi.c.

◆ bh1750fvi_set_measurement_time()

uint8_t bh1750fvi_set_measurement_time ( bh1750fvi_handle_t handle,
uint8_t  t 
)

set the measurement time

Parameters
[in]*handlepointer to a bh1750fvi handle structure
[in]tmeasurement time
Returns
status code
  • 0 success
  • 1 set measurement time failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 t < 31 or t > 254
Note
31 <= t <= 254

Definition at line 476 of file driver_bh1750fvi.c.

◆ bh1750fvi_set_mode()

uint8_t bh1750fvi_set_mode ( bh1750fvi_handle_t handle,
bh1750fvi_mode_t  mode 
)

set the mode

Parameters
[in]*handlepointer to a bh1750fvi handle structure
[in]modechip mode
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 162 of file driver_bh1750fvi.c.

◆ bh1750fvi_single_read()

uint8_t bh1750fvi_single_read ( bh1750fvi_handle_t handle,
uint16_t *  raw,
float *  lux 
)

read data from the chip once

Parameters
[in]*handlepointer to a bh1750fvi handle structure
[out]*rawpointer to a raw lux buffer
[out]*luxpointer to a converted lux buffer
Returns
status code
  • 0 success
  • 1 single read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 mode is invalid
Note
none

Definition at line 530 of file driver_bh1750fvi.c.

◆ bh1750fvi_start_continuous_read()

uint8_t bh1750fvi_start_continuous_read ( bh1750fvi_handle_t handle)

start chip reading

Parameters
[in]*handlepointer to a bh1750fvi handle structure
Returns
status code
  • 0 success
  • 1 start continuous read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 mode is invalid
Note
none

Definition at line 669 of file driver_bh1750fvi.c.

◆ bh1750fvi_stop_continuous_read()

uint8_t bh1750fvi_stop_continuous_read ( bh1750fvi_handle_t handle)

stop chip reading

Parameters
[in]*handlepointer to a bh1750fvi handle structure
Returns
status code
  • 0 success
  • 1 stop continuous read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 mode is invalid
Note
none

Definition at line 724 of file driver_bh1750fvi.c.