Trait kernel::pwm::PwmOps

source ·
pub trait PwmOps: 'static + 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.

Object Safety§

This trait is not object safe.

Implementors§