Thomas Milburn
/
FBRDash-tom
can't push chnages :(
Fork of FBRDash by
Embed:
(wiki syntax)
Show/hide line numbers
Comms.cpp
00001 #include "PCComms.h" 00002 #include "mbed.h" 00003 #include "State.h" 00004 00005 //Process incoming data from Comms interfaces 00006 00007 //Initialise members 00008 Comms::Comms(State* _values) 00009 { 00010 values = _values; 00011 } 00012 00013 //Process an incoming data packet 00014 void Comms::process_packet(unsigned char id, int length, unsigned char data[]) 00015 { 00016 switch(id) 00017 { 00018 case 100: 00019 values->rpm = data[0] + (data[1] << 8); 00020 values->throttle_pos = data[2]; 00021 values->manifold_pres = data[3]; 00022 values->air_temp = data[4]; 00023 values->coolant_temp = data[5]; 00024 values->lambda = data[6]; 00025 break; 00026 case 200: 00027 values->speed = data[0]; 00028 values->accel_x = data[1]; 00029 values->accel_y = data[2]; 00030 values->gear = data[3]; 00031 values->oil_temp = data[4]; 00032 values->voltage = data[5]; 00033 values->warnings = data[6]; 00034 break; 00035 } 00036 }
Generated on Wed Jul 13 2022 14:23:01 by 1.7.2