Framework for reading and writing variables in real time on any MBED platform.

DistantIO

This is the C implementation of the DistantIO slave framework.

Library is working but slight API breaks may occur in the future. C++ version is also in development.

To get the master-side implementation, see https://github.com/Overdrivr/DistantIO

Committer:
Overdrivr
Date:
Fri Oct 16 16:16:19 2015 +0000
Revision:
6:72d46dbdbe7a
Parent:
1:aaffeb93f99b
removed 'static' keyword in front arrays that just increase RAM usage (premature optimization)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Overdrivr 1:aaffeb93f99b 1 // Copyright (C) 2015 Rémi Bèges
Overdrivr 1:aaffeb93f99b 2 // For conditions of distribution and use, see copyright notice in the LICENSE.md file
Overdrivr 0:c4676d32d381 3
Overdrivr 0:c4676d32d381 4 #ifndef SERIAL_PROTOCOL_H_
Overdrivr 0:c4676d32d381 5 #define SERIAL_PROTOCOL_H_
Overdrivr 0:c4676d32d381 6
Overdrivr 0:c4676d32d381 7 #include <stdint.h>
Overdrivr 0:c4676d32d381 8
Overdrivr 0:c4676d32d381 9 #define ENCODING_BUFFER_SIZE 64
Overdrivr 0:c4676d32d381 10 #define DECODING_BUFFER_SIZE 256
Overdrivr 0:c4676d32d381 11
Overdrivr 0:c4676d32d381 12 typedef void (*callback_t)(uint8_t* data, uint16_t size);
Overdrivr 0:c4676d32d381 13
Overdrivr 0:c4676d32d381 14 void init_protocol(void (*encoding_done_callback)(uint8_t*,uint16_t),void (*decoding_done_callback)(uint8_t*,uint16_t));
Overdrivr 0:c4676d32d381 15 /*
Overdrivr 0:c4676d32d381 16 * Encodes new data with byte stuffing algorithm to delimit frame.
Overdrivr 0:c4676d32d381 17 * @input framedata : the raw data to process
Overdrivr 0:c4676d32d381 18 * @input framesize : size of the raw data to process (amount of bytes)
Overdrivr 0:c4676d32d381 19 */
Overdrivr 0:c4676d32d381 20 void encode(uint8_t* framedata, uint16_t framesize);
Overdrivr 0:c4676d32d381 21
Overdrivr 0:c4676d32d381 22 /*
Overdrivr 0:c4676d32d381 23 * Append new byte to current decoding sequence. If a valid frame is detected,
Overdrivr 0:c4676d32d381 24 * the decoding_done_callback function is called and the valid frame is sent as parameter
Overdrivr 0:c4676d32d381 25 * @input received_byte : the new byte to add to the current decoding sequence
Overdrivr 0:c4676d32d381 26 */
Overdrivr 0:c4676d32d381 27 void decode(uint8_t received_byte);
Overdrivr 0:c4676d32d381 28
Overdrivr 0:c4676d32d381 29 #endif /* SERIAL_PROTOCOL_H_ */
Overdrivr 0:c4676d32d381 30