Example #1
0
/**
 * @brief   Configures and activates the I2C peripheral.
 *
 * @param[in] i2cp      pointer to the @p I2CDriver object
 * @param[in] config    pointer to the @p I2CConfig object
 *
 * @api
 */
void i2cStart(I2CDriver *i2cp, const I2CConfig *config) {

  osalDbgCheck((i2cp != NULL) && (config != NULL));
  osalDbgAssert((i2cp->state == I2C_STOP) || (i2cp->state == I2C_READY) ||
                (i2cp->state == I2C_LOCKED), "invalid state");

  osalSysLock();
  i2cp->config = config;
  i2c_lld_start(i2cp);
  i2cp->state = I2C_READY;
  osalSysUnlock();
}
Example #2
0
/**
 * @brief   Configures and activates the I2C peripheral.
 *
 * @param[in] i2cp      pointer to the @p I2CDriver object
 * @param[in] config    pointer to the @p I2CConfig object
 *
 * @api
 */
void i2cStart(I2CDriver *i2cp, const I2CConfig *config) {

    chDbgCheck((i2cp != NULL) && (config != NULL), "i2cStart");

    chSysLock();
    chDbgAssert((i2cp->id_state == I2C_STOP) || (i2cp->id_state == I2C_READY),
                "i2cStart(), #1",
                "invalid state");
    i2cp->id_config = config;
    i2c_lld_start(i2cp);
    i2cp->id_state = I2C_READY;
    chSysUnlock();
}