Last active
December 3, 2016 11:06
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why the "1i" in the second publish_i8 parameter : publish_i8("foo", 1i); ?
Why not just "i" ?
Best Regards