ASCII Serial Com
Serial communication library between computers, microcontrollers, FPGAs, etc. Uses only ASCII. Not the most efficient protocol, but meant to be easy to read
|
ASCII Serial Com Interface State struct. More...
#include <ascii_serial_com.h>
Public Attributes | |
circular_buffer_uint8 | in_buf |
circular_buffer_uint8 | out_buf |
uint8_t | raw_buffer [2 *MAXMESSAGELEN] |
uint8_t | send_stream_frame_counter |
uint8_t | receive_stream_frame_counter |
bool | receive_stream_frame_counter_initialized |
bool | ignoreCRCMismatch |
ASCII Serial Com Interface State struct.
Keeps track of the state of the ASCII Serial Com interface
Normally, for a device, usage would go something like:
1) allocate the ascii_serial_com
2) initialize it with ascii_serial_com_init
3) Get the input buffer with ascii_serial_com_get_input_buffer and output buffer with ascii_serial_com_get_output_buffer
4) poll on the input stream/file/peripheral (and output stream/file/peripheral if the output buffer is not empty)
5) read from the input stream/file/peripheral
6) push_back or push_back_block what is read to the input_buffer
7) run ascii_serial_com_get_message_from_input_buffer, if a message is received (unpacked) then act on it (possibly reply with ascii_serial_com_put_message_in_output_buffer)
8) pop from output_buffer and write to output stream/file/peripheral
9) go back to 4)
Definition at line 54 of file ascii_serial_com.h.
bool __ascii_serial_com_struct::ignoreCRCMismatch |
if true, ignore CRC errors. default false
Definition at line 65 of file ascii_serial_com.h.
Referenced by ascii_serial_com_get_message_from_input_buffer(), and ascii_serial_com_init().
circular_buffer_uint8 __ascii_serial_com_struct::in_buf |
Input buffer
Definition at line 55 of file ascii_serial_com.h.
Referenced by ascii_serial_com_compute_checksum(), ascii_serial_com_get_input_buffer(), ascii_serial_com_get_message_from_input_buffer(), and ascii_serial_com_init().
circular_buffer_uint8 __ascii_serial_com_struct::out_buf |
Output buffer
Definition at line 56 of file ascii_serial_com.h.
Referenced by ascii_serial_com_compute_checksum(), ascii_serial_com_get_output_buffer(), ascii_serial_com_init(), and ascii_serial_com_put_message_in_output_buffer().
uint8_t __ascii_serial_com_struct::raw_buffer[2 *MAXMESSAGELEN] |
Raw buffer used by circular buffers
Definition at line 58 of file ascii_serial_com.h.
Referenced by ascii_serial_com_init().
uint8_t __ascii_serial_com_struct::receive_stream_frame_counter |
counter streaming messages for checking received messages
Definition at line 61 of file ascii_serial_com.h.
Referenced by ascii_serial_com_init().
bool __ascii_serial_com_struct::receive_stream_frame_counter_initialized |
true after receiving first s message
Definition at line 63 of file ascii_serial_com.h.
Referenced by ascii_serial_com_init().
uint8_t __ascii_serial_com_struct::send_stream_frame_counter |
counter put in sent streaming messages
Definition at line 60 of file ascii_serial_com.h.
Referenced by ascii_serial_com_init(), and ascii_serial_com_put_s_message_in_output_buffer().