can't push chnages :(

Fork of FBRDash by Michael Allan

Committer:
intrinseca
Date:
Mon Jun 25 21:01:02 2012 +0000
Revision:
1:b3907b8d9f65
Child:
2:825f572902c6
Prototype before adding full CAN comms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
intrinseca 1:b3907b8d9f65 1 #include "PCComms.h"
intrinseca 1:b3907b8d9f65 2 #include "mbed.h"
intrinseca 1:b3907b8d9f65 3 #include "State.h"
intrinseca 1:b3907b8d9f65 4
intrinseca 1:b3907b8d9f65 5 Comms::Comms(State* _values)
intrinseca 1:b3907b8d9f65 6 {
intrinseca 1:b3907b8d9f65 7 values = _values;
intrinseca 1:b3907b8d9f65 8 }
intrinseca 1:b3907b8d9f65 9
intrinseca 1:b3907b8d9f65 10 void Comms::process_packet(unsigned char id, int length, unsigned char data[])
intrinseca 1:b3907b8d9f65 11 {
intrinseca 1:b3907b8d9f65 12 switch(id)
intrinseca 1:b3907b8d9f65 13 {
intrinseca 1:b3907b8d9f65 14 case 100:
intrinseca 1:b3907b8d9f65 15 values->rpm = data[0] + (data[1] << 8);
intrinseca 1:b3907b8d9f65 16 values->throttle_pos = data[2];
intrinseca 1:b3907b8d9f65 17 values->manifold_pres = data[3];
intrinseca 1:b3907b8d9f65 18 values->air_temp = data[4];
intrinseca 1:b3907b8d9f65 19 values->coolant_temp = data[5];
intrinseca 1:b3907b8d9f65 20 values->lambda = data[6];
intrinseca 1:b3907b8d9f65 21 break;
intrinseca 1:b3907b8d9f65 22 case 200:
intrinseca 1:b3907b8d9f65 23 values->speed = data[0];
intrinseca 1:b3907b8d9f65 24 values->accel_x = data[1];
intrinseca 1:b3907b8d9f65 25 values->accel_y = data[2];
intrinseca 1:b3907b8d9f65 26 values->gear = data[3];
intrinseca 1:b3907b8d9f65 27 values->oil_temp = data[4];
intrinseca 1:b3907b8d9f65 28 values->oil_pres = data[5];
intrinseca 1:b3907b8d9f65 29 values->warnings = data[6];
intrinseca 1:b3907b8d9f65 30 break;
intrinseca 1:b3907b8d9f65 31 }
intrinseca 1:b3907b8d9f65 32 }