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.
Dependents: CAN_Library_Example Ekran CAN-library
Revision 4:b42c40844d4c, committed 2019-12-11
- Comitter:
- renemagrit
- Date:
- Wed Dec 11 21:46:23 2019 +0000
- Parent:
- 3:a142cf0e7c37
- Commit message:
- Last tested version from september 2019.
Changed in this revision
| CANlibrary.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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;
}
};