1pub trait Output: private::Sealed {}
5pub enum A {}
7pub enum B {}
9
10impl Output for A {}
11impl Output for B {}
12
13mod private {
14 pub trait Sealed {}
15 impl Sealed for super::A {}
16 impl Sealed for super::B {}
17}
18
19pub trait Pin: super::Iomuxc {
21 const ALT: u32;
23 type Output: Output;
25 const DAISY: Option<super::Daisy>;
27 type Module: super::consts::Unsigned;
29 type Submodule: super::consts::Unsigned;
31}
32
33pub fn prepare<P: Pin>(pin: &mut P) {
39 super::alternate(pin, P::ALT);
40 if let Some(daisy) = P::DAISY {
41 unsafe { daisy.write() };
42 }
43}
44
45#[allow(unused)] macro_rules! pwm {
47 (module: $module:ty, submodule: $submodule:ty, alt: $alt:expr, pad: $pad:ty, output: $output:ty, daisy: $daisy:expr) => {
48 impl Pin for $pad {
49 const ALT: u32 = $alt;
50 type Output = $output;
51 const DAISY: Option<Daisy> = $daisy;
52 type Module = $module;
53 type Submodule = $submodule;
54 }
55 };
56}