Skip to main content

ad_core/driver/
mod.rs

1pub mod ndarray_driver;
2pub mod ad_driver;
3
4// Re-exports for backward compatibility
5pub use ad_driver::{ADDriverBase, ADDriver};
6pub use crate::color::NDColorMode as ColorMode;
7
8/// Detector status states matching ADStatus_t.
9#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10#[repr(i32)]
11pub enum ADStatus {
12    Idle = 0,
13    Acquire = 1,
14    Readout = 2,
15    Correct = 3,
16    Saving = 4,
17    Aborting = 5,
18    Error = 6,
19    Waiting = 7,
20    Initializing = 8,
21    Disconnected = 9,
22    Aborted = 10,
23}
24
25/// Image mode.
26#[derive(Debug, Clone, Copy, PartialEq, Eq)]
27#[repr(i32)]
28pub enum ImageMode {
29    Single = 0,
30    Multiple = 1,
31    Continuous = 2,
32}
33
34impl ImageMode {
35    pub fn from_i32(v: i32) -> Self {
36        match v {
37            0 => Self::Single,
38            1 => Self::Multiple,
39            _ => Self::Continuous,
40        }
41    }
42}
43
44/// Shutter mode.
45#[derive(Debug, Clone, Copy, PartialEq, Eq)]
46#[repr(i32)]
47pub enum ShutterMode {
48    None = 0,
49    EpicsOnly = 1,
50    DetectorOnly = 2,
51    EpicsAndDetector = 3,
52}
53
54impl ShutterMode {
55    pub fn from_i32(v: i32) -> Self {
56        match v {
57            0 => Self::None,
58            1 => Self::EpicsOnly,
59            2 => Self::DetectorOnly,
60            _ => Self::EpicsAndDetector,
61        }
62    }
63}