Skip to content

Instantly share code, notes, and snippets.

@Overdrivr
Last active December 3, 2016 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Overdrivr/6c0a9eac19b235fce347 to your computer and use it in GitHub Desktop.
Save Overdrivr/6c0a9eac19b235fce347 to your computer and use it in GitHub Desktop.
Simple usage of the telemetry (https://github.com/Overdrivr/Telemetry) library on an embedded device
#include "telemetry.h"
// Your UART library should match those signatures, otherwise quickly wrap them in a function that does
//int32_t read(void * buf, uint32_t sizeToRead)
//int32_t write(void * buf, uint32_t sizeToWrite)
//int32_t readable()
//int32_t writeable()
void main()
{
TM_transport transport;
// Give to each function pointer the function from your UART or wrapper library
transport.read = read;
transport.write = write;
transport.readable = readable;
transport.writeable = writeable;
// init the library
init_telemetry(&transport);
int8_t i = 0;
for( ; ; )
{
// publish some data on topic foo
publish_i8("foo",1i);
// Let the index overflow naturally and observe the result on the command line (https://github.com/Overdrivr/pytelemetrycli)
i++;
}
}
@LucasMahieu
Copy link

LucasMahieu commented Dec 3, 2016

Why the "1i" in the second publish_i8 parameter : publish_i8("foo", 1i); ?
Why not just "i" ?
Best Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment