embassy_stm32_plus/builder/dac/
ch1.rs1use embassy_stm32::dac::DacCh1;
2use embassy_stm32::dma::NoDma;
3use embassy_stm32::Peripheral;
4use embassy_stm32::peripherals::{DAC1, PA4};
5
6pub struct DacCh1Builder {
8 pub dac: DAC1,
10 pub ch1_pin: PA4,
12}
13
14impl DacCh1Builder {
16 #[inline]
18 pub fn new(dac: DAC1, ch1_pin: PA4) -> Self {
19 Self { dac, ch1_pin }
20 }
21
22 #[inline]
24 pub fn build<DMA>(self, dma: impl Peripheral<P=DMA> + 'static) -> DacCh1<'static, DAC1, DMA> {
25 DacCh1::new(self.dac, dma, self.ch1_pin)
26 }
27
28 #[inline]
30 pub fn build_no_dma(self) -> DacCh1<'static, DAC1> {
31 self.build(NoDma)
32 }
33}