ADD sensor device classes
This commit is contained in:
21
common/sensor_device.cpp
Normal file
21
common/sensor_device.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "sensor_device.hpp"
|
||||
|
||||
namespace bike_computer {
|
||||
|
||||
SensorDevice::SensorDevice() : _hdc1000(I2C_SDA, I2C_SCL, STMOD_11)
|
||||
{}
|
||||
|
||||
bool SensorDevice::init() {
|
||||
return this->_hdc1000.probe();
|
||||
}
|
||||
|
||||
float SensorDevice::readTemperature(void) {
|
||||
return this->_hdc1000.getTemperature();
|
||||
}
|
||||
|
||||
float SensorDevice::readHumidity(void) {
|
||||
return this->_hdc1000.getHumidity();
|
||||
}
|
||||
|
||||
} // bike_computer
|
||||
|
||||
Reference in New Issue
Block a user