[−][src]Function i2c_hung_fix::try_unhang_i2c
pub fn try_unhang_i2c<C, A, D, E>(
scl: &mut C,
sda: &A,
delay: &mut D,
i2c_frequency: u32,
max_clock_cycles: u8
) -> Result<Sucess, Error<E>> where
C: OutputPin<Error = E>,
A: InputPin<Error = E>,
D: DelayUs<u32>,
This function applies the software based hung bus fix described the the lib doc
Arguments
scl
- the clock pin. Must implement OutputPin traitsda
- the data pin. Must implement InputPin traitdelay
- mutable reference to a struct that can perform blocking nano second delays. Must implement DelayUs traiti2c_frequency
- the frequency the I2C bus should be clocked at in Hertz. Can use FALLBACK_I2C_FREQUENCY if the frequency is unknown but getting the right frequency for the slave is preferablemax_clock_cycles
- the maxiumum number of times the clock will be cycled high->low->high before giving up and returning Error::StillHung. RECOMMENDED_MAX_CLOCK_CYCLES is a reasonable default value but this can be increased for misbehaving slaves devices