autd3_core/gain/
drive.rs

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