Created
February 14, 2019 07:49
-
-
Save jaeoh2/fb14b4b0d32ffc066da18dc0c0809f2d to your computer and use it in GitHub Desktop.
CAN bitfield parser for ROS callback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| typedef struct CAN_msgTag | |
| { | |
| uint8_t Sig_1 : 8; | |
| uint8_t Sig_2 : 8; | |
| uint8_t Sig_3 : 8; | |
| uint8_t Sig_4 : 8; | |
| uint8_t Sig_5 : 8; | |
| uint8_t Sig_6 : 8; | |
| uint8_t Sig_7 : 8; | |
| uint8_t Sig_8 : 8; | |
| } CAN_msg; | |
| void ROS_callback(const CanFrame::ConstPtr& msg) | |
| { | |
| CAN_msg *ptr; | |
| memcpy(&ptr, &msg->data, 8); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
내말은 비트필드 문이 의미가 없어보인다는거지