15.02.2019. revision

Dependencies:   mbed LCD_DISCO_F469NIa SD_DISCO_F469NI BSP_DISCO_F469NIa EEPROM_DISCO_F469NI

Revision:
3:a06e417a5a2c
Parent:
2:f54f01527ebb
Child:
4:0e8413277df8
--- a/CAN_library.cpp	Thu Jun 28 16:33:23 2018 +0000
+++ b/CAN_library.cpp	Thu Jul 05 20:18:32 2018 +0000
@@ -16,50 +16,57 @@
 extern int FL_LVDT_Ref,FR_LVDT_Ref,RL_LVDT_Ref,RR_LVDT_Ref;
 int LVDT_Max=150;
 extern float Meter_counter,Meter_counter0;
+extern char cmd[3];
+extern int addr;
+extern I2C i2c;
+
+extern void showLedRpm(int rpm);
+
 
 void CANMsgReceive(){                     // CAN RX Interrupt Function
     CANMessage tmpMsg;
     if (can.read(tmpMsg)) {                 //Detect message
         //pc.printf("%x\n",tmpMsg.id);       
         switch(tmpMsg.id){                  //Find which DTA message is received 
-            case(0):
+            case(0x2000):
                 rx_flag|=(1<<0);
                 msgDTA1=tmpMsg;
+                //pc.printf("%x\n", tmpMsg.id);
                 break;
-            case(1):
+            case(0x2001):
                 rx_flag|=(1<<1);
                 msgDTA2=tmpMsg;
                 //pc.printf("rx_flag=%x\n",rx_flag);
                 break;
-            case(2):
+            case(0x2002):
                 rx_flag|=(1<<2);
                 msgDTA3=tmpMsg;
                 break;
-            case(3):
+            case(0x2003):
                 rx_flag|=(1<<3);
                 msgDTA4=tmpMsg;
                 break;
-            case(4):
+            case(0x2004):
                 rx_flag|=(1<<4);
                 msgDTA5=tmpMsg;
                 break;
-            case(5):
+            case(0x2005):
                 rx_flag|=(1<<5);
                 msgDTA6=tmpMsg;
                 break;
-            case(6):
+            case(0x1006):
                 rx_flag|=(1<<6);
                 msgLVDTFront=tmpMsg;
                 break;
-            case(7):
+            case(0x1007):
                 rx_flag|=(1<<7);
                 msgLVDTRear=tmpMsg;
                 break;
-            case(8):
+            case(0x1008):
                 rx_flag|=(1<<8);
                 msgBrakes=tmpMsg;
                 break;
-            case(9):
+            case(0x1009):
                 rx_flag|=(1<<9);
                 msgDistance=tmpMsg;
         };
@@ -173,12 +180,14 @@
 void UpdateInfoDTA1(uint16_t newData[4]){                //Update values for DTA1 message
     Rpm0=Rpm;
     Rpm=newData[0];
+    showLedRpm(Rpm);
     TPS0=TPS;
     TPS=newData[1];
     Water_Temp0=Water_Temp;
     Water_Temp=newData[2];
     Air_Temp0=Air_Temp;
     Air_Temp=newData[3];
+    //pc.printf("%d %d %d %d", Rpm, TPS,Water_Temp,Air_Temp);
 };
 
 void UpdateInfoDTA2(uint16_t newData[4]){                //Update values for DTA2 message