mpu6050_dmp/clock_source.rs
1//! MPU6050 Clock Source Configuration
2//!
3//! The MPU6050 can use different clock sources for timing:
4//! - Internal oscillator (default, less accurate)
5//! - Gyroscope reference (more stable, recommended)
6//! - External crystals (highest accuracy)
7//!
8//! The clock source affects:
9//! - Timing accuracy
10//! - Power consumption
11//! - Sensor startup time
12//! - Temperature sensitivity
13
14/// Available clock sources for the MPU6050.
15///
16/// Clock source selection considerations:
17/// - Accuracy requirements
18/// - Power consumption needs
19/// - Temperature variations
20/// - External component availability
21#[derive(Debug, Copy, Clone)]
22#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
23#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
24pub enum ClockSource {
25 /// Internal 8MHz oscillator
26 /// - Fastest startup
27 /// - Less accurate
28 /// - Higher temperature drift
29 Internal = 0,
30
31 /// X-axis gyroscope reference
32 /// - Recommended for general use
33 /// - Good stability
34 /// - Low temperature drift
35 Xgyro = 1,
36
37 /// Y-axis gyroscope reference
38 /// - Alternative to X-axis
39 /// - Similar stability to X-axis
40 Ygyro = 2,
41
42 /// Z-axis gyroscope reference
43 /// - Alternative to X/Y-axis
44 /// - Similar stability to X/Y-axis
45 Zgyro = 3,
46
47 /// External 32.768kHz crystal
48 /// - Highest accuracy
49 /// - Requires external crystal
50 /// - Common RTC frequency
51 External32768 = 4,
52
53 /// External 19.2MHz crystal
54 /// - High accuracy
55 /// - Requires external crystal
56 /// - Typical system clock frequency
57 External19200 = 5,
58
59 /// Stops the clock
60 /// - Lowest power consumption
61 /// - Sensor stops operating
62 /// - Must be restarted to resume
63 Stop = 7,
64}