autd3_core/firmware/
drive.rs

1use super::{intensity::Intensity, phase::Phase};
2
3/// A container for the phase and intensity of the ultrasound.
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5#[repr(C)]
6pub struct Drive {
7    /// The phase of the ultrasound.
8    pub phase: Phase,
9    /// The intensity of the ultrasound.
10    pub intensity: Intensity,
11}
12
13impl Drive {
14    /// A [`Drive`] with a phase of [`Phase::ZERO`] and an intensity of [`Intensity::MIN`].
15    pub const NULL: Self = Self {
16        phase: Phase::ZERO,
17        intensity: Intensity::MIN,
18    };
19}
20
21#[cfg(test)]
22mod tests {
23    use super::*;
24
25    #[test]
26    fn test_null() {
27        assert_eq!(
28            Drive {
29                phase: Phase::ZERO,
30                intensity: Intensity::MIN
31            },
32            Drive::NULL
33        );
34    }
35}