BH1750 Ambient Light sensor driver implementation.
More...
#include </home/travis/build/forGGe/theCore/dev/sensor/bh1750/export/dev/sensor/bh1750.hpp>
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_dev | I2C generic bus driver |
address | I2C slave address. This parameter can be value of type bh1750_cfg::i2c_address |
◆ bh1750()
template<class i2c_dev , bh1750_cfg::i2c_address address>
◆ ~bh1750()
template<class i2c_dev , bh1750_cfg::i2c_address address>
◆ init()
template<class i2c_dev , bh1750_cfg::i2c_address address>
Inits sensor and underlying I2C platform bus.
- Return values
-
◆ set_resolution()
template<class i2c_dev , bh1750_cfg::i2c_address address>
Sets sensor resolution mode.
Default mode is bh1750_cfg::high.
- Parameters
-
◆ get_resolution()
template<class i2c_dev , bh1750_cfg::i2c_address address>
Returns current sensor resolution mode.
- Return values
-
◆ get_illuminance_sample()
template<class i2c_dev , bh1750_cfg::i2c_address address>
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] | sample | Raw sample value will be written in this parameter. |
- Return values
-
◆ get_illuminance()
template<class i2c_dev , bh1750_cfg::i2c_address address>
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] | value | Illuminance in (1000 * (illuminance in lx)) will be written in this parameter. |
- Return values
-
low resolution provides 4lx per count and high2 0.5lx per count
The documentation for this class was generated from the following file: