Added initial interfaces and some sensors implementing them

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Mihai Stefanescu
2018-06-12 18:46:49 +03:00
committed by Mihai Tudor Panu
parent 6bf21a23e7
commit f035470822
102 changed files with 1183 additions and 182 deletions

View File

@ -55,6 +55,11 @@ uint16_t IMS::get_moisture()
return retval;
}
int IMS::getMoisture()
{
return get_moisture();
}
uint16_t IMS::get_light()
{
uint16_t retval;
@ -73,6 +78,11 @@ float IMS::get_temperature()
return static_cast<float>(retval)/10.0;
}
float IMS::getTemperature()
{
return get_temperature();
}
void IMS::reset_i2c_address(uint8_t address_new)
{
if (ims_reset_i2c_address(_dev, address_new) != UPM_SUCCESS)

View File

@ -24,6 +24,8 @@
#pragma once
#include <interfaces/iMoisture.hpp>
#include <interfaces/iTemperature.hpp>
#include "ims.h"
namespace upm {
@ -55,7 +57,7 @@ namespace upm {
* @snippet ims.cxx Interesting
*/
class IMS {
class IMS : virtual public iMoisture, virtual public iTemperature {
public:
/**
* I2C Moisture Sensor constructor
@ -103,6 +105,13 @@ class IMS {
*/
uint16_t get_moisture();
/**
* Get moisture reading from sensor
* @return Unitless, relative capacitance value (moisture)
* @throws std::runtime_error if I2C read command fails
*/
virtual int getMoisture();
/**
* Get light reading from LED on device. The technical data for the I2C
* moisture sensor specifies a 3 second wait. Loop for 3 seconds
@ -122,6 +131,13 @@ class IMS {
*/
float get_temperature();
/**
* Get temperature reading from device
* @return rd_data Temperature in degrees Celsius
* @throws std::runtime_error if I2C read command fails
*/
virtual float getTemperature();
/**
* Reset sensor
* @throws std::runtime_error if I2C write command fails