Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Adafruit_GFX MODSERIAL mbed-rtos mbed
EngineRpm.cpp
- Committer:
- chrta
- Date:
- 2014-05-01
- Revision:
- 6:506b703a8acf
- Parent:
- 5:0b229ba8ede5
File content as of revision 6:506b703a8acf:
#include "EngineRpm.h"
const char EngineRpm::REQUEST_DATA[8] = {0x02, 0x01, 0x0C, 0, 0, 0, 0, 0};
EngineRpm::EngineRpm()
: PidValue("Engine RPM", "rpm")
{
}
bool EngineRpm::decode(const uint8_t* data, uint16_t length)
{
if (length < 2)
{
return false;
}
if ((data[1] != 0x0C) || length != 4)
{
return false;
}
m_value = ((data[2] << 8) | data[3]) >> 2; //rpm
return true;
}