Skip to content

Commit 913ba1c

Browse files
committed
Allow inverting comparator on the fly
1 parent f51452f commit 913ba1c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/comparator.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,10 @@ macro_rules! impl_comparator {
444444
}
445445
}
446446

447+
pub fn set_inverted(&mut self, inverted: bool) {
448+
self.regs.csr().modify(|_, w| w.pol().bit(inverted));
449+
}
450+
447451
/// Enables raising the `ADC_COMP` interrupt at the specified output signal edge
448452
pub fn listen(&self, edge: SignalEdge, exti: &EXTI) {
449453
exti.listen($Event, edge);

0 commit comments

Comments
 (0)