Skip to content

Commit

Permalink
Erase i2c peripheral instances (#2361)
Browse files Browse the repository at this point in the history
* Clean up

* Erase I2C instance type

* Clean up

* Implement Peripheral

* Changelog

* Remove with_timeout constructors
  • Loading branch information
bugadani authored Oct 23, 2024
1 parent 1afc9ee commit e367c83
Show file tree
Hide file tree
Showing 5 changed files with 295 additions and 315 deletions.
3 changes: 3 additions & 0 deletions esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `AnySpi` and `AnySpiDmaChannel`. (#2334)
- Added `AnyI2s` and `AnyI2sDmaChannel`. (#2367)
- `Pins::steal()` to unsafely obtain GPIO. (#2335)
- `I2c::with_timeout` (#2361)

### Changed

- Peripheral type erasure for SPI (#2334)
- Peripheral type erasure for I2S (#2367)
- Peripheral type erasure for I2C (#2361)

### Fixed

Expand All @@ -31,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- The `i2s::{I2sWrite, I2sWriteDma, I2sRead, I2sReadDma, I2sWriteDmaAsync, I2sReadDmaAsync}` traits have been removed. (#2316)
- The `ledc::ChannelHW` trait is no longer generic. (#2387)
- The `I2c::new_with_timeout` constructors have been removed (#2361)

## [0.21.1]

Expand Down
10 changes: 10 additions & 0 deletions esp-hal/MIGRATING-0.21.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ peripherals:

- SPI (both master and slave)
- I2S
- I2C

```diff
-Spi<'static, SPI2, FullDuplexMode>
Expand All @@ -49,3 +50,12 @@ the peripheral instance has been moved to the last generic parameter position.
```rust
let spi: Spi<'static, FullDuplexMode, SPI2> = Spi::new_typed(peripherals.SPI2, 1.MHz(), SpiMode::Mode0);
```

## I2C constructor changes

The `with_timeout` constructors have been removed in favour of `set_timeout` or `with_timeout`.

```diff
-let i2c = I2c::new_with_timeout(peripherals.I2C0, io.pins.gpio4, io.pins.gpio5, 100.kHz(), timeout);
+let i2c = I2c::new(peripherals.I2C0, io.pins.gpio4, io.pins.gpio5, 100.kHz()).with_timeout(timeout);
```
Loading

0 comments on commit e367c83

Please sign in to comment.