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#include <stdbool.h>
16
17/* Inter-component Headers */
18
19/* Intra-component Headers */
20
28#define CAN_MSG_MAX_STD_IDS (1 << 11)
29
35typedef uint32_t CanMessageId;
36
40typedef union CanId {
41 CanMessageId raw;
42 struct {
43 uint32_t source_id : 4;
44 uint32_t msg_id : 6;
45 uint32_t priority : 22;
46 };
48
56typedef struct CanMessage {
58 bool extended;
59 uint8_t dlc;
60 union {
61 uint64_t data;
62 uint32_t data_u32[2];
63 uint16_t data_u16[4];
64 uint8_t data_u8[8];
65 };
67
uint32_t CanMessageId
CAN message ID.
Definition: can_msg.h:35
CAN message structure.
Definition: can_msg.h:56
uint8_t dlc
Definition: can_msg.h:59
bool extended
Definition: can_msg.h:58
CanId id
Definition: can_msg.h:57
uint8_t data_u8[8]
Definition: can_msg.h:64
uint16_t data_u16[4]
Definition: can_msg.h:63
uint32_t data_u32[2]
Definition: can_msg.h:62
uint64_t data
Definition: can_msg.h:61
CAN message ID.
Definition: can_msg.h:40