PressureWraper: isAwake() and wakeUp() add
This commit is contained in:
parent
7871953fe6
commit
905fbd3634
@ -47,11 +47,7 @@ PressureWrapper::getPressure ()
|
|||||||
int16_t pressure = 0;
|
int16_t pressure = 0;
|
||||||
if (!getRawPressure ())
|
if (!getRawPressure ())
|
||||||
{
|
{
|
||||||
unsigned int i = 0;
|
return -255;
|
||||||
while (i < 7200)
|
|
||||||
i++;
|
|
||||||
getRawPressure ();
|
|
||||||
i = 0;
|
|
||||||
}
|
}
|
||||||
if (crc8 (data.rBuffer, 2) == data.crc)
|
if (crc8 (data.rBuffer, 2) == data.crc)
|
||||||
{
|
{
|
||||||
@ -61,18 +57,19 @@ PressureWrapper::getPressure ()
|
|||||||
float result = (float)pressure * 0.95 / 240;
|
float result = (float)pressure * 0.95 / 240;
|
||||||
return (int)result;
|
return (int)result;
|
||||||
}
|
}
|
||||||
return -255;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PressureWrapper::isAwake ()
|
PressureWrapper::isAwake ()
|
||||||
{
|
{
|
||||||
return true;
|
return getRawPressure();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PressureWrapper::wakeUp ()
|
PressureWrapper::wakeUp ()
|
||||||
{
|
{
|
||||||
|
uint8_t getMeasurementComm = 0xFE;
|
||||||
|
i2c->transaction (ADDRESS, &getMeasurementComm, 1, data.rBuffer, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user