Skip to main content

StepCounterConfig

Struct StepCounterConfig 

Source
pub struct StepCounterConfig {
    pub watermark_level: u16,
    pub reset_counter: bool,
}
Expand description

Configuration for the BMI323 feature-engine step counter block (§6.2.2, Register (0x10) sc_1; §5.8.5).

The counter itself accumulates the total detected step count inside the sensor. This configuration controls two separate behaviors:

  • watermark_level: generates a step-counter interrupt whenever the number of newly counted steps since the last step-counter event reaches the programmed value
  • reset_counter: requests a reset of the accumulated internal step count

A watermark_level of 0 disables the step-counter interrupt source.

Fields§

§watermark_level: u16

Step-counter interrupt watermark.

Unit: steps Scaling: 1 LSB = 1 step event increment Range: 0 ..= 1023

When this is nonzero, the BMI323 raises the StepCounter interrupt each time this many additional steps have been accumulated since the last step-counter event. A value of 0 disables the step-counter interrupt.

§reset_counter: bool

Reset request for the accumulated step count.

When set to true, the driver writes the feature-engine reset bit for the step counter. This is useful when re-arming an application that wants a fresh accumulated count after initialization or after reading a previous session’s result.

Implementations§

Source§

impl StepCounterConfig

Source

pub const fn disabled() -> Self

Create a configuration with the step-counter interrupt disabled.

Source

pub const fn with_watermark(steps: u16) -> Self

Create a configuration that raises an interrupt every steps steps.

Values above 1023 are saturated to the BMI323 register field width.

Source

pub const fn to_word(self) -> u16

Encode the configuration into the BMI323 sc_1 feature word.

Trait Implementations§

Source§

impl Clone for StepCounterConfig

Source§

fn clone(&self) -> StepCounterConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for StepCounterConfig

Source§

impl Debug for StepCounterConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StepCounterConfig

Source§

fn default() -> Self

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

impl Eq for StepCounterConfig

Source§

impl Format for StepCounterConfig

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl PartialEq for StepCounterConfig

Source§

fn eq(&self, other: &StepCounterConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for StepCounterConfig

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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>,

Source§

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>,

Source§

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.