Struct capsules_extra::buzzer_pwm::PwmBuzzer

source ·
pub struct PwmBuzzer<'a, A: Alarm<'a>, P: PwmPin> { /* private fields */ }

Implementations§

source§

impl<'a, A: Alarm<'a>, P: PwmPin> PwmBuzzer<'a, A, P>

source

pub fn new( pwm_pin: &'a P, alarm: &'a A, max_duration_ms: usize, ) -> PwmBuzzer<'a, A, P>

Trait Implementations§

source§

impl<'a, A: Alarm<'a>, P: PwmPin> AlarmClient for PwmBuzzer<'a, A, P>

source§

fn alarm(&self)

Callback indicating the alarm time has been reached. The alarm MUST be disabled when this is called. If a new alarm is needed, the client can call Alarm::set_alarm.
source§

impl<'a, A: Alarm<'a>, P: PwmPin> Buzzer<'a> for PwmBuzzer<'a, A, P>

source§

fn set_client(&self, client: &'a dyn BuzzerClient)

Set the client to be used for callbacks of the Buzzer implementation.
source§

fn buzz(&self, frequency_hz: usize, duration_ms: usize) -> Result<(), ErrorCode>

Play a sound at a chosen frequency and for a chosen duration. Once the buzzer finishes buzzing, the buzzer_done() callback is called. If it is called while the buzzer is playing, the buzzer command will be overridden with the new frequency and duration values. Read more
source§

fn stop(&self) -> Result<(), ErrorCode>

Stop the sound currently playing. After the buzzer is successfully stopped, the buzzer_done() callback is called. Read more

Auto Trait Implementations§

§

impl<'a, A, P> !Freeze for PwmBuzzer<'a, A, P>

§

impl<'a, A, P> !RefUnwindSafe for PwmBuzzer<'a, A, P>

§

impl<'a, A, P> !Send for PwmBuzzer<'a, A, P>

§

impl<'a, A, P> !Sync for PwmBuzzer<'a, A, P>

§

impl<'a, A, P> Unpin for PwmBuzzer<'a, A, P>

§

impl<'a, A, P> !UnwindSafe for PwmBuzzer<'a, A, P>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.