mightypork / tinyframe Goto Github PK
View Code? Open in Web Editor NEWA simple library for building and parsing data frames for serial interfaces (like UART / RS232)
License: MIT License
A simple library for building and parsing data frames for serial interfaces (like UART / RS232)
License: MIT License
Hi, I see in the readme file, it said:
TinyFrame is re-entrant and supports creating multiple instances with the limitation that their structure (field sizes and checksum type) is the same.
In my C++ desktop application, I have use the TinyFrame library for both UART and Socket communication. In Socket, I would like CRC disabled(Because this will save a lot of computation in the target ARM based circuit board) and in UART I would like CRC enabled. Is it possible?
Any workaround about this?
For example, maybe, I can create two namespaces, and wrap those .h and .c files in different namespaces?
Or, I just have to rename all the C global functions for another frame structure?
Thanks.
it is good idea to define a macro to calculate overhead of frame. and also I think it would be good to get frame size in TF_Msg
we're halfway there with the global state struct, but it needs to be passed to the functions
If one side of the communications dies mid-transfer, it could get "out of sync" with the state machine's idea of what things should look like.
One approach could be to have a SOF byte and an escape byte. If either of those bytes need to appear in the stream, send the escape byte and invert the bits of the required byte.
Thus, if you receive a SOF mid-message, you know the message is bad and to restart the state machine.
Thoughts?
The usage notes are very good about saying how to set up the write side, but mention nothing about the read side. I'd add a blurb about 'TF_Accept', but I'm still setting up my particular usage
When checksum is set to TF_CKSUM_NONE, there is no validation of the incoming message length, and a message that is too large will overflow the RX buffer, causing memory corruption.
cpsdqs/tinyframe-js is not exists, anybody save it before?
Something I thought of when working with sx1278's
If the field is right at the beginning, one could use it for sync-word filtering. This would effectively make TinyFrame multi-drop / multi-master network capable.
This would be a big API / structure change, so it'd require a major version bump.
see #6 (comment)
add an option that calls external checksum handlers
Hi, thank you share this libray, I want use this libray to my OTA funcation, Maybe,receiver should response to sender the complete and correct of data
we already have timebase from TF_Tick() so this should be easy to add
Hello,
Can you please make a simple demo of using the payload parser .
I did this and I am gettings segfaults.
`#include <stdio.h>
#include "./utilities/payload_parser.h"
PayloadParser *pp;
unsigned char buff[] = "Hello";
unsigned char *buf = buff;
bool emptyhandler()
{
printf("Error\n");
return true;
}
int main()
{
pp_start(buf, sizeof(buff), emptyhandler);
unsigned char ping = pp_u8(pp);
return 0;
}
`
add hooks / defines to report e.g. malformed frame, bad checksum etc.
The patch something like this:
#if TF_CKSUM_TYPE == TF_CKSUM_NONE
memcpy(outbuff, data, data_len);
#else
for (i = 0; i < data_len; i++) {
b = data[i];
outbuff[pos++] = b;
CKSUM_ADD(*cksum, b);
}
#endif // TF_CKSUM_TYPE
In our test, it looks like using memcpy is much faster, and in one test, it reduced to 1/40
of the manually loop byte copy time.
I have use this library in several projects.
For example, I use it in UDP data sending, I think we don't need CRC check here, because the UDP protocol already does some data check.
While the UDP package is not sending in a synchronized way, so I use the ID
filed of the TinyFrame to resort the messages. It works really nice! Thanks for this great project!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.