We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8416466 commit 5368372Copy full SHA for 5368372
README.md
@@ -50,14 +50,29 @@ Main features:
50
Tiny SLIP Library is very easy to use:
51
```.cpp
52
SLIP::SLIP proto;
53
-SLIP::Packet<256> packet;
+
54
+void onReceive(SLIP::IPacket &pkt)
55
+{
56
+ // Process incoming packets here
57
58
+ /* Send message back */
59
+ proto.write( pkt );
60
+}
61
62
+...
63
64
+ proto.setReceiveCallback( onReceive );
65
+ proto.begin();
66
67
...
68
if (Serial.available()) {
- int len = proto.read( packet );
- if (len > 0) {
- /* Send message back */
- proto.write( packet );
- }
69
+ uint8_t byte = Serial.read();
70
+ proto.run_rx(&byte, 1);
71
+ }
72
+ uint8_t byte;
73
+ if ( proto.run_tx(&byte, 1) == 1)
74
+ {
75
+ Serial.write( byte );
76
}
77
```
78
0 commit comments