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

@ -32,7 +32,7 @@ using namespace upm;
APDS9002::APDS9002(int pin)
{
if ( !(m_aio = mraa_aio_init(pin)) )
if ( !(m_aio = mraa_aio_init(pin)) )
{
throw std::invalid_argument(std::string(__FUNCTION__) +
": mraa_aio_init() failed, invalid pin?");
@ -49,3 +49,8 @@ int APDS9002::value()
{
return mraa_aio_read(m_aio);
}
float APDS9002::getLuminance()
{
return value();
}

View File

@ -25,6 +25,7 @@
#include <string>
#include <mraa/aio.h>
#include <interfaces/iLight.hpp>
namespace upm {
/**
@ -52,7 +53,7 @@ namespace upm {
* @snippet apds9002.cxx Interesting
*/
class APDS9002 {
class APDS9002 : virtual public iLight {
public:
/**
* APDS-9002 luminance sensor constructor
@ -71,6 +72,13 @@ namespace upm {
*/
int value();
/**
* Gets the luminance value from the sensor
*
* @return The measured light intensity value in Lux
*/
virtual float getLuminance();
private:
mraa_aio_context m_aio;
};