KVComm-Receive
Receives SLIP packages containing a KV dictionary and print the keys and values.
- Boards:
- AVR, AVR USB, Nano Every, Nano 33, Due, Teensy 3.x, ESP8266, ESP32
- See also
- KVComm-Send.ino
Written by PieterP, 2020-02-08
https://github.com/tttapa/Arduino-KVComm
#include <boost/crc.hpp>
using CRC = boost::crc_optimal<16, 0x1021, 0xFFFF, 0, false, false>;
uint8_t slipbuffer[256];
Serial,
CRC(),
slipbuffer,
CRC(),
};
void setup() {
Serial.begin(115200);
CRC()(0);
}
void handlePacket(const uint8_t *data, size_t length);
void loop() {
if (packetSize > 0) {
handlePacket(slipbuffer, packetSize);
else
Serial.println("<< Invalid packet >>"), Serial.println();
}
}
template <class T>
Serial.print(entry.
getID()), Serial.println(
':');
Serial.print(" ");
for (uint16_t i = 0; i < numElem; ++i)
Serial.print(entry.
getAs<T>(i)), Serial.print(i + 1 < numElem ?
", " :
"");
Serial.println(), Serial.println();
}
template <>
Serial.print(entry.
getID()), Serial.println(
':');
Serial.print(" ");
Serial.println();
}
void handlePacket(const uint8_t *data, size_t length) {
}
}
Serial.println("====================");
Serial.println();
}