diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-26 15:44:26 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-26 15:44:26 +0200 |
commit | ee5d161f6153e1f9da73e477f63f38dcf52ca10c (patch) | |
tree | 926413950f64ed7b0f45f6b3551c16446ecd08d4 /lib/i2ctcp | |
parent | c77d271d9cb86bf6893098ec6c431fc87945e6c9 (diff) |
`make format`
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 - |