Small project to display some OBD values from the Toyota GT86/ Subaru BRZ/ Scion FRS on an OLED display.
Dependencies: Adafruit_GFX MODSERIAL mbed-rtos mbed
Diff: main.cpp
- Revision:
- 3:eb807d330292
- Parent:
- 2:d3d61d9d323e
- Child:
- 4:0e2d6cc31afb
--- a/main.cpp Sun Apr 27 14:50:13 2014 +0000 +++ b/main.cpp Sun Apr 27 17:11:32 2014 +0000 @@ -4,7 +4,7 @@ #include "MODSERIAL.h" #define CAN1_TEST -#define CAN1_OBD_CAR_SIMULATOR +// #define CAN1_OBD_CAR_SIMULATOR // Make TX buffer 1024bytes and RX buffer use 512bytes. MODSERIAL pc(USBTX, USBRX, 2 * 1024, 512); // tx, rx @@ -86,6 +86,11 @@ can1_rx_queue.free(msg); return; } + if ((msg->id != 0x7E8) && (msg->id != 0x7E0)) + { + can1_rx_queue.free(msg); + return; + } can1_rx_queue.put(msg); led4 = !led4; } @@ -168,6 +173,7 @@ } } +#ifdef CAN1_OBD_CAR_SIMULATOR void can1_send_packets(void const *args) { pc.printf("TX1 start\r\n"); while (true) { @@ -188,6 +194,7 @@ } } } +#endif //CAN1_OBD_CAR_SIMULATOR #endif //CAN1_TEST @@ -246,7 +253,9 @@ can1.frequency(500000); can1.attach(&can1_rx_int_handler); Thread can1_thread(can1_process_packets); +#ifdef CAN1_OBD_CAR_SIMULATOR Thread can1_tx_thread(can1_send_packets); +#endif //CAN1_OBD_CAR_SIMULATOR #endif //CAN1_TEST pc.printf("Start\r\n"); while (true) {