pub struct FlatConfig {
pub theta: u8,
pub blocking: FeatureBlockingMode,
pub hold_time: u8,
pub slope_threshold: u8,
pub hysteresis: u8,
pub report_mode: EventReportMode,
pub interrupt_hold: u8,
}Expand description
Configuration for the BMI323 flat-detection feature.
Fields§
§theta: u8Maximum allowed tilt angle for the device to be considered flat.
Unit: degrees
Encoding: nonlinear
Field width: 6 bits
Valid raw range: 0 ..= 63
The datasheet interpretation is (tan(theta)^2) * 64.
blocking: FeatureBlockingModeBlocking behavior to suppress flat-state changes during large movement.
hold_time: u8Minimum time the device must remain flat before the event is asserted.
Unit: seconds
Scaling: raw / 50
Range: 0 ..= 255, corresponding to approximately 0.0s ..= 5.10s
slope_threshold: u8Minimum acceleration slope that blocks flat-status changes during large movement.
Unit: g
Scaling: raw / 512
Range: 0 ..= 255, corresponding to approximately 0.0g ..= 0.498g
hysteresis: u8Angular hysteresis for flat detection.
Unit: degrees Encoding: nonlinear Field width: 8 bits
The datasheet expresses this field relative to the configured
theta. The raw value can be programmed directly when precise control
is needed.
report_mode: EventReportModeEvent reporting behavior shared across feature-engine interrupts.
interrupt_hold: u8Shared feature-engine interrupt hold-time exponent.
Effective hold time in non-latched mode:
0.625ms * 2^interrupt_hold
Implementations§
Source§impl FlatConfig
impl FlatConfig
Sourcepub fn hold_time_from_seconds(seconds: f32) -> u8
pub fn hold_time_from_seconds(seconds: f32) -> u8
Convert a hold time in seconds to the BMI323 field encoding.
Sourcepub fn hold_time_to_seconds(raw: u8) -> f32
pub fn hold_time_to_seconds(raw: u8) -> f32
Convert a raw hold-time field value back to seconds.
Sourcepub fn slope_threshold_from_g(g: f32) -> u8
pub fn slope_threshold_from_g(g: f32) -> u8
Convert a slope threshold in g to the BMI323 field encoding.
Sourcepub fn slope_threshold_to_g(raw: u8) -> f32
pub fn slope_threshold_to_g(raw: u8) -> f32
Convert a raw slope-threshold field value back to g.
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.
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 FlatConfig
impl Clone for FlatConfig
Source§fn clone(&self) -> FlatConfig
fn clone(&self) -> FlatConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more