BH1750 Measurement time (#997)

* BH1750 Measurement time

Fixes https://github.com/esphome/feature-requests/issues/148

* lint

* add test

Co-authored-by: Otto Winter <otto@otto-winter.com>
Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
This commit is contained in:
rradar
2020-05-29 03:10:34 +01:00
committed by GitHub
parent 7e4d12f880
commit d1f4c2ab57
4 changed files with 17 additions and 1 deletions
+2
View File
@@ -28,6 +28,7 @@ class BH1750Sensor : public sensor::Sensor, public PollingComponent, public i2c:
* @param resolution The new resolution of the sensor.
*/
void set_resolution(BH1750Resolution resolution);
void set_measurement_time(uint8_t measurement_time) { measurement_time_ = measurement_time; }
// ========== INTERNAL METHODS ==========
// (In most use cases you won't need these)
@@ -40,6 +41,7 @@ class BH1750Sensor : public sensor::Sensor, public PollingComponent, public i2c:
void read_data_();
BH1750Resolution resolution_{BH1750_RESOLUTION_0P5_LX};
uint8_t measurement_time_;
};
} // namespace bh1750