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
Macros | Functions
ascii_serial_com_register_pointers.c File Reference
#include "ascii_serial_com_register_pointers.h"
#include "asc_exception.h"
#include <assert.h>
Include dependency graph for ascii_serial_com_register_pointers.c:

Go to the source code of this file.

Macros

#define put_val_into_bytes(x, b)   convert_uint8_to_hex(x, (b), true)
 
#define get_val_from_bytes(b)   convert_hex_to_uint8((b))
 

Functions

void ascii_serial_com_register_pointers_init (ascii_serial_com_register_pointers *register_pointers_state, volatile REGTYPE **pointers, REGTYPE *write_masks, uint16_t n_regs)
 ASCII Serial Com Register Pointers init.
 
void ascii_serial_com_register_pointers_handle_message (ascii_serial_com *asc, char ascVersion, char appVersion, char command, char *data, size_t dataLen, void *register_pointers_state_vp)
 ASCII Serial Com Register Pointers handle message.
 

Macro Definition Documentation

◆ get_val_from_bytes

#define get_val_from_bytes ( b)    convert_hex_to_uint8((b))

Definition at line 9 of file ascii_serial_com_register_pointers.c.

◆ put_val_into_bytes

#define put_val_into_bytes ( x,
b )   convert_uint8_to_hex(x, (b), true)

Definition at line 8 of file ascii_serial_com_register_pointers.c.

Function Documentation

◆ ascii_serial_com_register_pointers_handle_message()

void ascii_serial_com_register_pointers_handle_message ( ascii_serial_com * asc,
char ascVersion,
char appVersion,
char command,
char * data,
size_t dataLen,
void * register_pointers_state )

ASCII Serial Com Register Pointers 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_pointers_state).

WILL CLOBBER data

Parameters
register_pointers_stateshould be a pointer to an initialized ascii_serial_com_register_pointers

Definition at line 26 of file ascii_serial_com_register_pointers.c.

References ascii_serial_com_put_error_in_output_buffer(), ascii_serial_com_put_message_in_output_buffer(), convert_hex_to_uint16(), ascii_serial_com_register_pointers_struct::n_regs, ascii_serial_com_register_pointers_struct::pointers, and ascii_serial_com_register_pointers_struct::write_masks.

◆ ascii_serial_com_register_pointers_init()

void ascii_serial_com_register_pointers_init ( ascii_serial_com_register_pointers * register_pointers_state,
volatile REGTYPE ** pointers,
REGTYPE * write_masks,
uint16_t n_regs )

ASCII Serial Com Register Pointers init.

Initialize ASCII Serial Com register_pointers

Parameters
register_pointers_stateshould be an uninitialized ascii_serial_com_register_pointers object
pointerspoints to an array of pointers to registers (entries may be NULL). It's volatile so that it can point to device registers without reads/writes to them being optimized out.
anarray of write masks. Every one bit in these masks is a bit that may be written to the registers.
n_regsis the number of registers in the pointers (not necessarily the number of bytes)

Definition at line 18 of file ascii_serial_com_register_pointers.c.

References ascii_serial_com_register_pointers_struct::n_regs, ascii_serial_com_register_pointers_struct::pointers, and ascii_serial_com_register_pointers_struct::write_masks.