30 #if (HAL_USE_I2C == TRUE) || defined(__DOXYGEN__) 76 #if I2C_USE_MUTUAL_EXCLUSION == TRUE 80 #if defined(I2C_DRIVER_EXT_INIT_HOOK) 81 I2C_DRIVER_EXT_INIT_HOOK(i2cp);
97 (i2cp->
state == I2C_LOCKED),
"invalid state");
120 (i2cp->
state == I2C_LOCKED),
"invalid state");
172 const uint8_t *txbuf,
180 (txbytes > 0U) && (txbuf != NULL) &&
181 ((rxbytes == 0U) || ((rxbytes > 0U) && (rxbuf != NULL))) &&
182 (timeout != TIME_IMMEDIATE));
190 rxbuf, rxbytes, timeout);
191 if (rdymsg == MSG_TIMEOUT) {
192 i2cp->
state = I2C_LOCKED;
230 (rxbytes > 0U) && (rxbuf != NULL) &&
231 (timeout != TIME_IMMEDIATE));
239 if (rdymsg == MSG_TIMEOUT) {
240 i2cp->
state = I2C_LOCKED;
249 #if (I2C_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
static void osalMutexObjectInit(mutex_t *mp)
Initializes s mutex_t object.
void i2cInit(void)
I2C Driver initialization.
msg_t i2cMasterTransmitTimeout(I2CDriver *i2cp, i2caddr_t addr, const uint8_t *txbuf, size_t txbytes, uint8_t *rxbuf, size_t rxbytes, sysinterval_t timeout)
Sends data via the I2C bus.
void i2c_lld_stop(I2CDriver *i2cp)
Deactivates the I2C peripheral.
void i2cStart(I2CDriver *i2cp, const I2CConfig *config)
Configures and activates the I2C peripheral.
Type of I2C driver configuration structure.
msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr, const uint8_t *txbuf, size_t txbytes, uint8_t *rxbuf, size_t rxbytes, sysinterval_t timeout)
Transmits data via the I2C bus as master.
#define i2c_lld_get_errors(i2cp)
Get errors from I2C driver.
void i2cAcquireBus(I2CDriver *i2cp)
Gains exclusive access to the I2C bus.
void i2cReleaseBus(I2CDriver *i2cp)
Releases exclusive access to the I2C bus.
void osalMutexLock(mutex_t *mp)
Locks the specified mutex.
static void osalSysUnlock(void)
Leaves a critical zone from thread context.
msg_t i2cMasterReceiveTimeout(I2CDriver *i2cp, i2caddr_t addr, uint8_t *rxbuf, size_t rxbytes, sysinterval_t timeout)
Receives data from the I2C bus.
i2cflags_t i2cGetErrors(I2CDriver *i2cp)
Returns the errors mask associated to the previous operation.
void i2cObjectInit(I2CDriver *i2cp)
Initializes the standard part of a I2CDriver structure.
msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr, uint8_t *rxbuf, size_t rxbytes, sysinterval_t timeout)
Receives data via the I2C bus as master.
int32_t msg_t
Type of a message.
void i2cStop(I2CDriver *i2cp)
Deactivates the I2C peripheral.
uint32_t i2cflags_t
Type of I2C Driver condition flags.
Structure representing an I2C driver.
#define osalDbgCheck(c)
Function parameters check.
void i2c_lld_start(I2CDriver *i2cp)
Configures and activates the I2C peripheral.
uint32_t sysinterval_t
Type of system time interval.
void i2c_lld_init(void)
Low level I2C driver initialization.
uint16_t i2caddr_t
Type representing an I2C address.
static void osalSysLock(void)
Enters a critical zone from thread context.
i2cflags_t errors
Error flags.
#define osalDbgAssert(c, remark)
Condition assertion.
const I2CConfig * config
Current configuration data.
void osalMutexUnlock(mutex_t *mp)
Unlocks the specified mutex.
i2cstate_t state
Driver state.
#define I2C_NO_ERROR
No error.