Arduino KVComm  master
Key-Value pair communication library for Arduino
SLIP-Receive.ino

SLIP-Receive

Receives SLIP packages over Serial.

Boards:
AVR, AVR USB, Nano Every, Nano 33, Due, Teensy 3.x, ESP8266, ESP32
See also
SLIP-Send.ino

Written by PieterP, 2020-02-06
https://github.com/tttapa/Arduino-KVComm

#include <KVComm.h>
uint8_t slipbuffer[256];
SLIPStream slip = {
Serial,
slipbuffer,
};
void setup() {
Serial.begin(115200);
}
void loop() {
size_t packetSize = slip.readPacket();
if (packetSize > 0) {
Serial.println("Received packet: ");
Serial.write(slipbuffer, packetSize);
Serial.println();
Serial.println(slip.wasTruncated() ? "Packet was truncated\n" : "");
}
}
SLIPStream
Class that implements SLIP, a simple packet framing protocol.
Definition: SLIPStream.hpp:15
KVComm.h
SLIPStream::wasTruncated
bool wasTruncated() const
Check if the previous packet was truncated.
Definition: SLIPStream.hpp:60
SLIPStream.hpp
SLIPStream::readPacket
size_t readPacket()
Receives a packet into the read buffer.
Definition: SLIPStream.cpp:25