@@ -403,6 +403,46 @@ impl<'d, T: Instance> Dac<'d, T, Async> {
403
403
Mode :: NormalExternalBuffered ,
404
404
)
405
405
}
406
+ /// Create a new `Dac` instance with external output pins and unbuffered mode.
407
+ ///
408
+ /// This function consumes the underlying DAC peripheral and allows access to both channels.
409
+ /// The channels are configured for external output with the buffer disabled.
410
+ ///
411
+ /// The channels are enabled on creation and begin to drive their output pins.
412
+ /// Note that some methods, such as `set_trigger()` and `set_mode()`, will
413
+ /// disable the channel; you must re-enable them with `enable()`.
414
+ ///
415
+ /// By default, triggering is disabled, but it can be enabled using the `set_trigger()`
416
+ /// method on the underlying channels.
417
+ ///
418
+ /// # Arguments
419
+ ///
420
+ /// * `peri` - The DAC peripheral instance.
421
+ /// * `dma_ch1` - The DMA channel for DAC channel 1.
422
+ /// * `dma_ch2` - The DMA channel for DAC channel 2.
423
+ /// * `pin_ch1` - The GPIO pin for DAC channel 1 output.
424
+ /// * `pin_ch2` - The GPIO pin for DAC channel 2 output.
425
+ ///
426
+ /// # Returns
427
+ ///
428
+ /// A new `Dac` instance in unbuffered mode.
429
+ pub fn new_unbuffered (
430
+ peri : Peri < ' d , T > ,
431
+ dma_ch1 : Peri < ' d , impl Dma < T , Ch1 > > ,
432
+ dma_ch2 : Peri < ' d , impl Dma < T , Ch2 > > ,
433
+ pin_ch1 : Peri < ' d , impl DacPin < T , Ch1 > + crate :: gpio:: Pin > ,
434
+ pin_ch2 : Peri < ' d , impl DacPin < T , Ch2 > + crate :: gpio:: Pin > ,
435
+ ) -> Self {
436
+ pin_ch1. set_as_analog ( ) ;
437
+ pin_ch2. set_as_analog ( ) ;
438
+ Self :: new_inner (
439
+ peri,
440
+ new_dma ! ( dma_ch1) ,
441
+ new_dma ! ( dma_ch2) ,
442
+ #[ cfg( any( dac_v3, dac_v4, dac_v5, dac_v6, dac_v7) ) ]
443
+ Mode :: NormalExternalUnbuffered ,
444
+ )
445
+ }
406
446
407
447
/// Create a new `Dac` instance where the external output pins are not used,
408
448
/// so the DAC can only be used to generate internal signals but the GPIO
0 commit comments