1use crate::swm;
2
3use super::channel::{self, Channel};
4
5macro_rules! channels {
6 (
7 $(
8 $channel:ident:
9 $field: ident,
10 $id:expr,
11 $output:ident,
12 $state:ident;
13 )*
14 ) => {
15 #[allow(missing_docs)]
19 pub struct Channels<PeripheralState, $($state,)*> {
20 $(pub $field: Channel<$channel, PeripheralState, $state>,)*
21 }
22
23 impl<PeripheralState, $($state,)*>
24 Channels<PeripheralState, $($state,)*>
25 {
26 pub(super) fn new() -> Self {
27 Self {
28 $($field: Channel::new(),)*
29 }
30 }
31 }
32
33 $(
34 pub struct $channel;
36
37 impl channel::private::Sealed for $channel {}
38
39 impl channel::Trait for $channel {
40 const ID: u8 = $id;
41 type Output = swm::$output;
42 }
43 )*
44 };
45}
46
47channels! {
48 Channel1: channel1, 0, T0_MAT0, State1;
49 Channel2: channel2, 1, T0_MAT1, State2;
50 Channel3: channel3, 2, T0_MAT2, State3;
51}