mirror of
https://github.com/eclipse/upm.git
synced 2025-07-27 06:01:16 +03:00
Added initial interfaces and some sensors implementing them
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
6bf21a23e7
commit
f035470822
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
Reference in New Issue
Block a user