We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3f61ef2 commit 99b9937Copy full SHA for 99b9937
src/digital.rs
@@ -11,13 +11,24 @@ pub trait OutputPin {
11
12
/// Output pin that can read its output state
13
#[cfg(feature = "unproven")]
14
-trait StatefulOutputPin: OutputPin {
+trait StatefulOutputPin {
15
/// Is the pin set to high?
16
fn is_set_high(&self) -> bool;
17
18
/// Is the pin set to low?
19
fn is_set_low(&self) -> bool;
20
+}
21
+
22
+/// Output pin that can be toggled
23
+#[cfg(feature = "unproven")]
24
+trait ToggleableOutputPin {
25
+ /// Toggle pin output
26
+ fn toggle(&mut self);
27
28
29
30
31
+impl<PIN: OutputPin + StatefulOutputPin> ToggleableOutputPin for PIN {
32
/// Toggle pin output
33
fn toggle(&mut self) {
34
if self.is_set_low() {
0 commit comments