21 lines
518 B
Rust
21 lines
518 B
Rust
|
|
use std::sync::{mpsc, Arc, Mutex};
|
||
|
|
|
||
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||
|
|
pub struct PinConfiguration {
|
||
|
|
pub id: usize,
|
||
|
|
pub gpio: usize,
|
||
|
|
}
|
||
|
|
#[derive(Debug)]
|
||
|
|
pub struct PulseInfo {
|
||
|
|
pub timestamp_ns: u64,
|
||
|
|
pub pin_id: usize,
|
||
|
|
pub level: bool,
|
||
|
|
}
|
||
|
|
|
||
|
|
pub trait InputPinManager {
|
||
|
|
fn set_input_config(&mut self, input_pins: Vec<PinConfiguration>);
|
||
|
|
fn get_channel_recv(&self) -> &Arc<Mutex<mpsc::Receiver<PulseInfo>>>;
|
||
|
|
fn get_pins(&self) -> &Vec<PinConfiguration>;
|
||
|
|
fn close_inputs(&mut self);
|
||
|
|
}
|