FaSTTUBe STM32 CAN HAL Abstraction Layer
Go to file
Moritz Ruffer 5832f00cbc Added macros for the most used chips at fasttube. 2023-03-31 17:07:15 +02:00
README.md Rename to can-halal 2023-03-18 20:20:00 +01:00
can-halal.c Silence warning due to const-incorrect FDCAN HAL 2023-03-20 15:20:10 +01:00
can-halal.h Added macros for the most used chips at fasttube. 2023-03-31 17:07:15 +02:00

README.md

FaSTTUBe CAN HAL Abstraction Layer

This repository contains an abstraction layer to provide a simplified & unified interface to the STM32 bxCAN and FDCAN peripherals.

Installation

Simply add the repository to your Core/Lib directory. You can also add it as a git submodule:

mkdir -p Core/Lib
cd Core/Lib
git submodule add ssh://git@git.fasttube.de:313/FaSTTUBe/can-halal.git

The library needs to be told what STM family you're using, so make sure one of the following symbols is defined when can-halal.c is compiled or can-halal.h is included:

  • STM32F3
  • STM32H7

When using the FDCAN peripheral (H7 series), you also need to define FTCAN_NUM_FILTERS (and set it to the value of "Std Filters Nbr" you configured in your .ioc).

Usage

  1. Include can-halal.h
  2. Call ftcan_init() with the appropriate handle
  3. Call ftcan_add_filter() with all your filters
  4. To transmit messages, call ftcan_transmit()
  5. When a message is received, ftcan_msg_received_cb() is called. It has a default empty implementation, which you can simply override.