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 Register Block. More...
#include "ascii_serial_com.h"
Go to the source code of this file.
Classes | |
struct | ascii_serial_com_register_block_struct |
ASCII Serial Com Register Block State struct. More... | |
Macros | |
#define | REGWIDTHBITS 8 |
#define | REGWIDTHBYTES 1 |
#define | REGTYPE uint8_t |
#define | REGPRINTTYPEINT PRIu8 |
#define | REGPRINTTYPEHEX PRIX8 |
Typedefs | |
typedef struct ascii_serial_com_register_block_struct | ascii_serial_com_register_block |
ASCII Serial Com Register Block State struct. | |
Functions | |
void | ascii_serial_com_register_block_init (ascii_serial_com_register_block *register_block_state, REGTYPE *block, uint16_t n_regs) |
ASCII Serial Com Register Block init. | |
void | ascii_serial_com_register_block_handle_message (ascii_serial_com *asc, char ascVersion, char appVersion, char command, char *data, size_t dataLen, void *register_block_state) |
ASCII Serial Com Register Block handle message. | |
ASCII Serial Com Register Block.
Register interface for devices.
This interface assumes the registers are a contigous block of memory
Definition in file ascii_serial_com_register_block.h.
#define REGPRINTTYPEHEX PRIX8 |
Definition at line 20 of file ascii_serial_com_register_block.h.
#define REGPRINTTYPEINT PRIu8 |
Definition at line 19 of file ascii_serial_com_register_block.h.
#define REGTYPE uint8_t |
Definition at line 18 of file ascii_serial_com_register_block.h.
#define REGWIDTHBITS 8 |
Definition at line 16 of file ascii_serial_com_register_block.h.
#define REGWIDTHBYTES 1 |
Definition at line 17 of file ascii_serial_com_register_block.h.
ASCII Serial Com Register Block State struct.
Keeps track of the state of the ASCII Serial Com Register Block
void ascii_serial_com_register_block_handle_message | ( | ascii_serial_com * | asc, |
char | ascVersion, | ||
char | appVersion, | ||
char | command, | ||
char * | data, | ||
size_t | dataLen, | ||
void * | register_block_state ) |
ASCII Serial Com Register Block handle message.
This is the function passed to ascii_serial_com_device as frw
The parameters are the same as in that function (and ascii_serial_com_get_message_from_input_buffer + register_block_state).
WILL CLOBBER data
register_block_state | should be a pointer to an initialized ascii_serial_com_register_block |
Definition at line 25 of file ascii_serial_com_register_block.c.
References ascii_serial_com_put_message_in_output_buffer(), ascii_serial_com_register_block_struct::block, convert_hex_to_uint16(), and ascii_serial_com_register_block_struct::n_regs.
void ascii_serial_com_register_block_init | ( | ascii_serial_com_register_block * | register_block_state, |
REGTYPE * | block, | ||
uint16_t | n_regs ) |
ASCII Serial Com Register Block init.
Initialize ASCII Serial Com register_block
register_block_state | should be an uninitialized ascii_serial_com_register_block object |
block | points to start of register block of memory |
n_regs | is the number of registers in the block (not necessarily the number of bytes) |
Definition at line 18 of file ascii_serial_com_register_block.c.
References ascii_serial_com_register_block_struct::block, and ascii_serial_com_register_block_struct::n_regs.