Skip to content

Commit ea82312

Browse files
authored
fix: use byte array for CAN message macros
1 parent 69dfdf6 commit ea82312

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Inc/tuk/can_wrapper/can_message.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ typedef struct
4343
// switches to a big-endian processor, that subsystem will have to perform a
4444
// byte swap of the message contents.
4545

46-
// Example Usage: float arg = GET_MSG_DATA(msg, 0, float);
47-
#define GET_MSG_DATA(msg, pos, type) ({ \
46+
// Example Usage: float arg = GET_MSG_DATA(msg.body, 0, float);
47+
#define GET_MSG_DATA(body, pos, type) ({ \
4848
type var; \
49-
memcpy(&var, &msg.body[pos], sizeof(var)); \
49+
memcpy(&var, &body[pos], sizeof(var)); \
5050
var; \
5151
})
5252

53-
// Example Usage: SET_MSG_DATA(msg, 0, uint8_t, 32);
54-
#define SET_MSG_DATA(msg, pos, type, value) do { \
53+
// Example Usage: SET_MSG_DATA(byte_array, 0, uint8_t, 29);
54+
#define SET_MSG_DATA(body, pos, type, value) do { \
5555
type var = value; \
56-
memcpy(&msg.body[pos], &var, sizeof(var)); \
56+
memcpy(&body[pos], &var, sizeof(var)); \
5757
} while (0)
5858

5959
#endif /* CAN_WRAPPER_MODULE_INC_CAN_MESSAGE_H_ */

0 commit comments

Comments
 (0)