The Code Repository for the REV0 Steering Wheel.

Dependencies:   CANBuffer KS0108_fork mbed-rtos mbed CAN Addresses

Fork of REVO_Updated_Steering by Penn Electric

Revision:
16:d2953809fb31
Parent:
15:da14227cdd1d
Child:
19:5c03aa4dfde1
Child:
28:3ebe6db73fe0
--- a/Steering.cpp	Sat Oct 18 17:19:43 2014 +0000
+++ b/Steering.cpp	Sat Oct 18 18:26:44 2014 +0000
@@ -14,7 +14,7 @@
     display.PrintString(" HOME SCREEN");
     while( !(biSWTL.read() || biSWTR.read() || biSWBR.read()) )
     {
-        if(CAN_Steering.read(Rxmsg))
+        if(CAN_Steering_Buffer.rxRead(Rxmsg))
         {
             for(int i=0; i<4; i++)
                 rcv.C_FLOAT[i]=Rxmsg.data[i];
@@ -58,7 +58,7 @@
     while( !(biSWTL.read() || biSWTR.read() || biSWBL.read()) )
     {
         printf("iN LOOP1");
-        if(CAN_Steering.read(Rxmsg))
+        if(CAN_Steering_Buffer.rxRead(Rxmsg))
         {
             for(int i=0; i<4; i++)
                 rcv.C_FLOAT[i]=Rxmsg.data[i];
@@ -126,7 +126,7 @@
     while( !(biSWTL.read() || biSWTR.read() || biSWBL.read()) )
     {
         printf("iN LOOP2");
-        if(CAN_Steering.read(Rxmsg))
+        if(CAN_Steering_Buffer.rxRead(Rxmsg))
         {
             for(int i=0; i<4; i++)
                 rcv.C_FLOAT[i]=Rxmsg.data[i];
@@ -221,7 +221,7 @@
     }
     
     for(int i = 0; i < 10; i++){
-        CAN_Steering.write(Txmsg_drive_status_request);
+        CAN_Steering_Buffer.txWrite(Txmsg_drive_status_request);
     }
 
     display.ClearScreen();
@@ -237,6 +237,8 @@
 
 void reset()
 {
+    CAN_Steering_Buffer.txWriteDirect(Txmsg_reset);
+    mbed_reset();
     display.ClearScreen();
     display.SelectFont(Arial12,BLACK,ReadData);
     display.GotoXY(16,16);
@@ -252,7 +254,7 @@
     float power_ratio;
     ftc rcv;
     rcv.FLOAT=0.0;
-    if(CAN_Steering.read(Rxmsg))
+    if(CAN_Steering_Buffer.rxRead(Rxmsg))
     {   
         if(Rxmsg.id == BATTERY_POWER_ID)
         {
@@ -268,7 +270,6 @@
 void Init()
 {
     pc.baud(230400);
-    CAN_Steering.frequency(500000);
     drive_status = 0;
     drive_status_request = 1;
     reset_body = 0;