1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
extern crate hidapi;
use error::CosmicBoxResult;
pub mod error;
pub mod hid;
pub const VENDOR_ID: u16 = 0x0fc5;
pub const PRODUCT_ID: u16 = 0xb080;
#[derive(Debug, PartialEq)]
pub struct TriggerOptions {
pub top: bool,
pub bottom: bool,
pub ext: bool,
}
pub struct CosmicBox<T> {
device: T,
}
pub struct Counters {
pub top: u16,
pub bottom: u16,
pub ext: u16,
pub coinc: u16
}
pub trait GenericCosmicBox<T> {
fn new(T) -> Self;
fn set_trigger(&self, options: &TriggerOptions) -> CosmicBoxResult<()>;
fn get_trigger(&self) -> CosmicBoxResult<TriggerOptions>;
fn reset(&self) -> CosmicBoxResult<()>;
fn set_address(&self, u8) -> CosmicBoxResult<()>;
fn get_counters(&self) -> CosmicBoxResult<Counters>;
}
#[cfg(test)]
mod tests {}