This is Tiny protocol implementation for microcontrollers (Arduino, Stellaris).
Simple Tiny Protocol examples
Simple Tiny Protocol examples section is applicable only when working with Tiny light protocol API functions.
Initialization
{
proto.beginToSerial();
}
Sending/Receiving data over protocol
Variant 1
First variant: without using any helpers to work with data
uint8_t g_buffer[16];
void loop()
{
if (needToSend)
{
uint8_t buffer[16];
buffer[0] = 10;
buffer[1] = 20;
proto.
write( buffer, 2 );
}
int length;
if ( length > 0 )
{
}
}
Variant 2
Second variant: with using special helper to pack the data being sent
void loop()
{
if (needToSend)
{
proto.write( packet );
}
int length;
if ( length > 0 )
{
}
}
Stopping communication
void loop()
{
...
if ( needToStop )
{
proto.end();
}
}