Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gbr1/ucpack
ucPack - Unified C++ Packetizer
https://github.com/gbr1/ucpack
Last synced: 9 days ago
JSON representation
ucPack - Unified C++ Packetizer
- Host: GitHub
- URL: https://github.com/gbr1/ucpack
- Owner: gbr1
- License: mit
- Created: 2022-01-15T16:18:47.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-30T15:06:59.000Z (5 months ago)
- Last Synced: 2024-06-05T15:56:30.445Z (5 months ago)
- Language: C++
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ucPack
ucPack - Unified C++ Packetizer
---
It is possible to use this library with Arduino or any other generic C++ framework.
## How to use
```c++
// declare ucPack class
ucPack pack(100,0x41,0x23);// use the internal buffer
pack.buffer.push();// to check if a correct message is arrived
pack.checkPayload();// compose a byte + 4 float packet
uint8_t size=pack.packetC4F('C',1.23,-3.14,90.0,45.0);// to unpack
char c;
float f1,f2,f3,f4;
pack.unpacketC4F(c, f1, f2, f3, f4);```
## How it works
A packet is managed as:
| index_byte | message length | message | stop_byte | crc8 |
|:--------------------:|:--------------:|:---------------------------:|:--------------------:|:------:|
| 1 byte (_default A_) | 1 byte | N bytes from message length | 1 byte (_default #_) | 1 byte |## Todo
- check all functions
- add variadic compose and unpack
> ***Copyright © 2022 Giovanni di Dio Bruno under MIT License.***