fn apb_cycles(self, half_bus_cycle: u32) -> Result<Option<u32>, ConfigError> {
        match self {
            BusTimeout::Maximum => Ok(Some(property!("i2c_master.max_bus_timeout"))),

            #[cfg(i2c_master_has_bus_timeout_enable)]
            BusTimeout::Disabled => Ok(None),

            BusTimeout::BusCycles(cycles) => {
                let raw = if cfg!(i2c_master_bus_timeout_is_exponential) {
                    let to_peri = (cycles * 2 * half_bus_cycle).max(1);
                    let log2 = to_peri.ilog2();
                    // If not a power of 2, round up so that we don't shorten timeouts.
                    if to_peri != 1 << log2 { log2 + 1 } else { log2 }
                } else {
                    cycles * 2 * half_bus_cycle
                };

                if raw <= property!("i2c_master.max_bus_timeout") {
                    Ok(Some(raw))
                } else {
                    Err(ConfigError::TimeoutInvalid)
                }
            }
        }
    }
Returns the timeout in APB cycles, or `None` if the timeout is disabled.

Newer devices only support power-of-two timeouts, so we'll have to take
the logarithm of the timeout value. This may cause considerably
longer (at most ~double) timeouts than configured. We may provide an
`ApbCycles` variant in the future to allow specifying the timeout in
APB cycles directly.
esp-hal/src/i2c/master/mod.rs