1use capsules_extra::dac::Dac;
15use core::mem::MaybeUninit;
16use kernel::component::Component;
17use kernel::hil;
18
19#[macro_export]
20macro_rules! dac_component_static {
21 () => {{
22 kernel::static_buf!(capsules_extra::dac::Dac<'static>)
23 };};
24}
25
26pub struct DacComponent {
27 dac: &'static dyn hil::dac::DacChannel,
28}
29
30impl DacComponent {
31 pub fn new(dac: &'static dyn hil::dac::DacChannel) -> Self {
32 Self { dac }
33 }
34}
35
36impl Component for DacComponent {
37 type StaticInput = &'static mut MaybeUninit<Dac<'static>>;
38 type Output = &'static Dac<'static>;
39
40 fn finalize(self, s: Self::StaticInput) -> Self::Output {
41 s.write(Dac::new(self.dac))
42 }
43}