32#ifndef JUNO_I2C_IO_API_H
33#define JUNO_I2C_IO_API_H
86#define ReadMsg(iAddr, pcBuff, zBuffSize) \
89 .tRead = (JUNO_I2C_IO_MSG_R_T) \
91 .tHdr = {JUNO_I2C_IO_MSG_TYPE_R, iAddr}, \
92 .ptReadBuff = pcBuff, \
93 .zReadBuffSize = zBuffSize \
97#define WriteMsg(iAddr, pvBuff, zBuffSize) \
100 .tWrite = (JUNO_I2C_IO_MSG_W_T) \
102 .tHdr = {JUNO_I2C_IO_MSG_TYPE_W, iAddr}, \
103 .ptWriteBuff = pvBuff, \
104 .zWriteBuffSize = zBuffSize \
111#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:68
#define JUNO_MODULE_EMPTY
Helper for module definitions with no additional members.
Definition module.h:87
#define JUNO_MODULE_ROOT(API_T,...)
Implement a module root struct containing ptApi and failure fields.
Definition module.h:129
int32_t JUNO_STATUS_T
Canonical status type for LibJuno functions.
Definition status.h:51
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:114
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:135
Definition i2c_io_api.h:60
JUNO_I2C_IO_MSG_TYPE_T tType
Definition i2c_io_api.h:61
uint8_t iAddr
Definition i2c_io_api.h:62
Definition i2c_io_api.h:66
uint8_t * ptReadBuff
Definition i2c_io_api.h:68
size_t zReadBuffSize
Definition i2c_io_api.h:69
JUNO_I2C_IO_MSG_HDR_T tHdr
Definition i2c_io_api.h:67
Definition i2c_io_api.h:73
const void * ptWriteBuff
Definition i2c_io_api.h:75
JUNO_I2C_IO_MSG_HDR_T tHdr
Definition i2c_io_api.h:74
size_t zWriteBuffSize
Definition i2c_io_api.h:76
Definition i2c_io_api.h:80
JUNO_I2C_IO_MSG_W_T tWrite
Definition i2c_io_api.h:82
JUNO_I2C_IO_MSG_HDR_T tHdr
Definition i2c_io_api.h:81
JUNO_I2C_IO_MSG_R_T tRead
Definition i2c_io_api.h:83