From 65028bd7f65fa8313a45d579d996826391367fde Mon Sep 17 00:00:00 2001 From: Ivan Li Date: Sun, 8 May 2022 15:53:33 +0800 Subject: [PATCH] style: clean unused code. --- src/beep.rs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/beep.rs b/src/beep.rs index dd2771b..adc3bb3 100644 --- a/src/beep.rs +++ b/src/beep.rs @@ -9,8 +9,6 @@ use std::time::Duration; type LedcChannel = Channel, P>; pub struct Beep { - state: bool, - stopped: bool, beat: u8, ringtone: ringtone::Type, channel: LedcChannel, @@ -19,8 +17,6 @@ pub struct Beep { impl Beep { pub fn new(pin: P, timer: T, channel: C) -> Result { return Ok(Beep { - state: false, - stopped: false, channel: Self::init_channel(pin, timer, channel)?, beat: 0, ringtone: ringtone::SILENCE, @@ -36,15 +32,6 @@ impl Beep { return Ok(channel); } - pub fn toggle(&mut self) -> Result<(), EspError> { - self.state = !self.state; - if self.state { - self.channel.set_duty(50) - } else { - self.channel.set_duty(0) - } - } - pub fn play(&mut self, rx: &mut std::sync::mpsc::Receiver) { loop { let curr_ringtone = rx.try_recv().unwrap_or_else(|_| self.ringtone);