puzzlebox
Loading...
Searching...
No Matches
i2ctcpv1.h
1#pragma once
2
3#include <stdbool.h>
4#include <stddef.h>
5#include <stdint.h>
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
38typedef struct {
39 uint16_t addr;
40 char * data;
41 size_t length;
42 size_t
43 _rdata;
45
65int i2ctcp_read(i2ctcp_msg_t * target, const char * buf, size_t buf_sz);
66
75void i2ctcp_read_reset(i2ctcp_msg_t * target);
76
93bool i2ctcp_write(const i2ctcp_msg_t * target, char ** buf, size_t * buf_sz);
94
96
97#ifdef __cplusplus
98}
99#endif
int i2ctcp_read(i2ctcp_msg_t *target, const char *buf, size_t buf_sz)
Read chunk of input stream, and store resulting message in target.
Definition i2ctcpv1.c:8
void i2ctcp_read_reset(i2ctcp_msg_t *target)
Reset the remaining message data counter.
Definition i2ctcpv1.c:29
bool i2ctcp_write(const i2ctcp_msg_t *target, char **buf, size_t *buf_sz)
Allocate and write a msgpack-formatted message to buf.
Definition i2ctcpv1.c:31
I²C over TCP message (v1)
Definition i2ctcpv1.h:38
char * data
message content
Definition i2ctcpv1.h:40
size_t length
message size
Definition i2ctcpv1.h:41
uint16_t addr
I²C address.
Definition i2ctcpv1.h:39