Midnight Sun Firmware
Loading...
Searching...
No Matches
can.h
1#pragma once
2
3/************************************************************************************************
4 * @file can.h
5 *
6 * @brief Header file for CAN Application code
7 *
8 * @date 2024-11-23
9 * @author Midnight Sun Team #24 - MSXVI
10 ************************************************************************************************/
11
12/* Standard library Headers */
13#include <stdbool.h>
14#include <stddef.h>
15#include <stdint.h>
16
17/* Inter-component Headers */
18#include "status.h"
19
20/* Intra-component Headers */
21#include "can_hw.h"
22#include "can_queue.h"
23
31#define CAN_TIMEOUT_MS 5U
32
36typedef struct CanStorage {
37 volatile CanQueue rx_queue;
38 uint16_t device_id;
40
49StatusCode can_init(CanStorage *storage, const CanSettings *settings);
50
59
68
77
84
91
98
105
112
120
128
StatusCode can_receive(const CanMessage *msg)
Receives CAN data from the bus.
Definition: can.c:92
StatusCode can_add_filter_in(CanMessageId msg_id)
Sets a filter on the CAN interface.
Definition: can.c:66
StatusCode can_init(CanStorage *storage, const CanSettings *settings)
Initialize the CAN interface.
Definition: can.c:37
StatusCode clear_tx_struct()
Clear the TX data struct.
Definition: can.c:174
StatusCode run_can_tx_fast()
Transmit all fast-cycle CAN data.
Definition: can.c:123
uint32_t CanMessageId
CAN message ID.
Definition: can_msg.h:34
StatusCode can_transmit(const CanMessage *msg)
Transmits CAN data on the bus.
Definition: can.c:84
StatusCode run_can_tx_medium()
Transmit all medium-cycle CAN data.
Definition: can.c:136
StatusCode clear_rx_struct()
Clear the RX data struct.
Definition: can.c:169
StatusCode run_can_rx_all()
Receive all CAN data.
Definition: can.c:162
StatusCode run_can_tx_slow()
Transmit all slow-cycle CAN data.
Definition: can.c:149
StatusCode run_can_tx_all()
Transmit all CAN data.
Definition: can.c:110
StatusCode
StatusCodes for various errors.
Definition: status.h:27
CAN message structure.
Definition: can_msg.h:55
CAN queue data structure to store received CAN messages.
Definition: can_queue.h:34
CAN Settings.
Definition: bootloader_can.h:58
Storage class for the device ID and RX data.
Definition: can.h:36
volatile CanQueue rx_queue
Definition: can.h:37
uint16_t device_id
Definition: can.h:38