Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed TextLCD PinDetect
src/Comms.cpp
- Committer:
- tomontoast
- Date:
- 2012-10-14
- Revision:
- 5:177520d43c87
- Parent:
- 2:825f572902c6
File content as of revision 5:177520d43c87:
#include "PCComms.h"
#include "mbed.h"
#include "State.h"
//Process incoming data from Comms interfaces
//Initialise members
Comms::Comms(State* _values)
{
values = _values;
}
//Process an incoming data packet
void Comms::process_packet(unsigned char id, int length, unsigned char data[])
{
switch(id)
{
case 100:
values->rpm = data[0] + (data[1] << 8);
values->throttle_pos = data[2];
values->manifold_pres = data[3];
values->air_temp = data[4];
values->coolant_temp = data[5];
values->lambda = data[6];
break;
case 200:
values->speed = data[0];
values->accel_x = data[1];
values->accel_y = data[2];
values->gear = data[3];
values->oil_temp = data[4];
values->voltage = data[5];
values->warnings = data[6];
break;
}
}
