CAN message container. Defines "<<" and ">>" operators to simplify adding/getting data to/from a CAN message.

Dependents:   CAN_Hello EinlesenSensorabstand_digital_2 CAN_STABLE_EINSTEIN CAN_ex_STM32F103C8T6 ... more

CAN message container

In order to simplify adding/getting data to/from a CAN message the CANMsg class extends mbed's built-in CANMessage class by defining "<<" (append) and ">>" (extract) operators. Since it inherits everything from CANMessage, after importing the library into your project, you can use it instead of CANMessage without any additional modification or limitations. The usage of "<<" and ">>" operators is similar to the C++ io-streams operators.

  • Before adding data to a CANMsg object it is recommended to clear it by calling its clear() member function.
  • Then set up all the other properties (ID, type, format) as needed.
  • Finally append data one by one or combine them into a stream. The actual data length of a CAN message is automatically updated when using "<<" or ">>" operators. However, you have to make sure that the total length of data does not exceed eight bytes.

For an example of use have a look at this wiki page.

Import programCAN_Hello

Using CAN bus with (not just NUCLEO) mbed boards

History

Modified. default tip

2019-02-05, by hudakz [Tue, 05 Feb 2019 14:50:19 +0000] rev 4

Modified.


Fixed to work with the new mbed library/compiler.

2018-04-25, by hudakz [Wed, 25 Apr 2018 11:47:00 +0000] rev 3

Fixed to work with the new mbed library/compiler.


Updated.

2018-03-29, by hudakz [Thu, 29 Mar 2018 18:56:19 +0000] rev 2

Updated.


Updated.

2017-03-18, by hudakz [Sat, 18 Mar 2017 23:09:30 +0000] rev 1

Updated.


Initial release.

2017-03-17, by hudakz [Fri, 17 Mar 2017 16:34:42 +0000] rev 0

Initial release.