Skip to content

Commit 7bf393c

Browse files
committed
Comparator: Fix DAC inputs
1 parent 1536a88 commit 7bf393c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/analog/dac.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ macro_rules! dac {
111111
pub fn enable(self) -> $CX<Enabled> {
112112
let dac = unsafe { &(*DAC::ptr()) };
113113

114-
dac.dac_mcr.modify(|_, w| unsafe { w.$mode().bits(0) });
114+
dac.dac_mcr.modify(|_, w| unsafe { w.$mode().bits(1) });
115115
dac.dac_cr.modify(|_, w| w.$en().set_bit());
116116

117117
$CX {
@@ -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(2) });
125+
dac.dac_mcr.modify(|_, w| unsafe { w.$mode().bits(3) });
126126
dac.dac_cr.modify(|_, w| w.$en().set_bit());
127127

128128
$CX {
@@ -133,7 +133,7 @@ macro_rules! dac {
133133
pub fn enable_generator(self, config: GeneratorConfig) -> $CX<WaveGenerator> {
134134
let dac = unsafe { &(*DAC::ptr()) };
135135

136-
dac.dac_mcr.modify(|_, w| unsafe { w.$mode().bits(0) });
136+
dac.dac_mcr.modify(|_, w| unsafe { w.$mode().bits(1) });
137137
dac.dac_cr.modify(|_, w| unsafe {
138138
w.$wave().bits(config.mode);
139139
w.$ten().set_bit();

src/comparator.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ refint_input!(COMP2);
221221

222222
macro_rules! dac_input {
223223
($COMP:ident, $channel:ty, $bits:expr) => {
224-
impl NegativeInput<$COMP> for &$channel {
224+
impl<ED> NegativeInput<$COMP> for &$channel {
225225
fn setup(&self, comp: &$COMP) {
226226
comp.csr().modify(|_, w| unsafe { w.inmsel().bits($bits) })
227227
}
@@ -230,14 +230,14 @@ macro_rules! dac_input {
230230
}
231231

232232
#[cfg(any(feature = "stm32g071", feature = "stm32g081"))]
233-
dac_input!(COMP1, dac::Channel1<dac::Enabled>, 0b0100);
233+
dac_input!(COMP1, dac::Channel1<ED>, 0b0100);
234234
#[cfg(any(feature = "stm32g071", feature = "stm32g081"))]
235-
dac_input!(COMP1, dac::Channel2<dac::Enabled>, 0b0101);
235+
dac_input!(COMP1, dac::Channel2<ED>, 0b0101);
236236

237237
#[cfg(any(feature = "stm32g071", feature = "stm32g081"))]
238-
dac_input!(COMP2, dac::Channel1<dac::Enabled>, 0b0100);
238+
dac_input!(COMP2, dac::Channel1<ED>, 0b0100);
239239
#[cfg(any(feature = "stm32g071", feature = "stm32g081"))]
240-
dac_input!(COMP2, dac::Channel2<dac::Enabled>, 0b0101);
240+
dac_input!(COMP2, dac::Channel2<ED>, 0b0101);
241241

242242
pub struct Comparator<C, ED> {
243243
regs: C,

0 commit comments

Comments
 (0)