Guide: Clarify that Level can be used as an output signal (#2176)
* Clarify that Level can be used as an output signal * Implement Peripheral for Level
This commit is contained in:
parent
5ae76d727e
commit
fc92beebe6
@ -172,7 +172,7 @@ configure an input pin, and pass it to `set_edge_signal` or `set_ctrl_signal`.
|
|||||||
Use `NoPin` in place of the now-removed `NO_PIN` constant.
|
Use `NoPin` in place of the now-removed `NO_PIN` constant.
|
||||||
|
|
||||||
SPI pins, when using the `with_pin` function, are no longer optional.
|
SPI pins, when using the `with_pin` function, are no longer optional.
|
||||||
You can pass `NoPin` or `Level` as inputs, and `NoPin` as output if you don't need a particular pin.
|
You can pass `NoPin` or `Level` if you don't need a particular pin.
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
let spi = Spi::new(peripherals.SPI2, 100.kHz(), SpiMode::Mode0)
|
let spi = Spi::new(peripherals.SPI2, 100.kHz(), SpiMode::Mode0)
|
||||||
|
|||||||
@ -7,6 +7,14 @@
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
impl crate::peripheral::Peripheral for Level {
|
||||||
|
type P = Self;
|
||||||
|
|
||||||
|
unsafe fn clone_unchecked(&mut self) -> Self::P {
|
||||||
|
*self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PeripheralSignal for Level {
|
impl PeripheralSignal for Level {
|
||||||
fn pull_direction(&self, _pull: Pull, _internal: private::Internal) {}
|
fn pull_direction(&self, _pull: Pull, _internal: private::Internal) {}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user