diff options
Diffstat (limited to 'lib/i2ctcp')
-rw-r--r-- | lib/i2ctcp/i2ctcpv1.c | 7 | ||||
-rw-r--r-- | lib/i2ctcp/i2ctcpv1.h | 8 |
2 files changed, 6 insertions, 9 deletions
diff --git a/lib/i2ctcp/i2ctcpv1.c b/lib/i2ctcp/i2ctcpv1.c index f70cbb1..1855cff 100644 --- a/lib/i2ctcp/i2ctcpv1.c +++ b/lib/i2ctcp/i2ctcpv1.c @@ -1,6 +1,6 @@ #include <mpack.h> #ifndef MIN -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) #endif #include "i2ctcpv1.h" @@ -26,9 +26,7 @@ int i2ctcp_read(i2ctcp_msg_t * target, const char * buf, size_t buf_sz) { return target->_rdata; } -void i2ctcp_read_reset(i2ctcp_msg_t * target) { - target->_rdata = 0; -} +void i2ctcp_read_reset(i2ctcp_msg_t * target) { target->_rdata = 0; } bool i2ctcp_write(const i2ctcp_msg_t * target, char ** buf, size_t * buf_sz) { mpack_writer_t writer; @@ -40,4 +38,3 @@ bool i2ctcp_write(const i2ctcp_msg_t * target, char ** buf, size_t * buf_sz) { // finish writing return mpack_writer_destroy(&writer) == mpack_ok; } - diff --git a/lib/i2ctcp/i2ctcpv1.h b/lib/i2ctcp/i2ctcpv1.h index e9bc0d9..f79b2e2 100644 --- a/lib/i2ctcp/i2ctcpv1.h +++ b/lib/i2ctcp/i2ctcpv1.h @@ -1,8 +1,8 @@ #pragma once +#include <stdbool.h> #include <stddef.h> #include <stdint.h> -#include <stdbool.h> #ifdef __cplusplus extern "C" { @@ -37,9 +37,10 @@ extern "C" { //! I2C over TCP message (v1) typedef struct { uint16_t addr; //!< I2C address - char * data; //!< message content + char * data; //!< message content size_t length; //!< message size - size_t _rdata; //!< \private remaining bytes to read until message is complete + size_t + _rdata; //!< \private remaining bytes to read until message is complete } i2ctcp_msg_t; /** @@ -96,4 +97,3 @@ bool i2ctcp_write(const i2ctcp_msg_t * target, char ** buf, size_t * buf_sz); #ifdef __cplusplus } #endif - |