MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / I2C_Init

Function I2C_Init

bsp/efm32/Libraries/emlib/src/em_i2c.c:286–302  ·  view source on GitHub ↗

/ * @brief * Initialize I2C. * * @param[in] i2c * Pointer to I2C peripheral register block. * * @param[in] init * Pointer to I2C initialization structure. ******************************************************************************/

Source from the content-addressed store, hash-verified

284 * Pointer to I2C initialization structure.
285 ******************************************************************************/
286void I2C_Init(I2C_TypeDef *i2c, const I2C_Init_TypeDef *init)
287{
288 EFM_ASSERT(I2C_REF_VALID(i2c));
289
290 i2c->IEN = 0;
291 i2c->IFC = _I2C_IFC_MASK;
292
293 I2C_BusFreqSet(i2c, init->refFreq, init->freq, init->clhr);
294
295 BITBAND_Peripheral(&(i2c->CTRL),
296 _I2C_CTRL_SLAVE_SHIFT,
297 ~((unsigned int)(init->master)));
298
299 BITBAND_Peripheral(&(i2c->CTRL),
300 _I2C_CTRL_EN_SHIFT,
301 (unsigned int)(init->enable));
302}
303
304
305/***************************************************************************//**

Callers 1

rt_hw_iic_unit_initFunction · 0.50

Calls 2

I2C_BusFreqSetFunction · 0.85
BITBAND_PeripheralFunction · 0.85

Tested by

no test coverage detected