autd3capi_def/
drive.rs

1/*
2 * File: drive.rs
3 * Project: src
4 * Created Date: 22/11/2023
5 * Author: Shun Suzuki
6 * -----
7 * Last Modified: 06/12/2023
8 * Modified By: Shun Suzuki (suzuki@hapis.k.u-tokyo.ac.jp)
9 * -----
10 * Copyright (c) 2023 Shun Suzuki. All rights reserved.
11 *
12 */
13
14use autd3_driver::{common::Phase, defined::float};
15
16pub const DEFAULT_CORRECTED_ALPHA: float = 0.803;
17
18#[no_mangle]
19#[must_use]
20pub unsafe extern "C" fn AUTDEmitIntensityWithCorrectionAlpha(value: u8, alpha: float) -> u8 {
21    autd3_driver::common::EmitIntensity::with_correction_alpha(value, alpha).value()
22}
23
24#[no_mangle]
25#[must_use]
26pub unsafe extern "C" fn AUTDPhaseFromRad(value: float) -> u8 {
27    Phase::from_rad(value).value()
28}
29
30#[no_mangle]
31#[must_use]
32pub unsafe extern "C" fn AUTDPhaseToRad(value: u8) -> float {
33    Phase::new(value).radian()
34}
35
36#[derive(Debug, Clone, Copy)]
37#[repr(C)]
38pub struct Drive {
39    pub phase: u8,
40    pub intensity: u8,
41}