CANMessage is the primitive CAN message object. It supports creation, parsing, formatting of messages. Can be easily integrated with CANPort and CANQueue libraries.
Diff: CANMessage.cpp
- Revision:
- 2:4307b498b508
- Parent:
- 1:c56577ae52df
- Child:
- 3:c2a26d9d689b
--- a/CANMessage.cpp Wed Aug 28 22:02:43 2019 +0000 +++ b/CANMessage.cpp Thu Sep 19 21:46:09 2019 +0000 @@ -24,8 +24,6 @@ #include "CANMessage.h" #include "Utilities.h" // missing functions... -//#include "FreeRunTimer.h" - static Timer timer; static bool timer_on; @@ -56,7 +54,7 @@ timer.start(); timer_on = true; } - timestamp = timer.read_us(); + timestamp = timer.read_high_resolution_us(); } CANmsg::CANmsg(CANCHANNEL_T _ch, CANDIR_T _dir, CANMessage _msg) { @@ -64,7 +62,7 @@ timer.start(); timer_on = true; } - timestamp = timer.read_us(); + timestamp = timer.read_high_resolution_us(); ch = _ch; dir = _dir; id = _msg.id; @@ -122,14 +120,14 @@ token = strtok(NULL, search); // lostMessages = atoi(token); token = strtok(NULL, search); - timestamp = timer.read_us(); // set it to "now" + timestamp = timer.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_us(); + timestamp = (uint32_t)timer.read_high_resolution_us(); } // 12345678901234567890123456789012345678901234567890123456789012345