Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random additional GPIO cleanups, implement Peripheral for drivers #2094

Merged
merged 20 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added missing functions to `Flex`: `unlisten`, `is_interrupt_set`, `wakeup_enable`, `wait_for_high`, `wait_for_low`, `wait_for_rising_edge`, `wait_for_falling_edge`, `wait_for_any_edge`. (#2075)
- `Flex` now implements `Wait`. (#2075)
- Added sleep and wakeup support for esp32c2 (#1922)
- `Input`, `Output`, `OutputOpenDrain` and `Flex` now implement `Peripheral`. (#2094)

### Changed

- Make saving and restoring SHA digest state an explicit operation (#2049)
- Reordered RX-TX pairs in all APIs to be consistent (#2074)

- Make saving and restoring SHA digest state an explicit operation (#2049)
- `Delay::new()` is now a `const` function (#1999)
- You can now create an `AnyPin` out of an `ErasedPin`. (#2072)
- `Input`, `Output`, `OutputOpenDrain` and `Flex` are now type-erased by default. Use the new `new_typed` constructor to keep using the ZST pin types. (#2075)
- To avoid confusion with the `Rtc::current_time` wall clock time APIs, we've renamed `esp_hal::time::current_time` to `esp_hal::time::now`. (#2091)
- Renamed `touch::Continous` to `touch::Continuous`. (#2094)
- The (previously undocumented) `ErasedPin` enum has been replaced with the `ErasedPin` struct. (#2094)

### Fixed
- SHA driver can now be safely used in multiple contexts concurrently (#2049)

- SHA driver can now be safely used in multiple contexts concurrently (#2049)
- Fixed an issue with DMA transfers potentially not waking up the correct async task (#2065)
- Fixed an issue with LCD_CAM i8080 where it would send double the clocks in 16bit mode (#2085)
- Fix i2c embedded-hal transaction (#2028)

### Removed
- Removed `digest::Digest` implementation from SHA (#2049)

- Removed `digest::Digest` implementation from SHA (#2049)
- Removed `NoPinType` in favour of `DummyPin`. (#2068)
- Removed the `async`, `embedded-hal-02`, `embedded-hal`, `embedded-io`, `embedded-io-async`, and `ufmt` features (#2070)
- Removed the `GpioN` type aliasses. Use `GpioPin<N>` instead. (#2073)
- Removed `Peripherals::take`. Use `esp_hal::init` to obtain `Peripherals` (#1999)
- Removed `AnyInputOnlyPin` in favour of `AnyPin`. (#2071)
- Removed the following functions from `GpioPin`: `is_high`, `is_low`, `set_high`, `set_low`, `set_state`, `is_set_high`, `is_set_low`, `toggle`. (#2094)

## [0.20.1] - 2024-08-30

Expand Down
22 changes: 0 additions & 22 deletions esp-hal/src/gpio/any_pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ impl<'d> Pin for AnyPin<'d> {
fn unlisten(&mut self, _internal: private::Internal);
fn is_interrupt_set(&self, _internal: private::Internal) -> bool;
fn clear_interrupt(&mut self, _internal: private::Internal);
fn wakeup_enable(&mut self, enable: bool, event: WakeEvent, _internal: private::Internal);
}
}
}
Expand All @@ -102,17 +101,6 @@ impl<'d> OutputPin for AnyPin<'d> {
}
}

fn connect_peripheral_to_output(&mut self, signal: OutputSignal, _internal: private::Internal) {
self.pin.connect_peripheral_to_output_with_options(
signal,
self.is_inverted,
false,
false,
self.is_inverted,
private::Internal,
);
}

fn connect_peripheral_to_output_with_options(
&mut self,
signal: OutputSignal,
Expand Down Expand Up @@ -148,23 +136,13 @@ impl<'d> InputPin for AnyPin<'d> {
delegate::delegate! {
to self.pin {
fn init_input(&self, pull_down: bool, pull_up: bool, _internal: private::Internal);
fn set_to_input(&mut self, _internal: private::Internal);
fn enable_input(&mut self, on: bool, _internal: private::Internal);
fn enable_input_in_sleep_mode(&mut self, on: bool, _internal: private::Internal);
fn is_input_high(&self, _internal: private::Internal) -> bool;
fn disconnect_input_from_peripheral(&mut self, signal: InputSignal, _internal: private::Internal);
}
}

fn connect_input_to_peripheral(&mut self, signal: InputSignal, _internal: private::Internal) {
self.pin.connect_input_to_peripheral_with_options(
signal,
self.is_inverted,
self.is_inverted,
private::Internal,
);
}

fn connect_input_to_peripheral_with_options(
&mut self,
signal: InputSignal,
Expand Down
2 changes: 0 additions & 2 deletions esp-hal/src/gpio/dummy_pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ impl OutputPin for DummyPin {
impl InputPin for DummyPin {
fn init_input(&self, _pull_down: bool, _pull_up: bool, _: private::Internal) {}

fn set_to_input(&mut self, _: private::Internal) {}

fn enable_input(&mut self, _on: bool, _: private::Internal) {}

fn enable_input_in_sleep_mode(&mut self, _on: bool, _: private::Internal) {}
Expand Down
Loading