aio: fix for maa aio API change and make required libmaa version exactly 0.2.3

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll 2014-05-14 14:09:41 +01:00
parent 8065ed42fd
commit d6bb8bc1db
2 changed files with 6 additions and 5 deletions

View File

@ -8,7 +8,8 @@ endif ()
find_package (Threads REQUIRED) find_package (Threads REQUIRED)
find_package (PkgConfig REQUIRED) find_package (PkgConfig REQUIRED)
pkg_check_modules (MAA REQUIRED maa>=0.2.2) # force the libmaa version to be the required version
pkg_check_modules (MAA REQUIRED maa=0.2.3)
message (INFO " found libmaa version: ${MAA_VERSION}") message (INFO " found libmaa version: ${MAA_VERSION}")
set (CMAKE_SWIG_FLAGS "") set (CMAKE_SWIG_FLAGS "")

View File

@ -78,7 +78,7 @@ GroveTemp::~GroveTemp()
int GroveTemp::value () int GroveTemp::value ()
{ {
int a = maa_aio_read_u16(m_aio); int a = maa_aio_read(m_aio);
float r = (float)(1023-a)*10000/a; float r = (float)(1023-a)*10000/a;
float t = 1/(logf(r/10000)/3975 + 1/298.15)-273.15; float t = 1/(logf(r/10000)/3975 + 1/298.15)-273.15;
return (int) t; return (int) t;
@ -86,7 +86,7 @@ int GroveTemp::value ()
float GroveTemp::raw_value() float GroveTemp::raw_value()
{ {
return (float) maa_aio_read_u16(m_aio); return (float) maa_aio_read(m_aio);
} }
//// GroveLight //// //// GroveLight ////
@ -106,12 +106,12 @@ GroveLight::~GroveLight()
int GroveLight::value () int GroveLight::value ()
{ {
// rough conversion to Lux // rough conversion to Lux
int a = maa_aio_read_u16(m_aio); int a = maa_aio_read(m_aio);
a = 10000/(((1023-a)*10/a)*15)^(4/3); a = 10000/(((1023-a)*10/a)*15)^(4/3);
return a; return a;
} }
float GroveLight::raw_value() float GroveLight::raw_value()
{ {
return (float) maa_aio_read_u16(m_aio); return (float) maa_aio_read(m_aio);
} }