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
Diff: src/Comms.cpp
- Revision:
- 1:b3907b8d9f65
- Child:
- 2:825f572902c6
diff -r 1f422ed56e0f -r b3907b8d9f65 src/Comms.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Comms.cpp Mon Jun 25 21:01:02 2012 +0000
@@ -0,0 +1,32 @@
+#include "PCComms.h"
+#include "mbed.h"
+#include "State.h"
+
+Comms::Comms(State* _values)
+{
+ values = _values;
+}
+
+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->oil_pres = data[5];
+ values->warnings = data[6];
+ break;
+ }
+}
\ No newline at end of file
