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: Servo mbed-rtos mbed
Diff: diag.cpp
- Revision:
- 3:bfc20ec72b15
- Parent:
- 2:7dfc8dd6aab3
diff -r 7dfc8dd6aab3 -r bfc20ec72b15 diag.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/diag.cpp Sun Oct 11 21:17:42 2015 +0000
@@ -0,0 +1,28 @@
+#include "car_config.hpp"
+#include "can.hpp"
+#include "net.hpp"
+#include "mbed.h"
+#include "rtos.h"
+
+void init_diag () {
+}
+
+void thread_diag (void const *args) {
+ while(1) {
+ if (can_cmd_diag.flag == CAN_FLAG_RECEIVED) {
+ uint16 cmd = can_cmd_diag.payload.msg.cmd;
+ uint32 data = can_cmd_diag.payload.msg.data;
+ switch(cmd) {
+ case CMD_ECHO:
+ can_sts_diag.payload.msg.data = data;
+ can_sts_diag.flag = CAN_FLAG_SEND;
+ break;
+ default:
+ //ignore it
+ break;
+ }
+ can_cmd_diag.flag = CAN_FLAG_EMPTY;
+ }
+ Thread::wait(DIAG_THREAD_PERIOD);
+ }
+}