embassy/examples
bors[bot] 01e23bf9dd
Merge #1025
1025: Implement I2C timeouts, second attempt r=Dirbaio a=chemicstry

This is an alterrnative to #1022 as discussed there.

Timeouts are implemented using suggested `check_timeout: impl Fn() -> Result<(), Error>` function, which does not depend on `embassy-time` by default and is a noop for regular I2C.

This also adds `time` feature like in `embassy-nrf` to enable `embassy-time` dependencies. While at it, I also gated some other peripherals that depend on `embassy-time`, notably `usb` and (partially) `subghz`.

`TimeoutI2c` is currently only implemented for i2cv1, because i2cv2 has additional complications:
- Async methods still use a lot of busy waiting code in between DMA transfers, so simple `with_timeout()` will not work and it will have to use both types of timeouts. It could probably be rewritten to replace busy waits with IRQs, but that's outside the scope of this PR.
- I2C definition `I2c<'d, T, TXDMA, RXDMA>` is different from i2cv1 `I2c<'d, T>` making it hard to share single `TimeoutI2c` wrapper. A couple of options here:
  - Duplicate `TimeoutI2c` code
  - Add dummy `TXDMA`, `RXDMA` types to i2cv1 considering that in the future it should also support DMA

Co-authored-by: chemicstry <chemicstry@gmail.com>
2022-10-26 19:34:43 +00:00
..
boot all Cargo.toml: Add license to all crate Cargo.toml files 2022-10-07 12:41:56 +02:00
nrf Update Rust nightly. 2022-10-26 16:47:29 +02:00
nrf-rtos-trace all Cargo.toml: Add license to all crate Cargo.toml files 2022-10-07 12:41:56 +02:00
rp Update Rust nightly. 2022-10-26 16:47:29 +02:00
std Update Rust nightly. 2022-10-26 16:47:29 +02:00
stm32f0 all Cargo.toml: Add license to all crate Cargo.toml files 2022-10-07 12:41:56 +02:00
stm32f1 all Cargo.toml: Add license to all crate Cargo.toml files 2022-10-07 12:41:56 +02:00
stm32f2 all Cargo.toml: Add license to all crate Cargo.toml files 2022-10-07 12:41:56 +02:00
stm32f3 stm32: Add support for read_until_idle on UART 2022-10-26 19:06:18 +02:00
stm32f4 Merge #1025 2022-10-26 19:34:43 +00:00
stm32f7 stm32: Add support for read_until_idle on UART 2022-10-26 19:06:18 +02:00
stm32g0 all Cargo.toml: Add license to all crate Cargo.toml files 2022-10-07 12:41:56 +02:00
stm32g4 all Cargo.toml: Add license to all crate Cargo.toml files 2022-10-07 12:41:56 +02:00
stm32h7 Merge #1025 2022-10-26 19:34:43 +00:00
stm32l0 stm32: Add support for read_until_idle on UART 2022-10-26 19:06:18 +02:00
stm32l1 all Cargo.toml: Add license to all crate Cargo.toml files 2022-10-07 12:41:56 +02:00
stm32l4 stm32: Add support for read_until_idle on UART 2022-10-26 19:06:18 +02:00
stm32l5 Update Rust nightly. 2022-10-26 16:47:29 +02:00
stm32u5 all Cargo.toml: Add license to all crate Cargo.toml files 2022-10-07 12:41:56 +02:00
stm32wb all Cargo.toml: Add license to all crate Cargo.toml files 2022-10-07 12:41:56 +02:00
stm32wl all Cargo.toml: Add license to all crate Cargo.toml files 2022-10-07 12:41:56 +02:00
wasm all Cargo.toml: Add license to all crate Cargo.toml files 2022-10-07 12:41:56 +02:00