CANMessage is the primitive CAN message object. It supports creation, parsing, formatting of messages. Can be easily integrated with CANPort and CANQueue libraries.

Files at this revision

API Documentation at this revision

Comitter:
WiredHome
Date:
Wed Oct 23 21:38:12 2019 +0000
Parent:
3:c2a26d9d689b
Commit message:
Changed a Timer API to the old read_us() and typecast it to uint32_t. I lose the 64-bit resolution, but gain compatibility with an older version of the OS that supports the flash file system.

Changed in this revision

CANMessage.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/CANMessage.cpp	Fri Sep 20 21:56:43 2019 +0000
+++ b/CANMessage.cpp	Wed Oct 23 21:38:12 2019 +0000
@@ -54,7 +54,7 @@
         timer.start();
         timer_on = true;
     }
-    timestamp = timer.read_high_resolution_us();
+    timestamp = (uint32_t)timer.read_us(); // read_high_resolution_us();
 }
 
 CANmsg::CANmsg(CANCHANNEL_T _ch, CANDIR_T _dir, CANMessage _msg) {
@@ -62,7 +62,7 @@
         timer.start();
         timer_on = true;
     }
-    timestamp = timer.read_high_resolution_us();
+    timestamp = (uint32_t)timer.read_us(); // read_high_resolution_us();
     ch = _ch;
     dir = _dir;
     id = _msg.id;
@@ -120,14 +120,14 @@
     token = strtok(NULL, search);
     // lostMessages = atoi(token);
     token = strtok(NULL, search);
-    timestamp = timer.read_high_resolution_us();        // set it to "now"
+    timestamp = (uint32_t)timer.read_us(); // read_high_resolution_us();        // set it to "now"
     if (token)
         timestamp = (uint32_t)(1000000 * atof(token));
     return true;
 }
 
 void CANmsg::SetTimestamp() {
-    timestamp = (uint32_t)timer.read_high_resolution_us();
+    timestamp = (uint32_t)timer.read_us(); // read_high_resolution_us();
 }
 
 // 12345678901234567890123456789012345678901234567890123456789012345