esp_hal/gpio/
placeholder.rs
1use super::*;
9use crate::gpio::interconnect::connect_input_signal;
10
11impl crate::peripheral::Peripheral for Level {
12 type P = Self;
13
14 unsafe fn clone_unchecked(&self) -> Self::P {
15 *self
16 }
17}
18
19impl Level {
20 pub(crate) fn pull_direction(&self, _pull: Pull) {}
21
22 pub(crate) fn input_signals(
23 &self,
24 _: private::Internal,
25 ) -> &'static [(AlternateFunction, InputSignal)] {
26 &[]
27 }
28
29 pub(crate) fn init_input(&self, _pull: Pull) {}
30
31 pub(crate) fn enable_input(&self, _on: bool) {}
32
33 pub(crate) fn is_input_high(&self) -> bool {
34 *self == Level::High
35 }
36
37 pub(crate) fn connect_input_to_peripheral(&self, signal: InputSignal) {
38 let value = match self {
39 Level::High => ONE_INPUT,
40 Level::Low => ZERO_INPUT,
41 };
42
43 connect_input_signal(signal, value, false, true);
44 }
45
46 pub(crate) fn set_to_open_drain_output(&self) {}
47 pub(crate) fn set_to_push_pull_output(&self) {}
48 pub(crate) fn enable_output(&self, _on: bool) {}
49 pub(crate) fn set_output_high(&self, _on: bool) {}
50 pub(crate) fn set_drive_strength(&self, _strength: DriveStrength) {}
51 pub(crate) fn enable_open_drain(&self, _on: bool) {}
52
53 pub(crate) fn is_set_high(&self) -> bool {
54 false
55 }
56
57 pub(crate) fn output_signals(
58 &self,
59 _: private::Internal,
60 ) -> &'static [(AlternateFunction, OutputSignal)] {
61 &[]
62 }
63
64 pub(crate) fn connect_peripheral_to_output(&self, _signal: OutputSignal) {}
65
66 pub(crate) fn disconnect_from_peripheral_output(&self, _signal: OutputSignal) {}
67}
68
69#[derive(Default, Clone, Copy)]
73pub struct NoPin;
74
75impl crate::peripheral::Peripheral for NoPin {
76 type P = Self;
77
78 unsafe fn clone_unchecked(&self) -> Self::P {
79 Self
80 }
81}
82
83impl private::Sealed for NoPin {}
84
85impl embedded_hal::digital::ErrorType for NoPin {
86 type Error = core::convert::Infallible;
87}
88
89impl embedded_hal::digital::OutputPin for NoPin {
90 fn set_low(&mut self) -> Result<(), Self::Error> {
91 Ok(())
92 }
93
94 fn set_high(&mut self) -> Result<(), Self::Error> {
95 Ok(())
96 }
97}
98
99impl embedded_hal::digital::StatefulOutputPin for NoPin {
100 fn is_set_high(&mut self) -> Result<bool, Self::Error> {
101 Ok(false)
102 }
103
104 fn is_set_low(&mut self) -> Result<bool, Self::Error> {
105 Ok(false)
106 }
107}