theCore C++ embedded framework
ecl::sensor::bh1750< i2c_dev, address > Class Template Reference

BH1750 Ambient Light sensor driver implementation. More...

#include </home/travis/build/forGGe/theCore/dev/sensor/bh1750/export/dev/sensor/bh1750.hpp>

Public Member Functions

 bh1750 ()=delete
 
 ~bh1750 ()=delete
 

Static Public Member Functions

static ecl::err init ()
 Inits sensor and underlying I2C platform bus. More...
 
static void set_resolution (bh1750_cfg::resolution resolution)
 Sets sensor resolution mode. More...
 
static bh1750_cfg::resolution get_resolution ()
 Returns current sensor resolution mode. More...
 
static ecl::err get_illuminance_sample (uint16_t &sample)
 Reads raw illuminance sample from sensor. More...
 
static ecl::err get_illuminance (uint32_t &value)
 Reads sample from sensor and converts to a physical value. More...
 

Detailed Description

template<class i2c_dev, bh1750_cfg::i2c_address address>
class ecl::sensor::bh1750< i2c_dev, address >

BH1750 Ambient Light sensor driver implementation.

Template Parameters
i2c_devI2C generic bus driver
addressI2C slave address. This parameter can be value of type bh1750_cfg::i2c_address

Constructor & Destructor Documentation

◆ bh1750()

template<class i2c_dev , bh1750_cfg::i2c_address address>
ecl::sensor::bh1750< i2c_dev, address >::bh1750 ( )
delete

◆ ~bh1750()

template<class i2c_dev , bh1750_cfg::i2c_address address>
ecl::sensor::bh1750< i2c_dev, address >::~bh1750 ( )
delete

Member Function Documentation

◆ init()

template<class i2c_dev , bh1750_cfg::i2c_address address>
ecl::err ecl::sensor::bh1750< i2c_dev, address >::init ( )
static

Inits sensor and underlying I2C platform bus.

Return values
Statusof operation.

◆ set_resolution()

template<class i2c_dev , bh1750_cfg::i2c_address address>
void ecl::sensor::bh1750< i2c_dev, address >::set_resolution ( bh1750_cfg::resolution  resolution)
static

Sets sensor resolution mode.

Default mode is bh1750_cfg::high.

Parameters
[in]resolutionResolution mode. This parameter can be value of type bh1750_cfg::resolution.

◆ get_resolution()

template<class i2c_dev , bh1750_cfg::i2c_address address>
bh1750_cfg::resolution ecl::sensor::bh1750< i2c_dev, address >::get_resolution ( )
static

Returns current sensor resolution mode.

Return values
Currentresolution mode. The return value can be value of type bh1750_cfg::resolution.

◆ get_illuminance_sample()

template<class i2c_dev , bh1750_cfg::i2c_address address>
ecl::err ecl::sensor::bh1750< i2c_dev, address >::get_illuminance_sample ( uint16_t &  sample)
static

Reads raw illuminance sample from sensor.

This method blocks until measurement is not finished. Measurement time depends on resolution mode: at least 25 ms for low mode and 200 ms for high and high2 modes.

Parameters
[out]sampleRaw sample value will be written in this parameter.
Return values
Statusof the operation.
Here is the call graph for this function:

◆ get_illuminance()

template<class i2c_dev , bh1750_cfg::i2c_address address>
ecl::err ecl::sensor::bh1750< i2c_dev, address >::get_illuminance ( uint32_t &  value)
static

Reads sample from sensor and converts to a physical value.

This method blocks until measurement is not finished. Measurement time depends on resolution mode: at least 25 ms for low mode and 200 ms for high and high2 modes.

Parameters
[out]valueIlluminance in (1000 * (illuminance in lx)) will be written in this parameter.
Return values
Statusof the operation.

low resolution provides 4lx per count and high2 0.5lx per count


The documentation for this class was generated from the following file: