32#ifndef JUNO_I2C_IO_API_H
33#define JUNO_I2C_IO_API_H
85#define ReadMsg(iAddr, pcBuff, zBuffSize) \
88 .tRead = (JUNO_I2C_IO_MSG_R_T) \
90 .tHdr = {JUNO_I2C_IO_MSG_TYPE_R, iAddr}, \
91 .ptReadBuff = pcBuff, \
92 .zReadBuffSize = zBuffSize \
96#define WriteMsg(iAddr, pvBuff, zBuffSize) \
99 .tWrite = (JUNO_I2C_IO_MSG_W_T) \
101 .tHdr = {JUNO_I2C_IO_MSG_TYPE_W, iAddr}, \
102 .ptWriteBuff = pvBuff, \
103 .zWriteBuffSize = zBuffSize \
109#define JUNO_I2C_IO_TRANSFER(...) (JUNO_I2C_IO_MSG_T[]){__VA_ARGS__}
#define JUNO_MODULE_ROOT_DECLARE(NAME_T)
Forward-declare a module root struct type.
Definition module.h:67
#define JUNO_MODULE_EMPTY
Helper for module definitions with no additional members.
Definition module.h:86
#define JUNO_MODULE_ROOT(API_T,...)
Implement a module root struct containing ptApi and failure fields.
Definition module.h:126
int32_t JUNO_STATUS_T
Canonical status type for LibJuno functions.
Definition status.h:49
enum JUNO_I2C_IO_MSG_TYPE_TAG JUNO_I2C_IO_MSG_TYPE_T
JUNO_I2C_IO_MSG_TYPE_TAG
Definition i2c_io_api.h:52
@ JUNO_I2C_IO_MSG_TYPE_R
Definition i2c_io_api.h:55
@ JUNO_I2C_IO_MSG_TYPE_RESERVED
Definition i2c_io_api.h:53
@ JUNO_I2C_IO_MSG_TYPE_W
Definition i2c_io_api.h:54
Module system and dependency injection primitives for LibJuno.
Status codes and failure-handling helpers for LibJuno.
Definition i2c_io_api.h:112
JUNO_STATUS_T(* Transfer)(JUNO_I2C_IO_ROOT_T *ptI2c, const JUNO_I2C_IO_MSG_T *ptArrMsgs, size_t zMsgArrLen)
Perform an I2C transfer composed of one or more messages. Example usage:
Definition i2c_io_api.h:132
Definition i2c_io_api.h:59
JUNO_I2C_IO_MSG_TYPE_T tType
Definition i2c_io_api.h:60
uint8_t iAddr
Definition i2c_io_api.h:61
Definition i2c_io_api.h:65
uint8_t * ptReadBuff
Definition i2c_io_api.h:67
size_t zReadBuffSize
Definition i2c_io_api.h:68
JUNO_I2C_IO_MSG_HDR_T tHdr
Definition i2c_io_api.h:66
Definition i2c_io_api.h:72
const void * ptWriteBuff
Definition i2c_io_api.h:74
JUNO_I2C_IO_MSG_HDR_T tHdr
Definition i2c_io_api.h:73
size_t zWriteBuffSize
Definition i2c_io_api.h:75
Definition i2c_io_api.h:79
JUNO_I2C_IO_MSG_W_T tWrite
Definition i2c_io_api.h:81
JUNO_I2C_IO_MSG_HDR_T tHdr
Definition i2c_io_api.h:80
JUNO_I2C_IO_MSG_R_T tRead
Definition i2c_io_api.h:82