|
43 | 43 | //! If you need a more temporary mode change, and can not use the `into_<mode>` functions for
|
44 | 44 | //! ownership reasons, you can use the closure based `with_<mode>` functions to temporarily change the pin type, do
|
45 | 45 | //! some output or input, and then have it change back once done.
|
| 46 | +//! |
| 47 | +//! ### Dynamic Mode Change |
| 48 | +//! The above mode change methods guarantee that you can only call input functions when the pin is |
| 49 | +//! in input mode, and output when in output modes, but can lead to some issues. Therefore, there |
| 50 | +//! is also a mode where the state is kept track of at runtime, allowing you to change the mode |
| 51 | +//! often, and without problems with ownership, or references, at the cost of some performance and |
| 52 | +//! the risk of runtime errors. |
| 53 | +//! |
| 54 | +//! To make a pin dynamic, use the `into_dynamic` function, and then use the `make_<mode>` functions to |
| 55 | +//! change the mode |
46 | 56 |
|
| 57 | +mod convert; |
| 58 | +mod dynamic; |
47 | 59 | mod erased;
|
48 | 60 | mod exti;
|
49 | 61 | mod gpio_def;
|
50 | 62 | mod partially_erased;
|
51 | 63 |
|
52 | 64 | use core::{fmt, marker::PhantomData};
|
53 | 65 |
|
54 |
| -pub use embedded_hal::digital::PinState; |
55 |
| - |
56 | 66 | use crate::rcc::ResetEnable;
|
57 | 67 |
|
| 68 | +pub use convert::PinMode; |
| 69 | +pub use dynamic::{Dynamic, DynamicPin}; |
| 70 | +pub use embedded_hal::digital::PinState; |
| 71 | + |
58 | 72 | pub use erased::{EPin, ErasedPin};
|
59 | 73 | pub use exti::ExtiPin;
|
60 | 74 | pub use gpio_def::*;
|
@@ -166,10 +180,8 @@ mod marker {
|
166 | 180 | /// Marker trait for active pin modes
|
167 | 181 | pub trait Active {}
|
168 | 182 | /// Marker trait for all pin modes except alternate
|
169 |
| - #[allow(dead_code)] // TODO: Remove when alternate function conversion is implemented |
170 | 183 | pub trait NotAlt {}
|
171 | 184 | /// Marker trait for pins with alternate function `A` mapping
|
172 |
| - #[allow(dead_code)] // TODO: Remove when alternate function conversion is implemented |
173 | 185 | pub trait IntoAf<const A: u8> {}
|
174 | 186 | }
|
175 | 187 |
|
|
0 commit comments