Midnight Sun Firmware
Loading...
Searching...
No Matches
datagram.h
1#pragma once
2
3/************************************************************************************************
4 * @file datagram.h
5 *
6 * @brief Datagram header file for telemetry
7 *
8 * @date 2025-01-25
9 * @author Midnight Sun Team #24 - MSXVI
10 ************************************************************************************************/
11
12/* Standard library Headers */
13
14/* Inter-component Headers */
15#include "can.h"
16
17/* Intra-component Headers */
18
26#define DATAGRAM_BUFFER_SIZE 64U
28#define DATAGRAM_START_FRAME 0xAAU
30#define DATAGRAM_END_FRAME 0xBBU
31
39#define DATAGRAM_METADATA_SIZE 5U
40
41#pragma pack(push, 1)
45typedef struct {
46 uint8_t start_frame;
47 uint16_t id;
48 uint8_t dlc;
49 uint8_t data[9];
50} Datagram;
51#pragma pack(pop)
52
58void decode_can_message(Datagram *datagram, CanMessage *msg);
59
64void log_decoded_message(Datagram *datagram);
65
void log_decoded_message(Datagram *datagram)
Log the decoded datagram for debug purposes.
Definition: datagram.c:35
void decode_can_message(Datagram *datagram, CanMessage *msg)
Decode CAN message and update a datagram.
Definition: datagram.c:23
CAN message structure.
Definition: can_msg.h:56
Datagram storage class.
Definition: datagram.h:45
uint8_t start_frame
Definition: datagram.h:46
uint8_t dlc
Definition: datagram.h:48
uint16_t id
Definition: datagram.h:47