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