Skip to content

Commit

Permalink
Remove explicit stop in favour of drop
Browse files Browse the repository at this point in the history
  • Loading branch information
keirlawson committed Dec 3, 2023
1 parent 2625c01 commit 2934ed3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/touch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ where
let result = esp!(unsafe { touch_pad_read_raw_data(self.borrow().pad.into(), &mut raw) });
result.map(|_| raw)
}

pub fn stop(&mut self) -> Result<(), EspError> {
self.touch.borrow_mut().stop()
}
}

#[cfg(any(esp32, esp32s2, esp32s3))]
Expand All @@ -133,9 +129,11 @@ impl TouchDriver {

Ok(())
}
}

pub fn stop(&mut self) -> Result<(), EspError> {
esp!(unsafe { touch_pad_fsm_stop() })?;
Ok(())
#[cfg(any(esp32, esp32s2, esp32s3))]
impl Drop for TouchDriver {
fn drop(&mut self) {
unsafe { touch_pad_fsm_stop() };
}
}

0 comments on commit 2934ed3

Please sign in to comment.