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
ascii_serial_com_register_block.h
Go to the documentation of this file.
1#ifndef ASCII_SERIAL_COM_REGISTER_BLOCK_H
2#define ASCII_SERIAL_COM_REGISTER_BLOCK_H
3
4/** \file ascii_serial_com_register_block.h
5 *
6 * \brief ASCII Serial Com Register Block
7 *
8 * Register interface for devices.
9 *
10 * This interface assumes the registers are a contigous block of memory
11 *
12 */
13
14#include "ascii_serial_com.h"
15
16#define REGWIDTHBITS 8
17#define REGWIDTHBYTES 1
18#define REGTYPE uint8_t
19#define REGPRINTTYPEINT PRIu8
20#define REGPRINTTYPEHEX PRIX8
21
22/** \brief ASCII Serial Com Register Block State struct
23 *
24 * Keeps track of the state of the ASCII Serial Com Register Block
25 *
26 */
28 REGTYPE *block; /**< points to start of register block of memory */
29 uint16_t n_regs; /**< size of block (number of registers not necessarily
30 number of bytes) */
32
33/** \brief ASCII Serial Com Register Block init
34 *
35 * Initialize ASCII Serial Com register_block
36 *
37 * \param register_block_state should be an uninitialized
38 * ascii_serial_com_register_block object
39 *
40 * \param block points to start of register block of memory
41 *
42 * \param n_regs is the number of registers in the block (not necessarily the
43 * number of bytes)
44 *
45 */
47 ascii_serial_com_register_block *register_block_state, REGTYPE *block,
48 uint16_t n_regs);
49
50/** \brief ASCII Serial Com Register Block handle message
51 *
52 * This is the function passed to ascii_serial_com_device as frw
53 *
54 * The parameters are the same as in that function (and
55 * ascii_serial_com_get_message_from_input_buffer + register_block_state).
56 *
57 * WILL CLOBBER data
58 *
59 * \param register_block_state should be a pointer to an initialized
60 * ascii_serial_com_register_block
61 *
62 */
64 ascii_serial_com *asc, char ascVersion, char appVersion, char command,
65 char *data, size_t dataLen, void *register_block_state);
66
67#endif
struct ascii_serial_com_register_block_struct ascii_serial_com_register_block
ASCII Serial Com Register Block State struct.
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.
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.
ASCII Serial Com Interface State struct.
ASCII Serial Com Register Block State struct.