Hi,
There are several C API's at sensor library i2cm_drv.h and i2cm_drv.c that are declared as below.
I need a little help clarifying why the I2CMRead C API at i2cm_drv.c is an empty function?
Also, why the inline function I2CMRead is at the header file? From what I know, the inline function should be at C file.
i2cm_drv.c
// The extern here provides a non-inline definition for this function to handle
// the case where the compiler chooses not to inline the function (which is a
// valid choice for the compiler to make).
//
//*****************************************************************************
extern uint_fast8_t I2CMRead(tI2CMInstance *psInst, uint_fast8_t ui8Addr,
const uint8_t *pui8WriteData,
uint_fast16_t ui16WriteCount,
uint8_t *pui8ReadData,
uint_fast16_t ui16ReadCount,
tSensorCallback pfnCallback,
void *pvCallbackData);
i2cm_drv.h
//*****************************************************************************
//
// A convenience wrapper around I2CMCommand to perform a read.
//
//*****************************************************************************
inline uint_fast8_t
I2CMRead(tI2CMInstance *psInst, uint_fast8_t ui8Addr,
const uint8_t *pui8WriteData, uint_fast16_t ui16WriteCount,
uint8_t *pui8ReadData, uint_fast16_t ui16ReadCount,
tSensorCallback *pfnCallback, void *pvCallbackData)
{
return(I2CMCommand(psInst, ui8Addr, pui8WriteData, ui16WriteCount,
ui16WriteCount, pui8ReadData, ui16ReadCount,
ui16ReadCount, pfnCallback, pvCallbackData));
}
- kel