-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcan.h
More file actions
33 lines (30 loc) · 1.13 KB
/
can.h
File metadata and controls
33 lines (30 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
* can.h
*
* Created on: Mar 8, 2025
* Author: Alisha
*
* @brief Header file for FDCAN library.
*
* @details This file contains function prototypes and global variables for configuring,
* transmitting, and receiving FDCAN messages on the STM32.
*/
#ifndef SRC_CAN_H_
#define SRC_CAN_H_
/* Includes ----------------------------------------------------------------------------*/
#include "stm32u5xx_hal.h"
#include "stm32u5xx_hal_fdcan.h"
#include <stdint.h>
#include <stdlib.h>
/* CAN_frame struct for Rx buffer (standard filter). Provides Rx ID, length and buffer --*/
typedef struct {
uint32_t RxData1_Identifier;
uint8_t RxData1_BufferLength;
uint8_t RxData1[64];
} CAN_Frame;
/* Function prototypes ------------------------------------------------------------------*/
void CAN_Init(FDCAN_HandleTypeDef *hfdcan1);
HAL_StatusTypeDef CAN_Transmit(uint32_t Identifier, uint32_t IdType, uint32_t DataLength, uint8_t* DataBuffer, FDCAN_HandleTypeDef *hfdcan1);
HAL_StatusTypeDef CAN_Receive(CAN_Frame *frame);
void HAL_FDCAN_RxFifo0Callback(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo0ITs);
#endif /* SRC_CAN_H_ */