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
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
ascii_serial_com_device.h File Reference

ASCII Serial Com Device. More...

#include "ascii_serial_com.h"
Include dependency graph for ascii_serial_com_device.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  __ascii_serial_com_device_config
 ASCII Serial Com Device Config Struct. More...
 
struct  __ascii_serial_com_device
 ASCII Serial Com Device State struct. More...
 

Typedefs

typedef struct __ascii_serial_com_device_config ascii_serial_com_device_config
 ASCII Serial Com Device Config Struct.
 
typedef struct __ascii_serial_com_device ascii_serial_com_device
 ASCII Serial Com Device State struct.
 

Functions

void ascii_serial_com_device_init (ascii_serial_com_device *ascd, ascii_serial_com_device_config *config)
 ASCII Serial Com Device init.
 
void ascii_serial_com_device_receive (ascii_serial_com_device *ascd)
 ASCII Serial Com Device receive messages.
 
circular_buffer_uint8ascii_serial_com_device_get_input_buffer (ascii_serial_com_device *ascd)
 ASCII Serial Com Device get input buffer.
 
circular_buffer_uint8ascii_serial_com_device_get_output_buffer (ascii_serial_com_device *ascd)
 ASCII Serial Com Device get output buffer.
 
void ascii_serial_com_device_put_message_in_output_buffer (ascii_serial_com_device *ascd, char ascVersion, char appVersion, char command, char *data, size_t dataLen)
 ASCII Serial Com Device put a message in output buffer.
 
void ascii_serial_com_device_put_s_message_in_output_buffer (ascii_serial_com_device *ascd, char ascVersion, char appVersion, char *data, size_t dataLen)
 ASCII Serial Com Device put a 's' message in output buffer.
 

Detailed Description

ASCII Serial Com Device.

Definition in file ascii_serial_com_device.h.

Typedef Documentation

◆ ascii_serial_com_device

ASCII Serial Com Device State struct.

Keeps track of the state of the ASCII Serial Com device

The functions take the stuff from ascii_serial_com_get_message_from_input_buffer plus a void pointer to possible state/configuration info. If the functions are null ptrs, an error message returned to host. This class owns the data buffer passed around.

◆ ascii_serial_com_device_config

ASCII Serial Com Device Config Struct.

Use at initialization to configure a device

Passed to ascii_serial_com_device_init

Define like:

ascii_serial_com_device_config dev_config = {.func_rw = myfunrw, .state_rw = myrwstate};

All other members set to 0 (so null pointers).

Function Documentation

◆ ascii_serial_com_device_get_input_buffer()

circular_buffer_uint8 * ascii_serial_com_device_get_input_buffer ( ascii_serial_com_device * ascd)

ASCII Serial Com Device get input buffer.

MAKE SURE ascd IS ALREADY INITIALIZED!

/param ascd: initialized ascii_serial_com_device

Definition at line 58 of file ascii_serial_com_device.c.

References __ascii_serial_com_device::asc, and ascii_serial_com_get_input_buffer().

◆ ascii_serial_com_device_get_output_buffer()

circular_buffer_uint8 * ascii_serial_com_device_get_output_buffer ( ascii_serial_com_device * ascd)

ASCII Serial Com Device get output buffer.

MAKE SURE ascd IS ALREADY INITIALIZED!

/param ascd: initialized ascii_serial_com_device

Definition at line 63 of file ascii_serial_com_device.c.

References __ascii_serial_com_device::asc, and ascii_serial_com_get_output_buffer().

◆ ascii_serial_com_device_init()

void ascii_serial_com_device_init ( ascii_serial_com_device * ascd,
ascii_serial_com_device_config * config )

ASCII Serial Com Device init.

Initialize ASCII Serial Com device

The functions take the stuff from ascii_serial_com_get_message_from_input_buffer plus a void pointer to possible state/configuration info. If the functions are null ptrs, an error message returned to host. This class owns the data buffer passed around.

Definition at line 5 of file ascii_serial_com_device.c.

References __ascii_serial_com_device::asc, and ascii_serial_com_init().

◆ ascii_serial_com_device_put_message_in_output_buffer()

void ascii_serial_com_device_put_message_in_output_buffer ( ascii_serial_com_device * ascd,
char ascVersion,
char appVersion,
char command,
char * data,
size_t dataLen )

ASCII Serial Com Device put a message in output buffer.

MAKE SURE ascd IS ALREADY INITIALIZED!

Definition at line 67 of file ascii_serial_com_device.c.

References __ascii_serial_com_device::asc, and ascii_serial_com_put_message_in_output_buffer().

◆ ascii_serial_com_device_put_s_message_in_output_buffer()

void ascii_serial_com_device_put_s_message_in_output_buffer ( ascii_serial_com_device * ascd,
char ascVersion,
char appVersion,
char * data,
size_t dataLen )

ASCII Serial Com Device put a 's' message in output buffer.

MAKE SURE ascd IS ALREADY INITIALIZED!

Definition at line 74 of file ascii_serial_com_device.c.

References __ascii_serial_com_device::asc, and ascii_serial_com_put_s_message_in_output_buffer().

◆ ascii_serial_com_device_receive()

void ascii_serial_com_device_receive ( ascii_serial_com_device * ascd)

ASCII Serial Com Device receive messages.

Receives ASCII Serial Com messages, and hands them over to the appropriate one of the functions

/param ascd: initialized ascii_serial_com_device

Definition at line 11 of file ascii_serial_com_device.c.

References __ascii_serial_com_device::asc, ascii_serial_com_get_message_from_input_buffer(), ascii_serial_com_put_error_in_output_buffer(), __ascii_serial_com_device::ascVersion, __ascii_serial_com_device::dataBuffer, __ascii_serial_com_device_config::func_nf, __ascii_serial_com_device_config::func_rw, and __ascii_serial_com_device_config::func_s.