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

Committer:
chrta
Date:
Sun Apr 27 19:13:35 2014 +0000
Revision:
5:0b229ba8ede5
Parent:
3:eb807d330292
Child:
6:506b703a8acf
Split pids into files.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chrta 3:eb807d330292 1 #include "PidDecoder.h"
chrta 5:0b229ba8ede5 2 #include "EngineCoolantTemperature.h"
chrta 5:0b229ba8ede5 3 #include "EngineRpm.h"
chrta 5:0b229ba8ede5 4 #include "VehicleSpeed.h"
chrta 5:0b229ba8ede5 5 #include "Throttle.h"
chrta 5:0b229ba8ede5 6 #include "OilTemperature.h"
chrta 3:eb807d330292 7
chrta 5:0b229ba8ede5 8 #include "DebugPrint.h"
chrta 3:eb807d330292 9
chrta 3:eb807d330292 10 static VehicleSpeed speed;
chrta 3:eb807d330292 11 static EngineRpm rpm;
chrta 3:eb807d330292 12 static EngineCoolantTemp temp;
chrta 3:eb807d330292 13 static Throttle throttle;
chrta 3:eb807d330292 14 OilTemperature oilTemperature;
chrta 3:eb807d330292 15 static PidValue* pids[] =
chrta 3:eb807d330292 16 { &speed, &rpm, &temp, &throttle, &oilTemperature
chrta 3:eb807d330292 17 };
chrta 3:eb807d330292 18
chrta 3:eb807d330292 19 void PidDecoder::decode(const uint8_t* data, uint16_t length)
chrta 3:eb807d330292 20 {
chrta 3:eb807d330292 21 for (unsigned int i = 0; i < sizeof(pids) / sizeof(pids[0]); i++)
chrta 3:eb807d330292 22 {
chrta 3:eb807d330292 23 if (pids[i]->decode(data, length))
chrta 3:eb807d330292 24 {
chrta 3:eb807d330292 25 pc.printf("New Value for %s: ", pids[i]->getName());
chrta 3:eb807d330292 26 pids[i]->print();
chrta 3:eb807d330292 27 }
chrta 3:eb807d330292 28 }
chrta 3:eb807d330292 29 }