CANpie
CANpie is an open source project and pursues the objective of creating and establishing an open and standardized software API for access to the CAN bus.
The project was established in 2001 by MicroControl and is licensed under Apache License version 2.0. The current version of the CANpie API covers both classical CAN frames as well as ISO CAN FD frames. The API is designed for embedded control applications as well as for PC interface boards: embedded microcontrollers are programmed in C, a C++ API is provided for OS independent access to interface boards. The API provides ISO/OSI Layer-2 functionality. It is not the intention of CANpie to incorporate higher layer functionality.
Driver principle
The CANpie API supports the concept of hardware message buffers with a total limit of 255 buffers. A message buffer has a unique direction. As an option it is possible to connect a FIFO with arbitrary size to a message buffer for both transfer directions. The total number of CAN channels is limited to 255, the API provides a method to gather information about the features of each CAN hardware channel. This is especially important for an application designer who wants to write the code only once. The CAN frame time-stamping is supported with a resolution of 1 nano-second.Usage
The following code snippet shows the initialisation of a microcontroller.- include "cp_core.h" // CANpie core functions