interfaces: Removed isConfigured() from IModuleStaus

Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
This commit is contained in:
Henry Bruce
2016-01-21 16:25:49 -08:00
committed by Abhishek Malik
parent f268437cd5
commit 9bc3d2ded0
23 changed files with 132 additions and 224 deletions

View File

@ -33,9 +33,9 @@
using namespace upm;
BMPX8X::BMPX8X (int bus, int devAddr, uint8_t mode) : m_controlAddr(devAddr), m_i2ControlCtx(bus) {
m_name = "BMPX8X";
mraa::Result ret = m_i2ControlCtx.address(m_controlAddr);
if (ret != mraa::SUCCESS) {
throw std::invalid_argument(std::string(__FUNCTION__) +
@ -93,7 +93,8 @@ BMPX8X::getPressure () {
B7 = ((uint32_t)UP - B3) * (uint32_t)( 50000UL >> oversampling );
if (B7 < 0x80000000) {
p = (B7 * 2) / B4;
p = (B7 * 2) / B4
;
} else {
p = (B7 / B4) * 2;
}
@ -169,6 +170,18 @@ BMPX8X::getAltitude (float sealevelPressure) {
return altitude;
}
int
BMPX8X::getTemperatureCelcius() {
return static_cast<int>(getTemperature() + 0.5);
}
const char*
BMPX8X::getModuleName() {
return m_name.c_str();
}
int32_t
BMPX8X::computeB5(int32_t UT) {
int32_t X1 = (UT - (int32_t)ac6) * ((int32_t)ac5) >> 15;

View File

@ -30,6 +30,7 @@
#include <string>
#include <mraa/i2c.hpp>
#include <math.h>
#include "upm/iTemperatureSensor.h"
#define ADDR 0x77 // device address
@ -88,7 +89,7 @@ namespace upm {
* @snippet bmpx8x.cxx Interesting
*/
class BMPX8X {
class BMPX8X : public ITemperatureSensor {
public:
/**
* Instantiates a BMPX8X object
@ -141,6 +142,19 @@ class BMPX8X {
*/
float getAltitude (float sealevelPressure = 101325);
/**
* Return latest calculated temperature value in Celcius
* See ITemperatureSensor
*/
int getTemperatureCelcius();
/**
* Returns name of module. This is the string in library name after libupm_
* @return name of module
*/
const char* getModuleName();
/**
* Calculates B5 (check the spec for more information)
*