Closed Akshay1595 closed 3 years ago
Hey No worries!
Sorted! I found this comment line!
/*
* Controller Area Network Identifier structure
*
* bit 0-28 : CAN identifier (11/29 bit)
* bit 29 : error message frame flag (0 = data frame, 1 = error message)
* bit 30 : remote transmission request flag (1 = rtr frame)
* bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit)
*/
typedef __u32 canid_t;
We can check bit 31 and decide if it is a Standard or extended frame! Also one can check if it is an error message or data frame as well as one can check if it is an RTR frame.
Thanks for the comment inside the code! I would suggest using bitfields for such cases and provide in code so that coding will be easier!
Hey, the CAN_EFF_MASK
or CAN_EFF_FLAG
https://github.com/autowp/arduino-mcp2515/blob/cdc0141ee734f47f54628b1ac8acaafa9120511b/can.h#L19 might help.
I want to know if my received frame is the standard or extended frame.
I have the following code to receive a can frame. ` while ((mcp2515.readMessage(&canMsg) == MCP2515::ERROR_OK)) { debug_log("I got some data!");
`
I also want to display the frame format of the above CAN message. How to do that?