pub struct AnyMotionConfig {
pub axes: MotionAxes,
pub threshold: u16,
pub hysteresis: u16,
pub duration: u16,
pub wait_time: u8,
pub reference_update: ReferenceUpdate,
pub report_mode: EventReportMode,
pub interrupt_hold: u8,
}Expand description
Configuration for the BMI323 any-motion feature.
Fields§
§axes: MotionAxesAxis selection for detection.
threshold: u16Minimum acceleration slope for motion detection.
Unit: g
Scaling: raw / 512
Range: 0 ..= 4095, corresponding to approximately 0.0g ..= 7.998g
hysteresis: u16Hysteresis for the acceleration slope comparator.
Unit: g
Scaling: raw / 512
Range: 0 ..= 1023, corresponding to approximately 0.0g ..= 1.998g
duration: u16Minimum duration for which the slope must stay above threshold.
Unit: seconds
Scaling: raw / 50
Range: 0 ..= 8191, corresponding to approximately 0.0s ..= 163.82s
wait_time: u8Wait time before the event is cleared after the slope drops below
threshold.
Unit: seconds
Scaling: raw / 50
Range: 0 ..= 7, corresponding to 0.00s ..= 0.14s in 20ms steps
reference_update: ReferenceUpdateReference update policy.
report_mode: EventReportModeEvent reporting behavior.
interrupt_hold: u8Interrupt hold-time exponent used by the feature engine.
Effective hold time in non-latched mode:
0.625ms * 2^interrupt_hold
Valid raw range is 0 ..= 13. Larger values are clamped to 13 by the
driver before programming the register. This setting is only applicable
to non-latched feature-engine interrupts.
Implementations§
Source§impl AnyMotionConfig
impl AnyMotionConfig
Sourcepub fn threshold_from_g(g: f32) -> u16
pub fn threshold_from_g(g: f32) -> u16
Convert a physical threshold in g to the BMI323 field encoding.
Sourcepub fn threshold_to_g(raw: u16) -> f32
pub fn threshold_to_g(raw: u16) -> f32
Convert a raw threshold field value back to g.
Sourcepub fn hysteresis_from_g(g: f32) -> u16
pub fn hysteresis_from_g(g: f32) -> u16
Convert a physical hysteresis in g to the BMI323 field encoding.
Sourcepub fn hysteresis_to_g(raw: u16) -> f32
pub fn hysteresis_to_g(raw: u16) -> f32
Convert a raw hysteresis field value back to g.
Sourcepub fn duration_from_seconds(seconds: f32) -> u16
pub fn duration_from_seconds(seconds: f32) -> u16
Convert a duration in seconds to the BMI323 field encoding.
The datasheet specifies a 1/50s step size.
Sourcepub fn duration_to_seconds(raw: u16) -> f32
pub fn duration_to_seconds(raw: u16) -> f32
Convert a raw duration field value back to seconds.
Sourcepub fn wait_time_from_seconds(seconds: f32) -> u8
pub fn wait_time_from_seconds(seconds: f32) -> u8
Convert a wait time in seconds to the BMI323 field encoding.
The datasheet specifies a 1/50s step size and a 3-bit field.
Sourcepub fn wait_time_to_seconds(raw: u8) -> f32
pub fn wait_time_to_seconds(raw: u8) -> f32
Convert a raw wait-time field value back to seconds.
Sourcepub fn interrupt_hold_from_millis(millis: f32) -> u8
pub fn interrupt_hold_from_millis(millis: f32) -> u8
Convert an interrupt hold time in milliseconds to the BMI323 field encoding.
The encoded hold time is 0.625ms * 2^n. This helper returns the
smallest n that is greater than or equal to the requested duration and
saturates at 13.
Sourcepub fn interrupt_hold_to_millis(raw: u8) -> f32
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 AnyMotionConfig
impl Clone for AnyMotionConfig
Source§fn clone(&self) -> AnyMotionConfig
fn clone(&self) -> AnyMotionConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more