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 () => {{ kernel::static_buf!(capsules_extra::dac::Dac<'static>) }};
22}
23
24pub struct DacComponent {
25 dac: &'static dyn hil::dac::DacChannel,
26}
27
28impl DacComponent {
29 pub fn new(dac: &'static dyn hil::dac::DacChannel) -> Self {
30 Self { dac }
31 }
32}
33
34impl Component for DacComponent {
35 type StaticInput = &'static mut MaybeUninit<Dac<'static>>;
36 type Output = &'static Dac<'static>;
37
38 fn finalize(self, s: Self::StaticInput) -> Self::Output {
39 s.write(Dac::new(self.dac))
40 }
41}