Skip to main content

PwmOps

Trait PwmOps 

Source
pub trait PwmOps:
    'static
    + Send
    + Sync
    + Sized {
    type WfHw: Copy + Default;

    // Provided methods
    fn request(
        _chip: &Chip<Self>,
        _pwm: &Device,
        _parent_dev: &Device<Bound>,
    ) -> Result { ... }
    fn capture(
        _chip: &Chip<Self>,
        _pwm: &Device,
        _result: &mut pwm_capture,
        _timeout: usize,
        _parent_dev: &Device<Bound>,
    ) -> Result { ... }
    fn round_waveform_tohw(
        _chip: &Chip<Self>,
        _pwm: &Device,
        _wf: &Waveform,
    ) -> Result<RoundedWaveform<Self::WfHw>> { ... }
    fn round_waveform_fromhw(
        _chip: &Chip<Self>,
        _pwm: &Device,
        _wfhw: &Self::WfHw,
        _wf: &mut Waveform,
    ) -> Result { ... }
    fn read_waveform(
        _chip: &Chip<Self>,
        _pwm: &Device,
        _parent_dev: &Device<Bound>,
    ) -> Result<Self::WfHw> { ... }
    fn write_waveform(
        _chip: &Chip<Self>,
        _pwm: &Device,
        _wfhw: &Self::WfHw,
        _parent_dev: &Device<Bound>,
    ) -> Result { ... }
}
Expand description

Trait defining the operations for a PWM driver.

Required Associated Types§

Source

type WfHw: Copy + Default

The driver-specific hardware representation of a waveform.

This type must be Copy, Default, and fit within PWM_WFHWSIZE.

Provided Methods§

Source

fn request( _chip: &Chip<Self>, _pwm: &Device, _parent_dev: &Device<Bound>, ) -> Result

Optional hook for when a PWM device is requested.

Source

fn capture( _chip: &Chip<Self>, _pwm: &Device, _result: &mut pwm_capture, _timeout: usize, _parent_dev: &Device<Bound>, ) -> Result

Optional hook for capturing a PWM signal.

Source

fn round_waveform_tohw( _chip: &Chip<Self>, _pwm: &Device, _wf: &Waveform, ) -> Result<RoundedWaveform<Self::WfHw>>

Convert a generic waveform to the hardware-specific representation. This is typically a pure calculation and does not perform I/O.

Source

fn round_waveform_fromhw( _chip: &Chip<Self>, _pwm: &Device, _wfhw: &Self::WfHw, _wf: &mut Waveform, ) -> Result

Convert a hardware-specific representation back to a generic waveform. This is typically a pure calculation and does not perform I/O.

Source

fn read_waveform( _chip: &Chip<Self>, _pwm: &Device, _parent_dev: &Device<Bound>, ) -> Result<Self::WfHw>

Read the current hardware configuration into the hardware-specific representation.

Source

fn write_waveform( _chip: &Chip<Self>, _pwm: &Device, _wfhw: &Self::WfHw, _parent_dev: &Device<Bound>, ) -> Result

Write a hardware-specific waveform configuration to the hardware.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§