Simple library for sending and receiving Snap packets.
The library has the following features: - easy to use - collision avoidance (e.g. RS486 half-duplex networks) - crc-16 error detection - interrupt-based receiving - blocking transmitting
The Snap protocol is very flexible.
The library has the following restrictions to keep it simple:
- 3 byte addresses (16.7 million nodes) - crc-16 error detection - command-mode bits and protocol specific flags not supported - 2 preamble bytes to improve packet start detection
Example: the device will echo back any data received
CODE
#include "snap.h" int main(void) { while (1) { if (SnapPacketReceived()) { SnapSend(SnapPacketSource, SnapPacketData, SnapPacketDataLength); SnapReset(); } } }