1#![no_std]
2
3#[cfg(feature = "alloc")]
4extern crate alloc;
5
6#[macro_use]
7mod _macro;
8
9pub mod io;
10#[cfg(feature = "alloc")]
11pub mod lock;
12
13#[derive(Debug, Clone, Copy)]
14pub enum Error {
15 NoDev,
16 InvalidIo,
17 Busy,
18 InvalidArgument,
19 NoMemory,
20 Timeout,
21}
22
23pub type DriverResult<T = ()> = core::result::Result<T, Error>;
24
25pub trait DriverGeneric: Send {
26 fn open(&mut self) -> DriverResult;
27 fn close(&mut self) -> DriverResult;
28}
29
30custom_type!(IrqId, usize, "{:#x}");
31
32#[derive(Copy, Clone, Debug, Eq, PartialEq)]
34pub enum Trigger {
35 EdgeBoth,
36 EdgeRising,
37 EdgeFailling,
38 LevelHigh,
39 LevelLow,
40}
41
42#[derive(Debug, Clone)]
43pub struct IrqConfig {
44 pub irq: IrqId,
45 pub trigger: Trigger,
46}