autd3_core/common/
mod.rs

1mod angle;
2mod freq;
3
4use core::time::Duration;
5
6pub use core::f32::consts::PI;
7
8#[cfg(feature = "use_meter")]
9mod unit {
10    /// meter
11    pub const METER: f32 = 1.0;
12}
13#[cfg(not(feature = "use_meter"))]
14mod unit {
15    /// meter
16    pub const METER: f32 = 1000.0;
17}
18pub use unit::*;
19
20pub use angle::*;
21pub use freq::*;
22
23/// millimeter
24pub const MILLIMETER: f32 = METER / 1000.0;
25
26/// The absolute threshold of hearing in \[㎩\]
27pub const ABSOLUTE_THRESHOLD_OF_HEARING: f32 = 20e-6;
28
29/// The amplitude of T4010A1 in \[㎩*mm\]
30pub const T4010A1_AMPLITUDE: f32 = 275.574_25 * 200.0 * MILLIMETER; // [㎩*mm]
31
32/// The default timeout duration
33pub const DEFAULT_TIMEOUT: core::time::Duration = core::time::Duration::from_millis(200);
34
35/// The frequency of ultrasound
36pub const ULTRASOUND_FREQ: Freq<u32> = Freq { freq: 40000 };
37
38/// The period of ultrasound
39pub const ULTRASOUND_PERIOD: Duration = Duration::from_micros(25);
40
41#[doc(hidden)]
42pub const FOCI_STM_TR_X_MAX: i32 = 0x1AFC;
43#[doc(hidden)]
44pub const FOCI_STM_TR_Y_MAX: i32 = 0x14A3;
45
46/// The minimum buffer size of modulation.
47pub const MOD_BUF_SIZE_MIN: usize = 2;
48
49/// The minimum buffer size of STM.
50pub const STM_BUF_SIZE_MIN: usize = 2;
51
52/// The minimum number of foci per pattern in FociSTM.
53pub const FOCI_STM_FOCI_NUM_MIN: usize = 1;
54
55#[doc(hidden)]
56pub const SILENCER_STEPS_INTENSITY_DEFAULT: u16 = 10;
57#[doc(hidden)]
58pub const SILENCER_STEPS_PHASE_DEFAULT: u16 = 40;
59
60/// \[㎜\]
61#[allow(non_upper_case_globals)]
62pub const mm: f32 = MILLIMETER;