Skip to content

Commit 949a90b

Browse files
committed
Comparator does not need to consume its positive input pin
1 parent 1fbe8db commit 949a90b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

examples/comp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ fn main() -> ! {
3838

3939
let pa1 = gpioa.pa1.into_analog();
4040
let pa0 = gpioa.pa0.into_analog();
41-
let comp1 = comp1.comparator(pa1, pa0, Config::default(), &rcc.clocks);
41+
let comp1 = comp1.comparator(&pa1, pa0, Config::default(), &rcc.clocks);
4242
let comp1 = comp1.enable();
4343

4444
// led1 pa1 will be updated manually when to match comp1 value
4545
let mut led1 = gpioa.pa5.into_push_pull_output();
4646

4747
let pa7 = gpioa.pa7.into_analog();
4848
let comp2 = comp2.comparator(
49-
pa7,
49+
&pa7,
5050
RefintInput::VRefintM12,
5151
Config::default()
5252
.hysteresis(Hysteresis::None)

examples/comp_w_dac.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn main() -> ! {
4444

4545
// Set up comparator with pa1 as positive, and the DAC as negative input
4646
let comp = comp1.comparator(
47-
pa1,
47+
&pa1,
4848
&dac,
4949
comparator::Config::default().hysteresis(comparator::Hysteresis::None),
5050
&rcc.clocks,

src/comparator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,13 @@ window_input_pin!(COMP2, Comp1InP);
228228

229229
macro_rules! positive_input_pin {
230230
($COMP:ident, $pin_0:ident, $pin_1:ident) => {
231-
impl PositiveInput<$COMP> for $pin_0<Analog> {
231+
impl PositiveInput<$COMP> for &$pin_0<Analog> {
232232
fn setup(&self, comp: &$COMP) {
233233
comp.csr().modify(|_, w| w.inpsel().bit(false))
234234
}
235235
}
236236

237-
impl PositiveInput<$COMP> for $pin_1<Analog> {
237+
impl PositiveInput<$COMP> for &$pin_1<Analog> {
238238
fn setup(&self, comp: &$COMP) {
239239
comp.csr().modify(|_, w| w.inpsel().bit(true))
240240
}

0 commit comments

Comments
 (0)