Midnight Sun Firmware
Loading...
Searching...
No Matches
can_msg.h
1#pragma once
2
3/************************************************************************************************
4 * @file can_msg.h
5 *
6 * @brief CAN message definitions
7 *
8 * @date 2024-11-02
9 * @author Midnight Sun Team #24 - MSXVI
10 ************************************************************************************************/
11
12/* Standard library Headers */
13#include <stddef.h>
14#include <stdint.h>
15
16/* Inter-component Headers */
17
18/* Intra-component Headers */
19
27#define CAN_MSG_MAX_STD_IDS (1 << 11)
28
34typedef uint32_t CanMessageId;
35
39typedef union CanId {
40 CanMessageId raw;
41 struct {
42 uint16_t source_id : 4;
43 uint16_t type : 1;
44 uint32_t msg_id : 24;
45 };
47
55typedef struct CanMessage {
57 bool extended;
58 size_t dlc;
59 union {
60 uint64_t data;
61 uint32_t data_u32[2];
62 uint16_t data_u16[4];
63 uint8_t data_u8[8];
64 };
66
uint32_t CanMessageId
CAN message ID.
Definition: can_msg.h:34
CAN message structure.
Definition: can_msg.h:55
size_t dlc
Definition: can_msg.h:58
bool extended
Definition: can_msg.h:57
CanId id
Definition: can_msg.h:56
uint8_t data_u8[8]
Definition: can_msg.h:63
uint16_t data_u16[4]
Definition: can_msg.h:62
uint32_t data_u32[2]
Definition: can_msg.h:61
uint64_t data
Definition: can_msg.h:60
CAN message ID.
Definition: can_msg.h:39