Skip to content

File CAN_FD.h

FileList > bsp > Inc > CAN_FD.h

Go to the source code of this file

  • #include "stm32xx_hal.h"
  • #include "CAN_Common.h"
  • #include "queue_ex.h"

Public Functions

Type Name
can_status_t can_fd_deinit (FDCAN_HandleTypeDef * handle)
Deinitializes the FDCAN peripheral.
can_status_t can_fd_init (FDCAN_HandleTypeDef * handle, FDCAN_FilterTypeDef * filter)
Initializes the FDCAN peripheral.
can_status_t can_fd_recv (FDCAN_HandleTypeDef * handle, uint32_t id, FDCAN_RxHeaderTypeDef * header, uint8_t data, TickType_t delay_ticks)
Receives a FDCAN message.
void can_fd_rx_callback_hook (FDCAN_HandleTypeDef * hfdcan, uint32_t RxFifo0ITs, can_rx_payload_t recv_payload)
can_status_t can_fd_send (FDCAN_HandleTypeDef * handle, FDCAN_TxHeaderTypeDef * header, uint8_t data, TickType_t delay_ticks)
Sends a FDCAN message.
can_status_t can_fd_start (FDCAN_HandleTypeDef * handle)
Starts the FDCAN peripheral.
void can_fd_tx_callback_hook (FDCAN_HandleTypeDef * hfdcan, const can_tx_payload_t * payload)

Public Functions Documentation

function can_fd_deinit

Deinitializes the FDCAN peripheral.

can_status_t can_fd_deinit (
    FDCAN_HandleTypeDef * handle
) 

This function deinitializes the HAL FDCAN driver and disables FDCAN interrupts.

Parameters:

  • handle Pointer to the FDCAN handle structure.

Returns:

can_status_t Returns CAN_OK on success, CAN_ERR on failure.


function can_fd_init

Initializes the FDCAN peripheral.

can_status_t can_fd_init (
    FDCAN_HandleTypeDef * handle,
    FDCAN_FilterTypeDef * filter
) 

This function initializes the FDCAN peripheral, sets up send/receive queues, configures the HAL FDCAN driver, applies the filter configuration, and enables FDCAN interrupts.

Parameters:

  • handle Pointer to the FDCAN handle structure.
  • filter Pointer to the FDCAN filter configuration structure.

Returns:

can_status_t Returns CAN_OK on success, CAN_ERR on failure.


function can_fd_recv

Receives a FDCAN message.

can_status_t can_fd_recv (
    FDCAN_HandleTypeDef * handle,
    uint32_t id,
    FDCAN_RxHeaderTypeDef * header,
    uint8_t data,
    TickType_t delay_ticks
) 

Reads a message from the receive queue corresponding to the specified ID. Supports blocking or non-blocking behavior depending on delay_ticks.

Parameters:

  • handle Pointer to the FDCAN handle structure.
  • id CAN identifier of the message to receive.
  • header Pointer to a FDCAN_RxHeaderTypeDef structure to store the received header.
  • data Array to store the received data.
  • delay_ticks Maximum delay to wait if queue is empty (FreeRTOS ticks).

Returns:

can_status_t Returns CAN_OK if a message was received, CAN_EMPTY if the queue was empty, CAN_ERR on failure or invalid ID.


function can_fd_rx_callback_hook

void can_fd_rx_callback_hook (
    FDCAN_HandleTypeDef * hfdcan,
    uint32_t RxFifo0ITs,
    can_rx_payload_t recv_payload
) 

function can_fd_send

Sends a FDCAN message.

can_status_t can_fd_send (
    FDCAN_HandleTypeDef * handle,
    FDCAN_TxHeaderTypeDef * header,
    uint8_t data,
    TickType_t delay_ticks
) 

Places a FDCAN message into the transmit mailbox if available, otherwise queues it in the send queue for later transmission.

Parameters:

  • handle Pointer to the FDCAN handle structure.
  • header Pointer to the FDCAN transmit header structure.
  • data Array containing the data to send.
  • delay_ticks Maximum delay to wait if queue is full (FreeRTOS ticks).

Returns:

can_status_t Returns CAN_OK if message was successfully sent or queued, CAN_ERR on failure.


function can_fd_start

Starts the FDCAN peripheral.

can_status_t can_fd_start (
    FDCAN_HandleTypeDef * handle
) 

Activates the FDCAN peripheral so it can transmit and receive messages.

Parameters:

  • handle Pointer to the FDCAN handle structure.

Returns:

can_status_t Returns CAN_OK on success, CAN_ERR on failure.


function can_fd_tx_callback_hook

void can_fd_tx_callback_hook (
    FDCAN_HandleTypeDef * hfdcan,
    const can_tx_payload_t * payload
) 


The documentation for this class was generated from the following file bsp/Inc/CAN_FD.h