rdif_base/
lib.rs

1#![cfg_attr(not(test), no_std)]
2
3extern crate alloc;
4
5#[macro_use]
6mod _macro;
7
8pub mod io;
9pub mod lock;
10
11pub type DriverResult<T = ()> = core::result::Result<T, alloc::boxed::Box<dyn core::error::Error>>;
12
13pub trait DriverGeneric: Send {
14    fn open(&mut self) -> DriverResult;
15    fn close(&mut self) -> DriverResult;
16}
17
18custom_type!(IrqId, usize, "{:#x}");
19
20/// The trigger configuration for an interrupt.
21#[derive(Copy, Clone, Debug, Eq, PartialEq)]
22pub enum Trigger {
23    EdgeBoth,
24    EdgeRising,
25    EdgeFailling,
26    LevelHigh,
27    LevelLow,
28}
29
30#[derive(Debug, Clone)]
31pub struct IrqConfig {
32    pub irq: IrqId,
33    pub trigger: Trigger,
34}