Random additional GPIO cleanups, implement Peripheral for drivers (#2094)
* Reuse enable_iomux_clk_gate * Remove public functions * Remove set_to_input * Deduplicate constructor * Deduplicate is_listening * Hide PinFuture better * Deduplicate set_int_enable * Align macro indentation * Typo * Slightly simplify the touch_into macro * Implement the AnalogPin trait directly * Provide default impls for simple forwarding methods * Newtype ErasedPin * Merge rtc_pin macros * Fmt * Changelog * Fix migration guide * Fix example * Fix ETM
This commit is contained in:
parent
b5f0246129
commit
d6813a4bf0
@ -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)
|
- 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)
|
- `Flex` now implements `Wait`. (#2075)
|
||||||
- Added sleep and wakeup support for esp32c2 (#1922)
|
- Added sleep and wakeup support for esp32c2 (#1922)
|
||||||
|
- `Input`, `Output`, `OutputOpenDrain` and `Flex` now implement `Peripheral`. (#2094)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Make saving and restoring SHA digest state an explicit operation (#2049)
|
- Make saving and restoring SHA digest state an explicit operation (#2049)
|
||||||
- Reordered RX-TX pairs in all APIs to be consistent (#2074)
|
- 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)
|
- `Delay::new()` is now a `const` function (#1999)
|
||||||
- You can now create an `AnyPin` out of an `ErasedPin`. (#2072)
|
- 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)
|
- `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)
|
- 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
|
### 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 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)
|
- Fixed an issue with LCD_CAM i8080 where it would send double the clocks in 16bit mode (#2085)
|
||||||
- Fix i2c embedded-hal transaction (#2028)
|
- Fix i2c embedded-hal transaction (#2028)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Removed `digest::Digest` implementation from SHA (#2049)
|
|
||||||
|
|
||||||
|
- Removed `digest::Digest` implementation from SHA (#2049)
|
||||||
- Removed `NoPinType` in favour of `DummyPin`. (#2068)
|
- 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 `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 the `GpioN` type aliasses. Use `GpioPin<N>` instead. (#2073)
|
||||||
- Removed `Peripherals::take`. Use `esp_hal::init` to obtain `Peripherals` (#1999)
|
- Removed `Peripherals::take`. Use `esp_hal::init` to obtain `Peripherals` (#1999)
|
||||||
- Removed `AnyInputOnlyPin` in favour of `AnyPin`. (#2071)
|
- 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
|
## [0.20.1] - 2024-08-30
|
||||||
|
|
||||||
|
|||||||
@ -78,7 +78,6 @@ impl<'d> Pin for AnyPin<'d> {
|
|||||||
fn unlisten(&mut self, _internal: private::Internal);
|
fn unlisten(&mut self, _internal: private::Internal);
|
||||||
fn is_interrupt_set(&self, _internal: private::Internal) -> bool;
|
fn is_interrupt_set(&self, _internal: private::Internal) -> bool;
|
||||||
fn clear_interrupt(&mut self, _internal: private::Internal);
|
fn clear_interrupt(&mut self, _internal: private::Internal);
|
||||||
fn wakeup_enable(&mut self, enable: bool, event: WakeEvent, _internal: private::Internal);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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(
|
fn connect_peripheral_to_output_with_options(
|
||||||
&mut self,
|
&mut self,
|
||||||
signal: OutputSignal,
|
signal: OutputSignal,
|
||||||
@ -148,7 +136,6 @@ impl<'d> InputPin for AnyPin<'d> {
|
|||||||
delegate::delegate! {
|
delegate::delegate! {
|
||||||
to self.pin {
|
to self.pin {
|
||||||
fn init_input(&self, pull_down: bool, pull_up: bool, _internal: private::Internal);
|
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(&mut self, on: bool, _internal: private::Internal);
|
||||||
fn enable_input_in_sleep_mode(&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 is_input_high(&self, _internal: private::Internal) -> bool;
|
||||||
@ -156,15 +143,6 @@ impl<'d> InputPin for AnyPin<'d> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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(
|
fn connect_input_to_peripheral_with_options(
|
||||||
&mut self,
|
&mut self,
|
||||||
signal: InputSignal,
|
signal: InputSignal,
|
||||||
|
|||||||
@ -113,8 +113,6 @@ impl OutputPin for DummyPin {
|
|||||||
impl InputPin for DummyPin {
|
impl InputPin for DummyPin {
|
||||||
fn init_input(&self, _pull_down: bool, _pull_up: bool, _: private::Internal) {}
|
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(&mut self, _on: bool, _: private::Internal) {}
|
||||||
|
|
||||||
fn enable_input_in_sleep_mode(&mut self, _on: bool, _: private::Internal) {}
|
fn enable_input_in_sleep_mode(&mut self, _on: bool, _: private::Internal) {}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -999,7 +999,7 @@ mod private {
|
|||||||
P: InputPin,
|
P: InputPin,
|
||||||
{
|
{
|
||||||
into_ref!(pin);
|
into_ref!(pin);
|
||||||
pin.set_to_input(crate::private::Internal);
|
pin.init_input(false, false, crate::private::Internal);
|
||||||
pin.connect_input_to_peripheral(T::din_signal(), crate::private::Internal);
|
pin.connect_input_to_peripheral(T::din_signal(), crate::private::Internal);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|||||||
@ -311,7 +311,7 @@ impl<'d, CH: DmaChannel> Camera<'d, CH> {
|
|||||||
pub fn with_pixel_clock<PCLK: InputPin>(self, pclk: impl Peripheral<P = PCLK> + 'd) -> Self {
|
pub fn with_pixel_clock<PCLK: InputPin>(self, pclk: impl Peripheral<P = PCLK> + 'd) -> Self {
|
||||||
crate::into_ref!(pclk);
|
crate::into_ref!(pclk);
|
||||||
|
|
||||||
pclk.set_to_input(crate::private::Internal);
|
pclk.init_input(false, false, crate::private::Internal);
|
||||||
pclk.connect_input_to_peripheral(InputSignal::CAM_PCLK, crate::private::Internal);
|
pclk.connect_input_to_peripheral(InputSignal::CAM_PCLK, crate::private::Internal);
|
||||||
|
|
||||||
self
|
self
|
||||||
@ -327,9 +327,9 @@ impl<'d, CH: DmaChannel> Camera<'d, CH> {
|
|||||||
crate::into_ref!(vsync);
|
crate::into_ref!(vsync);
|
||||||
crate::into_ref!(h_enable);
|
crate::into_ref!(h_enable);
|
||||||
|
|
||||||
vsync.set_to_input(crate::private::Internal);
|
vsync.init_input(false, false, crate::private::Internal);
|
||||||
vsync.connect_input_to_peripheral(InputSignal::CAM_V_SYNC, crate::private::Internal);
|
vsync.connect_input_to_peripheral(InputSignal::CAM_V_SYNC, crate::private::Internal);
|
||||||
h_enable.set_to_input(crate::private::Internal);
|
h_enable.init_input(false, false, crate::private::Internal);
|
||||||
h_enable.connect_input_to_peripheral(InputSignal::CAM_H_ENABLE, crate::private::Internal);
|
h_enable.connect_input_to_peripheral(InputSignal::CAM_H_ENABLE, crate::private::Internal);
|
||||||
|
|
||||||
self.lcd_cam
|
self.lcd_cam
|
||||||
@ -351,11 +351,11 @@ impl<'d, CH: DmaChannel> Camera<'d, CH> {
|
|||||||
crate::into_ref!(hsync);
|
crate::into_ref!(hsync);
|
||||||
crate::into_ref!(h_enable);
|
crate::into_ref!(h_enable);
|
||||||
|
|
||||||
vsync.set_to_input(crate::private::Internal);
|
vsync.init_input(false, false, crate::private::Internal);
|
||||||
vsync.connect_input_to_peripheral(InputSignal::CAM_V_SYNC, crate::private::Internal);
|
vsync.connect_input_to_peripheral(InputSignal::CAM_V_SYNC, crate::private::Internal);
|
||||||
hsync.set_to_input(crate::private::Internal);
|
hsync.init_input(false, false, crate::private::Internal);
|
||||||
hsync.connect_input_to_peripheral(InputSignal::CAM_H_SYNC, crate::private::Internal);
|
hsync.connect_input_to_peripheral(InputSignal::CAM_H_SYNC, crate::private::Internal);
|
||||||
h_enable.set_to_input(crate::private::Internal);
|
h_enable.init_input(false, false, crate::private::Internal);
|
||||||
h_enable.connect_input_to_peripheral(InputSignal::CAM_H_ENABLE, crate::private::Internal);
|
h_enable.connect_input_to_peripheral(InputSignal::CAM_H_ENABLE, crate::private::Internal);
|
||||||
|
|
||||||
self.lcd_cam
|
self.lcd_cam
|
||||||
@ -475,21 +475,21 @@ impl RxEightBits {
|
|||||||
crate::into_ref!(pin_6);
|
crate::into_ref!(pin_6);
|
||||||
crate::into_ref!(pin_7);
|
crate::into_ref!(pin_7);
|
||||||
|
|
||||||
pin_0.set_to_input(crate::private::Internal);
|
pin_0.init_input(false, false, crate::private::Internal);
|
||||||
pin_0.connect_input_to_peripheral(InputSignal::CAM_DATA_0, crate::private::Internal);
|
pin_0.connect_input_to_peripheral(InputSignal::CAM_DATA_0, crate::private::Internal);
|
||||||
pin_1.set_to_input(crate::private::Internal);
|
pin_1.init_input(false, false, crate::private::Internal);
|
||||||
pin_1.connect_input_to_peripheral(InputSignal::CAM_DATA_1, crate::private::Internal);
|
pin_1.connect_input_to_peripheral(InputSignal::CAM_DATA_1, crate::private::Internal);
|
||||||
pin_2.set_to_input(crate::private::Internal);
|
pin_2.init_input(false, false, crate::private::Internal);
|
||||||
pin_2.connect_input_to_peripheral(InputSignal::CAM_DATA_2, crate::private::Internal);
|
pin_2.connect_input_to_peripheral(InputSignal::CAM_DATA_2, crate::private::Internal);
|
||||||
pin_3.set_to_input(crate::private::Internal);
|
pin_3.init_input(false, false, crate::private::Internal);
|
||||||
pin_3.connect_input_to_peripheral(InputSignal::CAM_DATA_3, crate::private::Internal);
|
pin_3.connect_input_to_peripheral(InputSignal::CAM_DATA_3, crate::private::Internal);
|
||||||
pin_4.set_to_input(crate::private::Internal);
|
pin_4.init_input(false, false, crate::private::Internal);
|
||||||
pin_4.connect_input_to_peripheral(InputSignal::CAM_DATA_4, crate::private::Internal);
|
pin_4.connect_input_to_peripheral(InputSignal::CAM_DATA_4, crate::private::Internal);
|
||||||
pin_5.set_to_input(crate::private::Internal);
|
pin_5.init_input(false, false, crate::private::Internal);
|
||||||
pin_5.connect_input_to_peripheral(InputSignal::CAM_DATA_5, crate::private::Internal);
|
pin_5.connect_input_to_peripheral(InputSignal::CAM_DATA_5, crate::private::Internal);
|
||||||
pin_6.set_to_input(crate::private::Internal);
|
pin_6.init_input(false, false, crate::private::Internal);
|
||||||
pin_6.connect_input_to_peripheral(InputSignal::CAM_DATA_6, crate::private::Internal);
|
pin_6.connect_input_to_peripheral(InputSignal::CAM_DATA_6, crate::private::Internal);
|
||||||
pin_7.set_to_input(crate::private::Internal);
|
pin_7.init_input(false, false, crate::private::Internal);
|
||||||
pin_7.connect_input_to_peripheral(InputSignal::CAM_DATA_7, crate::private::Internal);
|
pin_7.connect_input_to_peripheral(InputSignal::CAM_DATA_7, crate::private::Internal);
|
||||||
|
|
||||||
Self { _pins: () }
|
Self { _pins: () }
|
||||||
@ -563,37 +563,37 @@ impl RxSixteenBits {
|
|||||||
crate::into_ref!(pin_14);
|
crate::into_ref!(pin_14);
|
||||||
crate::into_ref!(pin_15);
|
crate::into_ref!(pin_15);
|
||||||
|
|
||||||
pin_0.set_to_input(crate::private::Internal);
|
pin_0.init_input(false, false, crate::private::Internal);
|
||||||
pin_0.connect_input_to_peripheral(InputSignal::CAM_DATA_0, crate::private::Internal);
|
pin_0.connect_input_to_peripheral(InputSignal::CAM_DATA_0, crate::private::Internal);
|
||||||
pin_1.set_to_input(crate::private::Internal);
|
pin_1.init_input(false, false, crate::private::Internal);
|
||||||
pin_1.connect_input_to_peripheral(InputSignal::CAM_DATA_1, crate::private::Internal);
|
pin_1.connect_input_to_peripheral(InputSignal::CAM_DATA_1, crate::private::Internal);
|
||||||
pin_2.set_to_input(crate::private::Internal);
|
pin_2.init_input(false, false, crate::private::Internal);
|
||||||
pin_2.connect_input_to_peripheral(InputSignal::CAM_DATA_2, crate::private::Internal);
|
pin_2.connect_input_to_peripheral(InputSignal::CAM_DATA_2, crate::private::Internal);
|
||||||
pin_3.set_to_input(crate::private::Internal);
|
pin_3.init_input(false, false, crate::private::Internal);
|
||||||
pin_3.connect_input_to_peripheral(InputSignal::CAM_DATA_3, crate::private::Internal);
|
pin_3.connect_input_to_peripheral(InputSignal::CAM_DATA_3, crate::private::Internal);
|
||||||
pin_4.set_to_input(crate::private::Internal);
|
pin_4.init_input(false, false, crate::private::Internal);
|
||||||
pin_4.connect_input_to_peripheral(InputSignal::CAM_DATA_4, crate::private::Internal);
|
pin_4.connect_input_to_peripheral(InputSignal::CAM_DATA_4, crate::private::Internal);
|
||||||
pin_5.set_to_input(crate::private::Internal);
|
pin_5.init_input(false, false, crate::private::Internal);
|
||||||
pin_5.connect_input_to_peripheral(InputSignal::CAM_DATA_5, crate::private::Internal);
|
pin_5.connect_input_to_peripheral(InputSignal::CAM_DATA_5, crate::private::Internal);
|
||||||
pin_6.set_to_input(crate::private::Internal);
|
pin_6.init_input(false, false, crate::private::Internal);
|
||||||
pin_6.connect_input_to_peripheral(InputSignal::CAM_DATA_6, crate::private::Internal);
|
pin_6.connect_input_to_peripheral(InputSignal::CAM_DATA_6, crate::private::Internal);
|
||||||
pin_7.set_to_input(crate::private::Internal);
|
pin_7.init_input(false, false, crate::private::Internal);
|
||||||
pin_7.connect_input_to_peripheral(InputSignal::CAM_DATA_7, crate::private::Internal);
|
pin_7.connect_input_to_peripheral(InputSignal::CAM_DATA_7, crate::private::Internal);
|
||||||
pin_8.set_to_input(crate::private::Internal);
|
pin_8.init_input(false, false, crate::private::Internal);
|
||||||
pin_8.connect_input_to_peripheral(InputSignal::CAM_DATA_8, crate::private::Internal);
|
pin_8.connect_input_to_peripheral(InputSignal::CAM_DATA_8, crate::private::Internal);
|
||||||
pin_9.set_to_input(crate::private::Internal);
|
pin_9.init_input(false, false, crate::private::Internal);
|
||||||
pin_9.connect_input_to_peripheral(InputSignal::CAM_DATA_9, crate::private::Internal);
|
pin_9.connect_input_to_peripheral(InputSignal::CAM_DATA_9, crate::private::Internal);
|
||||||
pin_10.set_to_input(crate::private::Internal);
|
pin_10.init_input(false, false, crate::private::Internal);
|
||||||
pin_10.connect_input_to_peripheral(InputSignal::CAM_DATA_10, crate::private::Internal);
|
pin_10.connect_input_to_peripheral(InputSignal::CAM_DATA_10, crate::private::Internal);
|
||||||
pin_11.set_to_input(crate::private::Internal);
|
pin_11.init_input(false, false, crate::private::Internal);
|
||||||
pin_11.connect_input_to_peripheral(InputSignal::CAM_DATA_11, crate::private::Internal);
|
pin_11.connect_input_to_peripheral(InputSignal::CAM_DATA_11, crate::private::Internal);
|
||||||
pin_12.set_to_input(crate::private::Internal);
|
pin_12.init_input(false, false, crate::private::Internal);
|
||||||
pin_12.connect_input_to_peripheral(InputSignal::CAM_DATA_12, crate::private::Internal);
|
pin_12.connect_input_to_peripheral(InputSignal::CAM_DATA_12, crate::private::Internal);
|
||||||
pin_13.set_to_input(crate::private::Internal);
|
pin_13.init_input(false, false, crate::private::Internal);
|
||||||
pin_13.connect_input_to_peripheral(InputSignal::CAM_DATA_13, crate::private::Internal);
|
pin_13.connect_input_to_peripheral(InputSignal::CAM_DATA_13, crate::private::Internal);
|
||||||
pin_14.set_to_input(crate::private::Internal);
|
pin_14.init_input(false, false, crate::private::Internal);
|
||||||
pin_14.connect_input_to_peripheral(InputSignal::CAM_DATA_14, crate::private::Internal);
|
pin_14.connect_input_to_peripheral(InputSignal::CAM_DATA_14, crate::private::Internal);
|
||||||
pin_15.set_to_input(crate::private::Internal);
|
pin_15.init_input(false, false, crate::private::Internal);
|
||||||
pin_15.connect_input_to_peripheral(InputSignal::CAM_DATA_15, crate::private::Internal);
|
pin_15.connect_input_to_peripheral(InputSignal::CAM_DATA_15, crate::private::Internal);
|
||||||
|
|
||||||
Self { _pins: () }
|
Self { _pins: () }
|
||||||
|
|||||||
@ -332,7 +332,7 @@ where
|
|||||||
pcr.parl_clk_tx_conf()
|
pcr.parl_clk_tx_conf()
|
||||||
.modify(|_, w| unsafe { w.parl_clk_tx_sel().bits(3).parl_clk_tx_div_num().bits(0) }); // PAD_CLK_TX, no divider
|
.modify(|_, w| unsafe { w.parl_clk_tx_sel().bits(3).parl_clk_tx_div_num().bits(0) }); // PAD_CLK_TX, no divider
|
||||||
|
|
||||||
self.pin.set_to_input(crate::private::Internal);
|
self.pin.init_input(false, false, crate::private::Internal);
|
||||||
self.pin.connect_input_to_peripheral(
|
self.pin.connect_input_to_peripheral(
|
||||||
crate::gpio::InputSignal::PARL_TX_CLK,
|
crate::gpio::InputSignal::PARL_TX_CLK,
|
||||||
crate::private::Internal,
|
crate::private::Internal,
|
||||||
@ -367,7 +367,7 @@ where
|
|||||||
pcr.parl_clk_rx_conf()
|
pcr.parl_clk_rx_conf()
|
||||||
.modify(|_, w| unsafe { w.parl_clk_rx_sel().bits(3).parl_clk_rx_div_num().bits(0) }); // PAD_CLK_TX, no divider
|
.modify(|_, w| unsafe { w.parl_clk_rx_sel().bits(3).parl_clk_rx_div_num().bits(0) }); // PAD_CLK_TX, no divider
|
||||||
|
|
||||||
self.pin.set_to_input(crate::private::Internal);
|
self.pin.init_input(false, false, crate::private::Internal);
|
||||||
self.pin.connect_input_to_peripheral(
|
self.pin.connect_input_to_peripheral(
|
||||||
crate::gpio::InputSignal::PARL_RX_CLK,
|
crate::gpio::InputSignal::PARL_RX_CLK,
|
||||||
crate::private::Internal,
|
crate::private::Internal,
|
||||||
@ -634,7 +634,8 @@ where
|
|||||||
{
|
{
|
||||||
fn configure(&mut self) -> Result<(), Error> {
|
fn configure(&mut self) -> Result<(), Error> {
|
||||||
self.rx_pins.configure()?;
|
self.rx_pins.configure()?;
|
||||||
self.valid_pin.set_to_input(crate::private::Internal);
|
self.valid_pin
|
||||||
|
.init_input(false, false, crate::private::Internal);
|
||||||
self.valid_pin
|
self.valid_pin
|
||||||
.connect_input_to_peripheral(Instance::rx_valid_pin_signal(), crate::private::Internal);
|
.connect_input_to_peripheral(Instance::rx_valid_pin_signal(), crate::private::Internal);
|
||||||
Instance::set_rx_sw_en(false);
|
Instance::set_rx_sw_en(false);
|
||||||
@ -738,7 +739,7 @@ macro_rules! rx_pins {
|
|||||||
{
|
{
|
||||||
fn configure(&mut self) -> Result<(), Error> {
|
fn configure(&mut self) -> Result<(), Error> {
|
||||||
$(
|
$(
|
||||||
self.[< pin_ $pin:lower >].set_to_input($crate::private::Internal);
|
self.[< pin_ $pin:lower >].init_input(false, false, $crate::private::Internal);
|
||||||
self.[< pin_ $pin:lower >].connect_input_to_peripheral(crate::gpio::InputSignal::$signal, $crate::private::Internal);
|
self.[< pin_ $pin:lower >].connect_input_to_peripheral(crate::gpio::InputSignal::$signal, $crate::private::Internal);
|
||||||
)+
|
)+
|
||||||
|
|
||||||
|
|||||||
@ -194,11 +194,11 @@ pub trait Peripheral: Sized + crate::private::Sealed {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Peripheral for &mut T
|
impl<T, P> Peripheral for &mut T
|
||||||
where
|
where
|
||||||
T: Peripheral<P = T>,
|
T: Peripheral<P = P>,
|
||||||
{
|
{
|
||||||
type P = T;
|
type P = P;
|
||||||
|
|
||||||
unsafe fn clone_unchecked(&mut self) -> Self::P {
|
unsafe fn clone_unchecked(&mut self) -> Self::P {
|
||||||
T::clone_unchecked(self)
|
T::clone_unchecked(self)
|
||||||
|
|||||||
@ -387,7 +387,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
crate::into_ref!(pin);
|
crate::into_ref!(pin);
|
||||||
pin.set_to_input(crate::private::Internal);
|
pin.init_input(false, false, crate::private::Internal);
|
||||||
pin.connect_input_to_peripheral(T::input_signal(), crate::private::Internal);
|
pin.connect_input_to_peripheral(T::input_signal(), crate::private::Internal);
|
||||||
T::set_divider(config.clk_divider);
|
T::set_divider(config.clk_divider);
|
||||||
T::set_carrier(
|
T::set_carrier(
|
||||||
@ -433,7 +433,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
crate::into_ref!(pin);
|
crate::into_ref!(pin);
|
||||||
pin.set_to_input(crate::private::Internal);
|
pin.init_input(false, false, crate::private::Internal);
|
||||||
pin.connect_input_to_peripheral(T::input_signal(), crate::private::Internal);
|
pin.connect_input_to_peripheral(T::input_signal(), crate::private::Internal);
|
||||||
T::set_divider(config.clk_divider);
|
T::set_divider(config.clk_divider);
|
||||||
T::set_carrier(
|
T::set_carrier(
|
||||||
|
|||||||
@ -804,74 +804,74 @@ crate::gpio::gpio! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
crate::gpio::analog! {
|
crate::gpio::analog! {
|
||||||
(36, 0, sensor_pads(), sense1_mux_sel, sense1_fun_sel, sense1_fun_ie)
|
(36, 0, sensor_pads(), sense1_mux_sel, sense1_fun_sel, sense1_fun_ie)
|
||||||
(37, 1, sensor_pads(), sense2_mux_sel, sense2_fun_sel, sense2_fun_ie)
|
(37, 1, sensor_pads(), sense2_mux_sel, sense2_fun_sel, sense2_fun_ie)
|
||||||
(38, 2, sensor_pads(), sense3_mux_sel, sense3_fun_sel, sense3_fun_ie)
|
(38, 2, sensor_pads(), sense3_mux_sel, sense3_fun_sel, sense3_fun_ie)
|
||||||
(39, 3, sensor_pads(), sense4_mux_sel, sense4_fun_sel, sense4_fun_ie)
|
(39, 3, sensor_pads(), sense4_mux_sel, sense4_fun_sel, sense4_fun_ie)
|
||||||
(34, 4, adc_pad(), adc1_mux_sel, adc1_fun_sel, adc1_fun_ie)
|
(34, 4, adc_pad(), adc1_mux_sel, adc1_fun_sel, adc1_fun_ie)
|
||||||
(35, 5, adc_pad(), adc2_mux_sel, adc2_fun_sel, adc1_fun_ie)
|
(35, 5, adc_pad(), adc2_mux_sel, adc2_fun_sel, adc1_fun_ie)
|
||||||
(25, 6, pad_dac1(), mux_sel, fun_sel, fun_ie, rue, rde)
|
(25, 6, pad_dac1(), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
(26, 7, pad_dac2(), mux_sel, fun_sel, fun_ie, rue, rde)
|
(26, 7, pad_dac2(), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
(33, 8, xtal_32k_pad(), x32n_mux_sel, x32n_fun_sel, x32n_fun_ie, x32n_rue, x32n_rde )
|
(33, 8, xtal_32k_pad(), x32n_mux_sel, x32n_fun_sel, x32n_fun_ie, x32n_rue, x32n_rde )
|
||||||
(32, 9, xtal_32k_pad(), x32p_mux_sel, x32p_fun_sel, x32p_fun_ie, x32p_rue, x32p_rde )
|
(32, 9, xtal_32k_pad(), x32p_mux_sel, x32p_fun_sel, x32p_fun_ie, x32p_rue, x32p_rde )
|
||||||
(4, 10, touch_pad0(), mux_sel, fun_sel, fun_ie, rue, rde )
|
(4, 10, touch_pad0(), mux_sel, fun_sel, fun_ie, rue, rde )
|
||||||
(0, 11, touch_pad1(), mux_sel, fun_sel, fun_ie, rue, rde )
|
(0, 11, touch_pad1(), mux_sel, fun_sel, fun_ie, rue, rde )
|
||||||
(2, 12, touch_pad2(), mux_sel, fun_sel, fun_ie, rue, rde )
|
(2, 12, touch_pad2(), mux_sel, fun_sel, fun_ie, rue, rde )
|
||||||
(15, 13, touch_pad3(), mux_sel, fun_sel, fun_ie, rue, rde )
|
(15, 13, touch_pad3(), mux_sel, fun_sel, fun_ie, rue, rde )
|
||||||
(13, 14, touch_pad4(), mux_sel, fun_sel, fun_ie, rue, rde )
|
(13, 14, touch_pad4(), mux_sel, fun_sel, fun_ie, rue, rde )
|
||||||
(12, 15, touch_pad5(), mux_sel, fun_sel, fun_ie, rue, rde )
|
(12, 15, touch_pad5(), mux_sel, fun_sel, fun_ie, rue, rde )
|
||||||
(14, 16, touch_pad6(), mux_sel, fun_sel, fun_ie, rue, rde )
|
(14, 16, touch_pad6(), mux_sel, fun_sel, fun_ie, rue, rde )
|
||||||
(27, 17, touch_pad7(), mux_sel, fun_sel, fun_ie, rue, rde )
|
(27, 17, touch_pad7(), mux_sel, fun_sel, fun_ie, rue, rde )
|
||||||
}
|
}
|
||||||
|
|
||||||
crate::gpio::rtc_pins! {
|
crate::gpio::rtc_pins! {
|
||||||
(36, 0, sensor_pads(), sense1_, sense1_hold_force )
|
(36, 0, sensor_pads(), sense1_, sense1_hold_force )
|
||||||
(37, 1, sensor_pads(), sense2_, sense2_hold_force )
|
(37, 1, sensor_pads(), sense2_, sense2_hold_force )
|
||||||
(38, 2, sensor_pads(), sense3_, sense3_hold_force )
|
(38, 2, sensor_pads(), sense3_, sense3_hold_force )
|
||||||
(39, 3, sensor_pads(), sense4_, sense4_hold_force )
|
(39, 3, sensor_pads(), sense4_, sense4_hold_force )
|
||||||
(34, 4, adc_pad(), adc1_, adc1_hold_force )
|
(34, 4, adc_pad(), adc1_, adc1_hold_force )
|
||||||
(35, 5, adc_pad(), adc2_, adc2_hold_force )
|
(35, 5, adc_pad(), adc2_, adc2_hold_force )
|
||||||
(25, 6, pad_dac1(), "", pdac1_hold_force, rue, rde )
|
(25, 6, pad_dac1(), "", pdac1_hold_force, rue, rde )
|
||||||
(26, 7, pad_dac2(), "", pdac2_hold_force, rue, rde )
|
(26, 7, pad_dac2(), "", pdac2_hold_force, rue, rde )
|
||||||
(33, 8, xtal_32k_pad(), x32n_, x32n_hold_force, x32n_rue, x32n_rde )
|
(33, 8, xtal_32k_pad(), x32n_, x32n_hold_force, x32n_rue, x32n_rde )
|
||||||
(32, 9, xtal_32k_pad(), x32p_, x32p_hold_force, x32p_rue, x32p_rde )
|
(32, 9, xtal_32k_pad(), x32p_, x32p_hold_force, x32p_rue, x32p_rde )
|
||||||
(4, 10, touch_pad0(), "", touch_pad0_hold_force, rue, rde )
|
(4, 10, touch_pad0(), "", touch_pad0_hold_force, rue, rde )
|
||||||
(0, 11, touch_pad1(), "", touch_pad1_hold_force, rue, rde )
|
(0, 11, touch_pad1(), "", touch_pad1_hold_force, rue, rde )
|
||||||
(2, 12, touch_pad2(), "", touch_pad2_hold_force, rue, rde )
|
(2, 12, touch_pad2(), "", touch_pad2_hold_force, rue, rde )
|
||||||
(15, 13, touch_pad3(), "", touch_pad3_hold_force, rue, rde )
|
(15, 13, touch_pad3(), "", touch_pad3_hold_force, rue, rde )
|
||||||
(13, 14, touch_pad4(), "", touch_pad4_hold_force, rue, rde )
|
(13, 14, touch_pad4(), "", touch_pad4_hold_force, rue, rde )
|
||||||
(12, 15, touch_pad5(), "", touch_pad5_hold_force, rue, rde )
|
(12, 15, touch_pad5(), "", touch_pad5_hold_force, rue, rde )
|
||||||
(14, 16, touch_pad6(), "", touch_pad6_hold_force, rue, rde )
|
(14, 16, touch_pad6(), "", touch_pad6_hold_force, rue, rde )
|
||||||
(27, 17, touch_pad7(), "", touch_pad7_hold_force, rue, rde )
|
(27, 17, touch_pad7(), "", touch_pad7_hold_force, rue, rde )
|
||||||
}
|
}
|
||||||
|
|
||||||
crate::gpio::touch_into! {
|
crate::gpio::touch_into! {
|
||||||
// (touch_nr, pin_nr, rtc_pin, touch_comb_reg_nr, normal_pin)
|
// (touch_nr, pin_nr, rtc_pin, touch_comb_reg_nr, normal_pin)
|
||||||
(0, 4, 10, sar_touch_thres1, touch_out_th0, true )
|
(0, 4, 10, sar_touch_thres1, touch_out_th0, true )
|
||||||
(1, 0, 11, sar_touch_thres1, touch_out_th1, true )
|
(1, 0, 11, sar_touch_thres1, touch_out_th1, true )
|
||||||
(2, 2, 12, sar_touch_thres2, touch_out_th2, true )
|
(2, 2, 12, sar_touch_thres2, touch_out_th2, true )
|
||||||
(3, 15, 13, sar_touch_thres2, touch_out_th3, true )
|
(3, 15, 13, sar_touch_thres2, touch_out_th3, true )
|
||||||
(4, 13, 14, sar_touch_thres3, touch_out_th4, true )
|
(4, 13, 14, sar_touch_thres3, touch_out_th4, true )
|
||||||
(5, 12, 15, sar_touch_thres3, touch_out_th5, true )
|
(5, 12, 15, sar_touch_thres3, touch_out_th5, true )
|
||||||
(6, 14, 16, sar_touch_thres4, touch_out_th6, true )
|
(6, 14, 16, sar_touch_thres4, touch_out_th6, true )
|
||||||
(7, 27, 17, sar_touch_thres4, touch_out_th7, true )
|
(7, 27, 17, sar_touch_thres4, touch_out_th7, true )
|
||||||
---
|
// ---
|
||||||
(8, 33, 8, sar_touch_thres5, touch_out_th8, false )
|
(8, 33, 8, sar_touch_thres5, touch_out_th8, false )
|
||||||
(9, 32, 9, sar_touch_thres5, touch_out_th9, false )
|
(9, 32, 9, sar_touch_thres5, touch_out_th9, false )
|
||||||
}
|
}
|
||||||
|
|
||||||
crate::gpio::touch_common! {
|
crate::gpio::touch_common! {
|
||||||
// (touch_nr, pin_nr, touch_out_reg, touch_thres_reg )
|
// (touch_nr, pin_nr, touch_out_reg, touch_thres_reg )
|
||||||
(0, 4, sar_touch_out1, touch_meas_out0, sar_touch_thres1, touch_out_th0)
|
(0, 4, sar_touch_out1, touch_meas_out0, sar_touch_thres1, touch_out_th0)
|
||||||
(1, 0, sar_touch_out1, touch_meas_out1, sar_touch_thres1, touch_out_th1)
|
(1, 0, sar_touch_out1, touch_meas_out1, sar_touch_thres1, touch_out_th1)
|
||||||
(2, 2, sar_touch_out2, touch_meas_out2, sar_touch_thres2, touch_out_th2)
|
(2, 2, sar_touch_out2, touch_meas_out2, sar_touch_thres2, touch_out_th2)
|
||||||
(3, 15, sar_touch_out2, touch_meas_out3, sar_touch_thres2, touch_out_th3)
|
(3, 15, sar_touch_out2, touch_meas_out3, sar_touch_thres2, touch_out_th3)
|
||||||
(4, 13, sar_touch_out3, touch_meas_out4, sar_touch_thres3, touch_out_th4)
|
(4, 13, sar_touch_out3, touch_meas_out4, sar_touch_thres3, touch_out_th4)
|
||||||
(5, 12, sar_touch_out3, touch_meas_out5, sar_touch_thres3, touch_out_th5)
|
(5, 12, sar_touch_out3, touch_meas_out5, sar_touch_thres3, touch_out_th5)
|
||||||
(6, 14, sar_touch_out4, touch_meas_out6, sar_touch_thres4, touch_out_th6)
|
(6, 14, sar_touch_out4, touch_meas_out6, sar_touch_thres4, touch_out_th6)
|
||||||
(7, 27, sar_touch_out4, touch_meas_out7, sar_touch_thres4, touch_out_th7)
|
(7, 27, sar_touch_out4, touch_meas_out7, sar_touch_thres4, touch_out_th7)
|
||||||
(8, 33, sar_touch_out5, touch_meas_out8, sar_touch_thres5, touch_out_th8)
|
(8, 33, sar_touch_out5, touch_meas_out8, sar_touch_thres5, touch_out_th8)
|
||||||
(9, 32, sar_touch_out5, touch_meas_out9, sar_touch_thres5, touch_out_th9)
|
(9, 32, sar_touch_out5, touch_meas_out9, sar_touch_thres5, touch_out_th9)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InterruptStatusRegisterAccess for InterruptStatusRegisterAccessBank0 {
|
impl InterruptStatusRegisterAccess for InterruptStatusRegisterAccessBank0 {
|
||||||
|
|||||||
@ -405,28 +405,28 @@ crate::gpio::gpio! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
crate::gpio::analog! {
|
crate::gpio::analog! {
|
||||||
( 0, 0, touch_pad(0), mux_sel, fun_sel, fun_ie, rue, rde)
|
( 0, 0, touch_pad(0), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
( 1, 1, touch_pad(1), mux_sel, fun_sel, fun_ie, rue, rde)
|
( 1, 1, touch_pad(1), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
( 2, 2, touch_pad(2), mux_sel, fun_sel, fun_ie, rue, rde)
|
( 2, 2, touch_pad(2), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
( 3, 3, touch_pad(3), mux_sel, fun_sel, fun_ie, rue, rde)
|
( 3, 3, touch_pad(3), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
( 4, 4, touch_pad(4), mux_sel, fun_sel, fun_ie, rue, rde)
|
( 4, 4, touch_pad(4), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
( 5, 5, touch_pad(5), mux_sel, fun_sel, fun_ie, rue, rde)
|
( 5, 5, touch_pad(5), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
( 6, 6, touch_pad(6), mux_sel, fun_sel, fun_ie, rue, rde)
|
( 6, 6, touch_pad(6), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
( 7, 7, touch_pad(7), mux_sel, fun_sel, fun_ie, rue, rde)
|
( 7, 7, touch_pad(7), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
( 8, 8, touch_pad(8), mux_sel, fun_sel, fun_ie, rue, rde)
|
( 8, 8, touch_pad(8), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
( 9, 9, touch_pad(9), mux_sel, fun_sel, fun_ie, rue, rde)
|
( 9, 9, touch_pad(9), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
(10, 10, touch_pad(10), mux_sel, fun_sel, fun_ie, rue, rde)
|
(10, 10, touch_pad(10), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
(11, 11, touch_pad(11), mux_sel, fun_sel, fun_ie, rue, rde)
|
(11, 11, touch_pad(11), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
(12, 12, touch_pad(12), mux_sel, fun_sel, fun_ie, rue, rde)
|
(12, 12, touch_pad(12), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
(13, 13, touch_pad(13), mux_sel, fun_sel, fun_ie, rue, rde)
|
(13, 13, touch_pad(13), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
(14, 14, touch_pad(14), mux_sel, fun_sel, fun_ie, rue, rde)
|
(14, 14, touch_pad(14), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
(15, 15, xtal_32p_pad(), x32p_mux_sel, x32p_fun_sel, x32p_fun_ie, x32p_rue, x32p_rde)
|
(15, 15, xtal_32p_pad(), x32p_mux_sel, x32p_fun_sel, x32p_fun_ie, x32p_rue, x32p_rde)
|
||||||
(16, 16, xtal_32n_pad(), x32n_mux_sel, x32n_fun_sel, x32n_fun_ie, x32n_rue, x32n_rde)
|
(16, 16, xtal_32n_pad(), x32n_mux_sel, x32n_fun_sel, x32n_fun_ie, x32n_rue, x32n_rde)
|
||||||
(17, 17, pad_dac1(), pdac1_mux_sel,pdac1_fun_sel,pdac1_fun_ie, pdac1_rue, pdac1_rde)
|
(17, 17, pad_dac1(), pdac1_mux_sel,pdac1_fun_sel,pdac1_fun_ie, pdac1_rue, pdac1_rde)
|
||||||
(18, 18, pad_dac2(), pdac2_mux_sel,pdac2_fun_sel,pdac2_fun_ie, pdac2_rue, pdac2_rde)
|
(18, 18, pad_dac2(), pdac2_mux_sel,pdac2_fun_sel,pdac2_fun_ie, pdac2_rue, pdac2_rde)
|
||||||
(19, 19, rtc_pad19(), mux_sel, fun_sel, fun_ie, rue, rde)
|
(19, 19, rtc_pad19(), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
(20, 20, rtc_pad20(), mux_sel, fun_sel, fun_ie, rue, rde)
|
(20, 20, rtc_pad20(), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
(21, 21, rtc_pad21(), mux_sel, fun_sel, fun_ie, rue, rde)
|
(21, 21, rtc_pad21(), mux_sel, fun_sel, fun_ie, rue, rde)
|
||||||
}
|
}
|
||||||
|
|
||||||
crate::gpio::rtc_pins! {
|
crate::gpio::rtc_pins! {
|
||||||
|
|||||||
@ -542,7 +542,7 @@ where
|
|||||||
/// Sets the specified pin to input and connects it to the SPI MISO signal.
|
/// Sets the specified pin to input and connects it to the SPI MISO signal.
|
||||||
pub fn with_miso<MISO: InputPin>(self, miso: impl Peripheral<P = MISO> + 'd) -> Self {
|
pub fn with_miso<MISO: InputPin>(self, miso: impl Peripheral<P = MISO> + 'd) -> Self {
|
||||||
crate::into_ref!(miso);
|
crate::into_ref!(miso);
|
||||||
miso.set_to_input(private::Internal);
|
miso.init_input(false, false, private::Internal);
|
||||||
miso.connect_input_to_peripheral(self.spi.miso_signal(), private::Internal);
|
miso.connect_input_to_peripheral(self.spi.miso_signal(), private::Internal);
|
||||||
|
|
||||||
self
|
self
|
||||||
@ -593,7 +593,7 @@ where
|
|||||||
|
|
||||||
if let Some(miso) = miso {
|
if let Some(miso) = miso {
|
||||||
crate::into_ref!(miso);
|
crate::into_ref!(miso);
|
||||||
miso.set_to_input(private::Internal);
|
miso.init_input(false, false, private::Internal);
|
||||||
miso.connect_input_to_peripheral(self.spi.miso_signal(), private::Internal);
|
miso.connect_input_to_peripheral(self.spi.miso_signal(), private::Internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -115,16 +115,16 @@ where
|
|||||||
mode: SpiMode,
|
mode: SpiMode,
|
||||||
) -> Spi<'d, T, FullDuplexMode> {
|
) -> Spi<'d, T, FullDuplexMode> {
|
||||||
crate::into_ref!(spi, sck, mosi, miso, cs);
|
crate::into_ref!(spi, sck, mosi, miso, cs);
|
||||||
sck.set_to_input(private::Internal);
|
sck.init_input(false, false, private::Internal);
|
||||||
sck.connect_input_to_peripheral(spi.sclk_signal(), private::Internal);
|
sck.connect_input_to_peripheral(spi.sclk_signal(), private::Internal);
|
||||||
|
|
||||||
mosi.set_to_input(private::Internal);
|
mosi.init_input(false, false, private::Internal);
|
||||||
mosi.connect_input_to_peripheral(spi.mosi_signal(), private::Internal);
|
mosi.connect_input_to_peripheral(spi.mosi_signal(), private::Internal);
|
||||||
|
|
||||||
miso.set_to_push_pull_output(private::Internal);
|
miso.set_to_push_pull_output(private::Internal);
|
||||||
miso.connect_peripheral_to_output(spi.miso_signal(), private::Internal);
|
miso.connect_peripheral_to_output(spi.miso_signal(), private::Internal);
|
||||||
|
|
||||||
cs.set_to_input(private::Internal);
|
cs.init_input(false, false, private::Internal);
|
||||||
cs.connect_input_to_peripheral(spi.cs_signal(), private::Internal);
|
cs.connect_input_to_peripheral(spi.cs_signal(), private::Internal);
|
||||||
|
|
||||||
Self::new_internal(spi, mode)
|
Self::new_internal(spi, mode)
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
//! # use esp_hal::gpio::Io;
|
//! # use esp_hal::gpio::Io;
|
||||||
//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
//! let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
//! let touch_pin0 = io.pins.gpio2;
|
//! let touch_pin0 = io.pins.gpio2;
|
||||||
//! let touch = Touch::continous_mode(peripherals.TOUCH, None);
|
//! let touch = Touch::continuous_mode(peripherals.TOUCH, None);
|
||||||
//! let mut touchpad = TouchPad::new(touch_pin0, &touch);
|
//! let mut touchpad = TouchPad::new(touch_pin0, &touch);
|
||||||
//! // ... give the peripheral some time for the measurement
|
//! // ... give the peripheral some time for the measurement
|
||||||
//! let touch_val = touchpad.read();
|
//! let touch_val = touchpad.read();
|
||||||
@ -50,16 +50,16 @@ pub trait TouchMode: Sealed {}
|
|||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct OneShot;
|
pub struct OneShot;
|
||||||
|
|
||||||
/// Marker struct for the touch peripherals continous reading mode. In the
|
/// Marker struct for the touch peripherals continuous reading mode. In the
|
||||||
/// technical reference manual, this is referred to as "start FSM via timer".
|
/// technical reference manual, this is referred to as "start FSM via timer".
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub struct Continous;
|
pub struct Continuous;
|
||||||
|
|
||||||
impl TouchMode for OneShot {}
|
impl TouchMode for OneShot {}
|
||||||
impl TouchMode for Continous {}
|
impl TouchMode for Continuous {}
|
||||||
impl Sealed for OneShot {}
|
impl Sealed for OneShot {}
|
||||||
impl Sealed for Continous {}
|
impl Sealed for Continuous {}
|
||||||
|
|
||||||
/// Touchpad threshold type.
|
/// Touchpad threshold type.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
@ -81,7 +81,7 @@ pub struct TouchConfig {
|
|||||||
/// Duration of a single measurement (in cycles of the 8 MHz touch clock).
|
/// Duration of a single measurement (in cycles of the 8 MHz touch clock).
|
||||||
/// Defaults to `0x7fff`
|
/// Defaults to `0x7fff`
|
||||||
pub measurement_duration: Option<u16>,
|
pub measurement_duration: Option<u16>,
|
||||||
/// Sleep cycles for the touch timer in [`Continous`]-mode. Defaults to
|
/// Sleep cycles for the touch timer in [`Continuous`]-mode. Defaults to
|
||||||
/// `0x100`
|
/// `0x100`
|
||||||
pub sleep_cycles: Option<u16>,
|
pub sleep_cycles: Option<u16>,
|
||||||
}
|
}
|
||||||
@ -147,8 +147,8 @@ impl<'d, TOUCHMODE: TouchMode, MODE: Mode> Touch<'d, TOUCHMODE, MODE> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Common parts of the continous mode initialization.
|
/// Common parts of the continuous mode initialization.
|
||||||
fn initialize_common_continoous(config: Option<TouchConfig>) {
|
fn initialize_common_continuous(config: Option<TouchConfig>) {
|
||||||
let rtccntl = unsafe { &*RTC_CNTL::ptr() };
|
let rtccntl = unsafe { &*RTC_CNTL::ptr() };
|
||||||
let sens = unsafe { &*SENS::ptr() };
|
let sens = unsafe { &*SENS::ptr() };
|
||||||
|
|
||||||
@ -241,8 +241,8 @@ impl<'d> Touch<'d, OneShot, Blocking> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<'d> Touch<'d, Continous, Blocking> {
|
impl<'d> Touch<'d, Continuous, Blocking> {
|
||||||
/// Initializes the touch peripheral in continous mode and returns this
|
/// Initializes the touch peripheral in continuous mode and returns this
|
||||||
/// marker struct. Optionally accepts configuration options.
|
/// marker struct. Optionally accepts configuration options.
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
@ -254,16 +254,16 @@ impl<'d> Touch<'d, Continous, Blocking> {
|
|||||||
/// measurement_duration: Some(0x3000),
|
/// measurement_duration: Some(0x3000),
|
||||||
/// ..Default::default()
|
/// ..Default::default()
|
||||||
/// });
|
/// });
|
||||||
/// let touch = Touch::continous_mode(peripherals.TOUCH, touch_cfg);
|
/// let touch = Touch::continuous_mode(peripherals.TOUCH, touch_cfg);
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn continous_mode(
|
pub fn continuous_mode(
|
||||||
touch_peripheral: impl Peripheral<P = TOUCH> + 'd,
|
touch_peripheral: impl Peripheral<P = TOUCH> + 'd,
|
||||||
config: Option<TouchConfig>,
|
config: Option<TouchConfig>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
crate::into_ref!(touch_peripheral);
|
crate::into_ref!(touch_peripheral);
|
||||||
|
|
||||||
Self::initialize_common_continoous(config);
|
Self::initialize_common_continuous(config);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
_inner: touch_peripheral,
|
_inner: touch_peripheral,
|
||||||
@ -272,8 +272,8 @@ impl<'d> Touch<'d, Continous, Blocking> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl<'d> Touch<'d, Continous, Async> {
|
impl<'d> Touch<'d, Continuous, Async> {
|
||||||
/// Initializes the touch peripheral in continous async mode and returns
|
/// Initializes the touch peripheral in continuous async mode and returns
|
||||||
/// this marker struct.
|
/// this marker struct.
|
||||||
///
|
///
|
||||||
/// ## Warning:
|
/// ## Warning:
|
||||||
@ -307,7 +307,7 @@ impl<'d> Touch<'d, Continous, Async> {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
crate::into_ref!(touch_peripheral);
|
crate::into_ref!(touch_peripheral);
|
||||||
|
|
||||||
Self::initialize_common_continoous(config);
|
Self::initialize_common_continuous(config);
|
||||||
|
|
||||||
rtc.set_interrupt_handler(asynch::handle_touch_interrupt);
|
rtc.set_interrupt_handler(asynch::handle_touch_interrupt);
|
||||||
|
|
||||||
|
|||||||
@ -741,7 +741,7 @@ where
|
|||||||
}
|
}
|
||||||
tx_pin.set_to_push_pull_output(crate::private::Internal);
|
tx_pin.set_to_push_pull_output(crate::private::Internal);
|
||||||
tx_pin.connect_peripheral_to_output(T::OUTPUT_SIGNAL, crate::private::Internal);
|
tx_pin.connect_peripheral_to_output(T::OUTPUT_SIGNAL, crate::private::Internal);
|
||||||
rx_pin.set_to_input(crate::private::Internal);
|
rx_pin.init_input(false, false, crate::private::Internal);
|
||||||
rx_pin.connect_input_to_peripheral(T::INPUT_SIGNAL, crate::private::Internal);
|
rx_pin.connect_input_to_peripheral(T::INPUT_SIGNAL, crate::private::Internal);
|
||||||
|
|
||||||
// Set the operating mode based on provided option
|
// Set the operating mode based on provided option
|
||||||
|
|||||||
@ -613,7 +613,7 @@ where
|
|||||||
/// Configure CTS pin
|
/// Configure CTS pin
|
||||||
pub fn with_cts<CTS: InputPin>(self, cts: impl Peripheral<P = CTS> + 'd) -> Self {
|
pub fn with_cts<CTS: InputPin>(self, cts: impl Peripheral<P = CTS> + 'd) -> Self {
|
||||||
crate::into_ref!(cts);
|
crate::into_ref!(cts);
|
||||||
cts.set_to_input(Internal);
|
cts.init_input(false, false, Internal);
|
||||||
cts.connect_input_to_peripheral(T::cts_signal(), Internal);
|
cts.connect_input_to_peripheral(T::cts_signal(), Internal);
|
||||||
|
|
||||||
self
|
self
|
||||||
@ -791,7 +791,7 @@ where
|
|||||||
rx: impl Peripheral<P = RX> + 'd,
|
rx: impl Peripheral<P = RX> + 'd,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
crate::into_ref!(rx);
|
crate::into_ref!(rx);
|
||||||
rx.set_to_input(Internal);
|
rx.init_input(false, false, Internal);
|
||||||
rx.connect_input_to_peripheral(T::rx_signal(), Internal);
|
rx.connect_input_to_peripheral(T::rx_signal(), Internal);
|
||||||
|
|
||||||
let (uart_rx, _) = Uart::<'d, T, Blocking>::new_with_config_inner(uart, config)?.split();
|
let (uart_rx, _) = Uart::<'d, T, Blocking>::new_with_config_inner(uart, config)?.split();
|
||||||
@ -817,7 +817,7 @@ where
|
|||||||
tx.set_to_push_pull_output(Internal);
|
tx.set_to_push_pull_output(Internal);
|
||||||
tx.connect_peripheral_to_output(T::tx_signal(), Internal);
|
tx.connect_peripheral_to_output(T::tx_signal(), Internal);
|
||||||
|
|
||||||
rx.set_to_input(Internal);
|
rx.init_input(false, false, Internal);
|
||||||
rx.connect_input_to_peripheral(T::rx_signal(), Internal);
|
rx.connect_input_to_peripheral(T::rx_signal(), Internal);
|
||||||
Self::new_with_config_inner(uart, config)
|
Self::new_with_config_inner(uart, config)
|
||||||
}
|
}
|
||||||
@ -833,7 +833,7 @@ where
|
|||||||
tx.set_to_push_pull_output(Internal);
|
tx.set_to_push_pull_output(Internal);
|
||||||
tx.connect_peripheral_to_output(T::tx_signal(), Internal);
|
tx.connect_peripheral_to_output(T::tx_signal(), Internal);
|
||||||
|
|
||||||
rx.set_to_input(Internal);
|
rx.init_input(false, false, Internal);
|
||||||
rx.connect_input_to_peripheral(T::rx_signal(), Internal);
|
rx.connect_input_to_peripheral(T::rx_signal(), Internal);
|
||||||
Self::new_inner(uart)
|
Self::new_inner(uart)
|
||||||
}
|
}
|
||||||
@ -848,7 +848,7 @@ where
|
|||||||
tx.set_to_push_pull_output(Internal);
|
tx.set_to_push_pull_output(Internal);
|
||||||
tx.connect_peripheral_to_output(T::tx_signal(), Internal);
|
tx.connect_peripheral_to_output(T::tx_signal(), Internal);
|
||||||
|
|
||||||
rx.set_to_input(Internal);
|
rx.init_input(false, false, Internal);
|
||||||
rx.connect_input_to_peripheral(T::rx_signal(), Internal);
|
rx.connect_input_to_peripheral(T::rx_signal(), Internal);
|
||||||
Self::new_inner(uart)
|
Self::new_inner(uart)
|
||||||
}
|
}
|
||||||
@ -916,7 +916,7 @@ where
|
|||||||
/// Configure CTS pin
|
/// Configure CTS pin
|
||||||
pub fn with_cts<CTS: InputPin>(self, cts: impl Peripheral<P = CTS> + 'd) -> Self {
|
pub fn with_cts<CTS: InputPin>(self, cts: impl Peripheral<P = CTS> + 'd) -> Self {
|
||||||
crate::into_ref!(cts);
|
crate::into_ref!(cts);
|
||||||
cts.set_to_input(Internal);
|
cts.init_input(false, false, Internal);
|
||||||
cts.connect_input_to_peripheral(T::cts_signal(), Internal);
|
cts.connect_input_to_peripheral(T::cts_signal(), Internal);
|
||||||
|
|
||||||
self
|
self
|
||||||
@ -2141,7 +2141,7 @@ mod asynch {
|
|||||||
tx.set_to_push_pull_output(Internal);
|
tx.set_to_push_pull_output(Internal);
|
||||||
tx.connect_peripheral_to_output(T::tx_signal(), Internal);
|
tx.connect_peripheral_to_output(T::tx_signal(), Internal);
|
||||||
|
|
||||||
rx.set_to_input(Internal);
|
rx.init_input(false, false, Internal);
|
||||||
rx.connect_input_to_peripheral(T::rx_signal(), Internal);
|
rx.connect_input_to_peripheral(T::rx_signal(), Internal);
|
||||||
let mut this = Self::new_with_config_inner(uart, config)?;
|
let mut this = Self::new_with_config_inner(uart, config)?;
|
||||||
|
|
||||||
@ -2303,7 +2303,7 @@ mod asynch {
|
|||||||
rx: impl Peripheral<P = RX> + 'd,
|
rx: impl Peripheral<P = RX> + 'd,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
crate::into_ref!(rx);
|
crate::into_ref!(rx);
|
||||||
rx.set_to_input(Internal);
|
rx.init_input(false, false, Internal);
|
||||||
rx.connect_input_to_peripheral(T::rx_signal(), Internal);
|
rx.connect_input_to_peripheral(T::rx_signal(), Internal);
|
||||||
|
|
||||||
let mut uart = Uart::<'d, T, Async>::new_with_config_inner(uart, config)?;
|
let mut uart = Uart::<'d, T, Async>::new_with_config_inner(uart, config)?;
|
||||||
|
|||||||
@ -15,6 +15,7 @@ use esp_hal::{
|
|||||||
etm::{GpioEtmChannels, GpioEtmInputConfig, GpioEtmOutputConfig},
|
etm::{GpioEtmChannels, GpioEtmInputConfig, GpioEtmOutputConfig},
|
||||||
Io,
|
Io,
|
||||||
Level,
|
Level,
|
||||||
|
Output,
|
||||||
Pull,
|
Pull,
|
||||||
},
|
},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@ -25,7 +26,7 @@ fn main() -> ! {
|
|||||||
let peripherals = esp_hal::init(esp_hal::Config::default());
|
let peripherals = esp_hal::init(esp_hal::Config::default());
|
||||||
|
|
||||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let mut led = io.pins.gpio1;
|
let mut led = Output::new(io.pins.gpio1, Level::Low);
|
||||||
let button = io.pins.gpio9;
|
let button = io.pins.gpio9;
|
||||||
|
|
||||||
led.set_high();
|
led.set_high();
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
//! This shows how to continously receive data via I2S.
|
//! This shows how to continuously receive data via I2S.
|
||||||
//!
|
//!
|
||||||
//! Without an additional I2S source device you can connect 3V3 or GND to DIN
|
//! Without an additional I2S source device you can connect 3V3 or GND to DIN
|
||||||
//! to read 0 or 0xFF or connect DIN to WS to read two different values.
|
//! to read 0 or 0xFF or connect DIN to WS to read two different values.
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
use esp_backtrace as _;
|
use esp_backtrace as _;
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::Io,
|
gpio::{Io, Level, Output},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
rmt::{PulseCode, Rmt, RxChannel, RxChannelConfig, RxChannelCreator},
|
rmt::{PulseCode, Rmt, RxChannel, RxChannelConfig, RxChannelCreator},
|
||||||
};
|
};
|
||||||
@ -27,7 +27,7 @@ fn main() -> ! {
|
|||||||
let peripherals = esp_hal::init(esp_hal::Config::default());
|
let peripherals = esp_hal::init(esp_hal::Config::default());
|
||||||
|
|
||||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let mut out = io.pins.gpio5;
|
let mut out = Output::new(io.pins.gpio5, Level::Low);
|
||||||
|
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(feature = "esp32h2")] {
|
if #[cfg(feature = "esp32h2")] {
|
||||||
|
|||||||
@ -21,12 +21,12 @@ use esp_hal::{
|
|||||||
macros::ram,
|
macros::ram,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
rtc_cntl::Rtc,
|
rtc_cntl::Rtc,
|
||||||
touch::{Continous, Touch, TouchConfig, TouchPad},
|
touch::{Continuous, Touch, TouchConfig, TouchPad},
|
||||||
Blocking,
|
Blocking,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
|
|
||||||
static TOUCH1: Mutex<RefCell<Option<TouchPad<GpioPin<4>, Continous, Blocking>>>> =
|
static TOUCH1: Mutex<RefCell<Option<TouchPad<GpioPin<4>, Continuous, Blocking>>>> =
|
||||||
Mutex::new(RefCell::new(None));
|
Mutex::new(RefCell::new(None));
|
||||||
|
|
||||||
#[handler]
|
#[handler]
|
||||||
@ -62,7 +62,7 @@ fn main() -> ! {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
|
|
||||||
let touch = Touch::continous_mode(peripherals.TOUCH, touch_cfg);
|
let touch = Touch::continuous_mode(peripherals.TOUCH, touch_cfg);
|
||||||
let mut touch0 = TouchPad::new(touch_pin0, &touch);
|
let mut touch0 = TouchPad::new(touch_pin0, &touch);
|
||||||
let mut touch1 = TouchPad::new(touch_pin1, &touch);
|
let mut touch1 = TouchPad::new(touch_pin1, &touch);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user