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
Child:
6:506b703a8acf
Split pids into files.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chrta 5:0b229ba8ede5 1 #include "VehicleSpeed.h"
chrta 5:0b229ba8ede5 2
chrta 5:0b229ba8ede5 3 VehicleSpeed::VehicleSpeed()
chrta 5:0b229ba8ede5 4 : PidValue("Speed", "km/h")
chrta 5:0b229ba8ede5 5 {
chrta 5:0b229ba8ede5 6 }
chrta 5:0b229ba8ede5 7
chrta 5:0b229ba8ede5 8 bool VehicleSpeed::decode(const uint8_t* data, uint16_t length)
chrta 5:0b229ba8ede5 9 {
chrta 5:0b229ba8ede5 10 if (length < 2)
chrta 5:0b229ba8ede5 11 {
chrta 5:0b229ba8ede5 12 return false;
chrta 5:0b229ba8ede5 13 }
chrta 5:0b229ba8ede5 14
chrta 5:0b229ba8ede5 15 if ((data[1] != 0x0D) || length != 3)
chrta 5:0b229ba8ede5 16 {
chrta 5:0b229ba8ede5 17 return false;
chrta 5:0b229ba8ede5 18 }
chrta 5:0b229ba8ede5 19
chrta 5:0b229ba8ede5 20 m_value = data[2]; // km/h
chrta 5:0b229ba8ede5 21 return true;
chrta 5:0b229ba8ede5 22 }