VCAN
2.0.0
Virtual CAN bus
|
Especially useful for debugging and testing without using actual CAN-connected devices, VCAN is a tiny C library that allows the user to connect virtual nodes on a virtual bus and make them react whenever someone transmits a message on the bus.
After the transmission, each node obtains a copy of the message and a callback on each node is called to warn the node of a message being received.
VCAN is simple, synchronous and single-threaded. It does not simulate transmission errors, collisions, arbitration, etc. just pure data transfer. Callbacks should be fast.
... but you are free to alter it to your specific needs!
You can also check the tst/test.c
file for more examples.
Copy the inc/vcan.h
and src/vcan.c
files into your existing C project, add them to the source folders and compile. Done.
This will build all targets:
libvcan.a
static librarytestvcan
To compile with the optimisation for size, use the -DCMAKE_BUILD_TYPE=MinSizeRel
flag instead.