Skip to content

Commit

Permalink
Remove OutputOpenDrain
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Jan 24, 2025
1 parent 24f8458 commit 44f09fc
Show file tree
Hide file tree
Showing 25 changed files with 377 additions and 608 deletions.
9 changes: 3 additions & 6 deletions esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- SPI: Added support for 3-wire SPI (#2919)
- Add separate config for Rx and Tx (UART) #2965
- UART: Add separate config for Rx and Tx (#2965)

### Changed

Expand All @@ -25,12 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Rng` and `Trng` now implement `Peripheral<P = Self>` (#2992)
- SPI, UART, I2C: `with_<pin>` functions of peripheral drivers now disconnect the previously assigned pins from the peripheral. (#3012)
- SPI, UART, I2C: Dropping a driver now disconnects pins from their peripherals. (#3012)

- `Async` drivers are no longer `Send` (#2980)
- GPIO drivers now take configuration structs, and their constructors are fallible (#2990)
- `flip-link` feature is now a config option
- `flip-link` feature is now a config option (`ESP_HAL_CONFIG_FLIP_LINK`)

- GPIO drivers now take configuration structs (#2990, #3029)
- `flip-link` feature is now a config option (`ESP_HAL_CONFIG_FLIP_LINK`) (#3001)

- Removed features `psram-quad` and `psram-octal` - replaced by `psram` and the `ESP_HAL_CONFIG_PSRAM_MODE` (`quad`/`octal`) (#3001)
Expand All @@ -44,6 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed

- Removed `Pin`, `RtcPin` and `RtcPinWithResistors` implementations from `Flex` (#2938)
- OutputOpenDrain has been removed (#3029)

## [0.23.1] - 2025-01-15

Expand Down
29 changes: 21 additions & 8 deletions esp-hal/MIGRATING-0.23.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,28 @@ config/config.toml

## GPIO changes

GPIO drivers now take configuration structs, and their constructors are fallible.
GPIO drivers now take configuration structs.

```diff
- Input::new(peripherals.GPIO0, Pull::Up);
+ Input::new(peripherals.GPIO0, InputConfig::default().with_pull(Pull::Up)).unwrap();
+ Input::new(peripherals.GPIO0, InputConfig::default().with_pull_direction(Pull::Up));

- Output::new(peripherals.GPIO0, Level::Low);
+ Output::new(peripherals.GPIO0, OutputConfig::default().with_level(Level::Low)).unwrap();
- OutputOpenDrain::new(peripherals.GPIO0, Level::Low, Pull::Up);
+ OutputOpenDrain::new(
+ peripherals.GPIO0,
+ OutputOpenDrainConfig::default().with_level(Level::Low).with_pull(Pull::Up)
+ ).unwrap();
+ Output::new(peripherals.GPIO0, Level::Low, OutputConfig::default());
```

The OutputOpenDrain driver has been removed. You can use `Output` instead with
`DriveMode::OpenDrain`. The input-related methods of `OutputOpenDrain` (`level`,
`is_high`, `is_low`) have been added to `Output`. The GPIO input stage needs to be
enabled using `OutputConfig::with_input_enabled()`.

```diff
- OutputOpenDrain::new(peripherals.GPIO0, Level::Low);
+ Output::new(
peripherals.GPIO0,
Level::Low,
OutputConfig::default()
.with_drive_mode(DriveMode::OpenDrain)
.with_input_enabled(input_enabled),
);
```
Loading

0 comments on commit 44f09fc

Please sign in to comment.