Small project to display some OBD values from the Toyota GT86/ Subaru BRZ/ Scion FRS on an OLED display.

Dependencies:   Adafruit_GFX MODSERIAL mbed-rtos mbed

PidDecoder.cpp

Committer:
chrta
Date:
2014-04-27
Revision:
5:0b229ba8ede5
Parent:
3:eb807d330292
Child:
6:506b703a8acf

File content as of revision 5:0b229ba8ede5:

#include "PidDecoder.h"
#include "EngineCoolantTemperature.h"
#include "EngineRpm.h"
#include "VehicleSpeed.h"
#include "Throttle.h"
#include "OilTemperature.h"

#include "DebugPrint.h"

static VehicleSpeed speed;
static EngineRpm rpm;
static EngineCoolantTemp temp;
static Throttle throttle;
OilTemperature oilTemperature;
static PidValue* pids[] =
{ &speed, &rpm, &temp, &throttle, &oilTemperature
};                             
                             
void PidDecoder::decode(const uint8_t* data, uint16_t length)
{   
    for (unsigned int i = 0; i < sizeof(pids) / sizeof(pids[0]); i++)
    {
        if (pids[i]->decode(data, length))
        {
            pc.printf("New Value for %s: ", pids[i]->getName());
            pids[i]->print();
        }
    }
}