capsules_core::virtualizers

Module virtual_pwm

Source
Expand description

Virtualize a PWM interface.

MuxPwm provides shared access to a single PWM interface for multiple users. PwmPinUser provides access to a specific PWM pin.

§Usage


let mux_pwm = static_init!(
    capsules_core::virtual_pwm::MuxPwm<'static, nrf52::pwm::Pwm>,
    capsules_core::virtual_pwm::MuxPwm::new(&base_peripherals.pwm0)
);
let virtual_pwm_buzzer = static_init!(
    capsules_core::virtual_pwm::PwmPinUser<'static, nrf52::pwm::Pwm>,
    capsules_core::virtual_pwm::PwmPinUser::new(mux_pwm, nrf5x::pinmux::Pinmux::new(31))
);
virtual_pwm_buzzer.add_to_mux();

Structs§