pub struct DfsdmConfig {
    pub clock_src: DfsdmClockSrc,
    pub sampling_freq: u32,
    pub continuous: Continuous,
    pub filter_order: FilterOrder,
    pub filter_oversampling_ratio: u16,
    pub integrator_oversampling_ratio: u8,
    pub right_shift_bits: u8,
    pub offset: u32,
    pub spi_clock: SpiClock,
}
Expand description

Configuration for the DFSDM peripheral. All operations in the DFSDM peripheral are in signed format (filtering, integration, offset correction, right bit shift).

Fields§

§clock_src: DfsdmClockSrc

Set the clock source to Sysclk, or Audio clock. Audio clock appears to be the SAI clock source, at least on H7. (?) Defaults to Audio clock.

§sampling_freq: u32

Sampling frequency. Used to adjust clock divider. Defaults to 48kHz. (48_000_000)

§continuous: Continuous

Sample as one-shot, continuous, or continuous fast-mode. Defaults to continuous fast mode.

§filter_order: FilterOrder

Sinc filter order. Defaults to Sinc4.

§filter_oversampling_ratio: u16

Sinc filter oversampling ratio. Also known as decimation ratio

§integrator_oversampling_ratio: u8

Integrator oversampling ratio. Also known as averaging (?) ratio

§right_shift_bits: u8

To have the result aligned to a 24-bit value, each channel defines a number of right bit shifts which will be applied on each conversion result (injected or regular) from a given channel. The data bit shift number is stored in DTRBS[4:0] bits in DFSDM_CHyCFGR2 register. The right bit-shift is rounding the result to nearest integer value. The sign of shifted result is maintained, in order to have valid 24-bit signed format of result data.

§offset: u32

The offset correction allows to calibrate the external sigma-delta modulator offset error. The user configures the offset register with a signed 24-bit correction, and this register is automatically added to the output result. The offset correction value is usually the result of a calibration routine embedded within the microcontroller software that performs the offset calibration calculation and stores the correction into the offset register. Defaults to 0. This must be a 24 bit signed integer, which Rust doesn’t support. So, to make it negative, you might use something like this: offset:(1<<24) - 1_000;

§spi_clock: SpiClock

SPI clock select for channel y. Ie internal or external.

Trait Implementations§

source§

impl Default for DfsdmConfig

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere
U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.