Function stm32ral::stm32g4::stm32g474::i2c::I2C2::take[][src]

pub fn take() -> Option<Instance>
Expand description

Safe access to I2C2

This function returns Some(Instance) if this instance is not currently taken, and None if it is. This ensures that if you do get Some(Instance), you are ensured unique access to the peripheral and there cannot be data races (unless other code uses unsafe, of course). You can then pass the Instance around to other functions as required. When you’re done with it, you can call release(instance) to return it.

Instance itself dereferences to a RegisterBlock, which provides access to the peripheral’s registers.