From e84e47045a993b3324f9abb51e318889ef60c486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Mon, 16 Nov 2020 22:44:21 +0100 Subject: [PATCH] Allow for getting &mut for both underlying pins. In case the update() function is called by the ISR handling both pins, ISR must be able to clear the interrupt flag. --- src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 4733fd2..0259dbf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -98,6 +98,17 @@ where Ok(s.into()) } + /// Returns a reference to the first pin. Can be used to clear interrupt. + pub fn pin_a(&mut self) -> &mut A { + &mut self.pin_a + } + + /// Returns a reference to the second pin. Can be used to clear interrupt. + pub fn pin_b(&mut self) -> &mut B { + &mut self.pin_b + } + + #[cfg(feature = "table-decoder")] /// Call `update` to evaluate the next state of the encoder, propagates errors from `InputPin` read pub fn update(&mut self) -> Result> {