Skip to main content

TapConfig

Struct TapConfig 

Source
pub struct TapConfig {
Show 15 fields pub axis: TapAxis, pub reporting_mode: TapReportingMode, pub max_peaks_for_tap: u8, pub mode: TapDetectionMode, pub single_tap_enabled: bool, pub double_tap_enabled: bool, pub triple_tap_enabled: bool, pub tap_peak_threshold: u16, pub max_gesture_duration: u8, pub max_duration_between_peaks: u8, pub tap_shock_settling_duration: u8, pub min_quiet_duration_between_taps: u8, pub quiet_time_after_gesture: u8, pub report_mode: EventReportMode, pub interrupt_hold: u8,
}
Expand description

Configuration for the BMI323 tap-detection feature.

Fields§

§axis: TapAxis

Dominant axis used for tap detection.

§reporting_mode: TapReportingMode

Whether tap gestures should be reported immediately or only after timeout-based confirmation.

§max_peaks_for_tap: u8

Maximum number of threshold crossings expected around a tap.

Range: 0 ..= 7

§mode: TapDetectionMode

Tap detection profile.

§single_tap_enabled: bool

Whether single-tap reporting is enabled.

§double_tap_enabled: bool

Whether double-tap reporting is enabled.

§triple_tap_enabled: bool

Whether triple-tap reporting is enabled.

§tap_peak_threshold: u16

Minimum peak threshold caused by the tap.

Unit: g Scaling: raw / 512 Range: 0 ..= 1023, corresponding to approximately 0.0g ..= 1.998g

§max_gesture_duration: u8

Maximum duration from the first tap until the second and/or third tap is expected.

Unit: seconds Scaling: raw / 25 Range: 0 ..= 63, corresponding to approximately 0.0s ..= 2.52s

§max_duration_between_peaks: u8

Maximum duration between positive and negative peaks belonging to a tap.

Unit: seconds Scaling: raw / 200 Range: 0 ..= 15, corresponding to approximately 0.0s ..= 0.075s

§tap_shock_settling_duration: u8

Maximum duration for which the tap impact is observed.

Unit: seconds Scaling: raw / 200 Range: 0 ..= 15, corresponding to approximately 0.0s ..= 0.075s

§min_quiet_duration_between_taps: u8

Minimum quiet duration between consecutive tap impacts.

Unit: seconds Scaling: raw / 200 Range: 0 ..= 15, corresponding to approximately 0.0s ..= 0.075s

§quiet_time_after_gesture: u8

Minimum quiet duration between two gestures.

Unit: seconds Scaling: raw / 25 Range: 0 ..= 15, corresponding to approximately 0.0s ..= 0.6s

§report_mode: EventReportMode

Event reporting behavior shared across feature-engine interrupts.

§interrupt_hold: u8

Shared feature-engine interrupt hold-time exponent.

Note: the BMI323 datasheet warns that tap detection must not use the 5ms hold-time setting unless Bosch’s enhanced flexibility configuration has been applied externally.

Implementations§

Source§

impl TapConfig

Source

pub fn tap_peak_threshold_from_g(g: f32) -> u16

Convert a tap threshold in g to the BMI323 field encoding.

Source

pub fn tap_peak_threshold_to_g(raw: u16) -> f32

Convert a raw tap-threshold field value back to g.

Source

pub fn max_gesture_duration_from_seconds(seconds: f32) -> u8

Convert a gesture duration in seconds to the BMI323 field encoding.

Source

pub fn max_gesture_duration_to_seconds(raw: u8) -> f32

Convert a raw gesture-duration field value back to seconds.

Source

pub fn short_duration_from_seconds(seconds: f32) -> u8

Convert a short tap timing parameter in seconds to the BMI323 field encoding used by max_duration_between_peaks, tap_shock_settling_duration, and min_quiet_duration_between_taps.

Source

pub fn short_duration_to_seconds(raw: u8) -> f32

Convert a raw short-duration field value back to seconds.

Source

pub fn quiet_time_after_gesture_from_seconds(seconds: f32) -> u8

Convert a post-gesture quiet time in seconds to the BMI323 field encoding.

Source

pub fn quiet_time_after_gesture_to_seconds(raw: u8) -> f32

Convert a raw post-gesture quiet-time field value back to seconds.

Source

pub fn interrupt_hold_from_millis(millis: f32) -> u8

Convert an interrupt hold time in milliseconds to the BMI323 field encoding.

Source

pub fn interrupt_hold_to_millis(raw: u8) -> f32

Convert a raw interrupt-hold field value back to milliseconds.

Trait Implementations§

Source§

impl Clone for TapConfig

Source§

fn clone(&self) -> TapConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TapConfig

Source§

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

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

impl Format for TapConfig

Source§

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

Writes the defmt representation of self to fmt.
Source§

impl PartialEq for TapConfig

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for TapConfig

Source§

impl Eq for TapConfig

Source§

impl StructuralPartialEq for TapConfig

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.