Skip to content
Rémi Bèges edited this page Feb 11, 2016 · 23 revisions

First, define a TM_state structure that you will use as a storage space for variables you want to write from your desktop Note: This will soon not be a requirement

struct TM_state {
  // Add writeable variables in here
};

Then, the transport (any library that will interface with a communication hardware) must be initialized. The goal is to tell telemetry where to read and write communication data.

Your buffered UART or custom library must have the following definition:

int32_t read(void * buf, uint32_t sizeToRead)
int32_t write(void * buf, uint32_t sizeToWrite)
int32_t readable()
int32_t writeable()

If it doesn't, simply write a quick wrapper with those functions.

Once you have those 4 functions available, you must instanciate a TM_transport data structure (defined by telemetry). This structure contains 4 function pointers:

typedef struct TM_transport TM_transport;
struct TM_transport {
  int32_t (*read)(void * buf, uint32_t sizeToRead);
  int32_t (*readable)();
  int32_t (*write)(void * buf, uint32_t sizeToWrite);
  int32_t (*writeable)();
};

If you've noticed, the signature of each function in TM_transport matches the one of read,write,readable,writeable.

in main.c, this allows you to instanciate a TM_transport data structure (defined by telemetry) and initialize by simply writing

void main()
{
    TM_transport transport;
    transport.read = read;// Give to each function pointer the function from your UART or wrapper library
    transport.write = write;
    transport.readable = readable;
    transport.writeable = writeable;

Instanciate TM_state

    TM_state myState;

Perform the initialization

   init_telemetry(&state &transport);

And immediately start publishing on a topic

   publish_i32("foo",123);

And that's it.

If you connect to the device with pytelemetrycli, you can run a few commands to observe the result desktop-side: todo : animated ttty gif

 >: ls
foo
 >: print foo
123

Overview of the complete script

Setup

Get started for embedded platforms

Get started for remote debug and remote control

  • Fast data visualization with the command line interface (todo)
  • Fast prototyping remote program control with python (todo)

General knowledge

Troubleshooting

  • Frequently Asked Questions todo

Examples and projects

Clone this wiki locally