Date: April 2019. Version: 1.0.2. Can Library RX/TX, IDadress and data position. 3 independent timers for sending

Dependents:   CAN_Library_Example Ekran CAN-library

Revision:
4:b42c40844d4c
Parent:
3:a142cf0e7c37
--- a/CANlibrary.cpp	Thu Oct 03 19:31:21 2019 +0000
+++ b/CANlibrary.cpp	Wed Dec 11 21:46:23 2019 +0000
@@ -3,6 +3,7 @@
 
 extern CAN can;
 extern Serial pc;
+
 Ticker tick1; //!!!!!!!!!!!!!!!!!!!!!!!!!!!!! nije hteo da se prevede kao extern
 Ticker tick2;
 Ticker tick3;
@@ -17,30 +18,19 @@
 
 
 bool can_flag[16];
-CANMessage msgs[1024];
+CANMessage msgs[16];
 char data[8],data1[8],data2[8],data3[8];
 char idTX=0,idTX1=0,idTX2=0,idTX3=0;
 float msgInterval1=0,msgInterval2=0,msgInterval3=0;
 
 void can_initRX(){
-   // pc.printf("u RX sam\r\n");
     can.attach(can_msg_receive, CAN::RxIrq); 
 }
-void can_msg_receive(){  
-   // CAN RX Interrupt Function
-    //pc.printf(" I N T RA P T \r\n");
+void can_msg_receive(){                     // CAN RX Interrupt Function
     CANMessage tmpMsg;
     if (can.read(tmpMsg)) {                 //Detect message
-        //pc.printf("p r i m i o \r\n");
         can_flag[tmpMsg.id]=true;
-       // msgs[tmpMsg.id]=tmpMsg;
-        //pc.printf("PRIMLJEN id: %d\r\n",tmpMsg.id);
-        if(tmpMsg.id >= 8192){
-            msgs[(tmpMsg.id % 8192)]=tmpMsg;  
-        }else{
-            msgs[tmpMsg.id]=tmpMsg;  
-        }
-        
+        msgs[tmpMsg.id%16]=tmpMsg;
     }
 };