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

@ -40,7 +40,7 @@ MAX44009::MAX44009 (int bus, int devAddr) {
// Reset chip to defaults
status = mraa::SUCCESS;
reset();
if (!isConfigured())
if (status != mraa::SUCCESS)
UPM_THROW("config failure");
}
@ -81,19 +81,14 @@ double
MAX44009::getVisibleLux() {
uint16_t rawValue = getVisibleRaw();
uint8_t rawValueMsb = rawValue >> 8;
uint8_t rawValueLsb = rawValue & 0xFF;
uint8_t rawValueLsb = rawValue & 0xFF;
uint8_t exponent = (( rawValueMsb & 0xF0 ) >> 4);
uint8_t mantissa = (( rawValueMsb & 0x0F ) << 4 ) | ( rawValueLsb & 0x0F );
// Check for overrange condition
if(exponent == MAX44009_OVERRANGE_CONDITION)
UPM_THROW("Overrange error");
if(exponent == MAX44009_OVERRANGE_CONDITION)
UPM_THROW("Overrange error");
return pow((double)2,(double)exponent) * mantissa * 0.045;
}
bool
MAX44009::isConfigured() {
return status == mraa::SUCCESS;
}

View File

@ -129,12 +129,8 @@ class MAX44009 : public ILightSensor {
* Read the lux value
*/
double getVisibleLux();
/**
* Returns whether the sensor is configured.
*/
bool isConfigured();
const char* getModuleName() { return "max44009"; }
const char* getModuleName() { return "max44009"; }
private:
mraa::Result reset();