Skip to content

Commit 994cbce

Browse files
committed
Change DAC functionality in EnabledUnbuffered mode
Previously MCR.MODE[12] = 3, which corresponds to "connected to on chip peripherals with buffer disabled". In this case the DAC output is not connected to the pin, which is quite unexpected. Change to MCR.MODE[12] = 2, which corresponds to "connected to external pin with buffer disabled". This provides the expected functionality. Perhaps it would be useful to support connecting the DAC to on-chip peripherals, but that should be available separately to the choice of buffered/unbuffered.
1 parent bf4c473 commit 994cbce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/analog/dac.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ macro_rules! dac {
122122
pub fn enable_unbuffered(self) -> $CX<EnabledUnbuffered> {
123123
let dac = unsafe { &(*DAC::ptr()) };
124124

125-
dac.dac_mcr.modify(|_, w| unsafe { w.$mode().bits(3) });
125+
dac.dac_mcr.modify(|_, w| unsafe { w.$mode().bits(2) });
126126
dac.dac_cr.modify(|_, w| w.$en().set_bit());
127127

128128
$CX {

0 commit comments

Comments
 (0)