mirror of
https://github.com/eclipse/upm.git
synced 2025-07-03 18:31:13 +03:00
mhz16: Split the getData(int* gas, int *temp) function into two separate functions and updated the C++ an Java examples
Signed-off-by: Stefan Andritoiu <stefan.andritoiu@intel.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
f8a105adbf
commit
7f7fdb8441
@ -183,7 +183,7 @@ bool MHZ16::verifyPacket(uint8_t *pkt, int len)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MHZ16::getData(int *gas, int *temp)
|
||||
bool MHZ16::getData()
|
||||
{
|
||||
// the query command
|
||||
const unsigned char cmd[9] =
|
||||
@ -214,12 +214,22 @@ bool MHZ16::getData(int *gas, int *temp)
|
||||
verifyPacket(packet, sizeof(packet));
|
||||
|
||||
// pull out the data and return it.
|
||||
*gas = (packet[2] << 8) | packet[3];
|
||||
*temp = packet[4] - 40;
|
||||
gas = (packet[2] << 8) | packet[3];
|
||||
temp = packet[4] - 40;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int MHZ16::getGas()
|
||||
{
|
||||
return gas;
|
||||
}
|
||||
|
||||
int MHZ16::getTemperature()
|
||||
{
|
||||
return temp;
|
||||
}
|
||||
|
||||
void MHZ16::calibrateZeroPoint()
|
||||
{
|
||||
// the query command
|
||||
|
Reference in New Issue
Block a user