pub trait PinId {
const PORT: usize;
const NUMBER: u8;
const MASK: u32;
const OFFSET: usize;
const TYPE: PinType;
}
pub enum PinType {
D, A, I, }
pub mod state {
use super::function::Function;
use super::gpio::direction::Direction;
use crate::typestates::reg_proxy::RegClusterProxy;
pub trait PinState {}
pub struct Unused;
impl PinState for Unused {}
pub struct Gpio<D: Direction> {
pub(crate) dirset: RegClusterProxy<raw::gpio::DIRSET>,
pub(crate) dirclr: RegClusterProxy<raw::gpio::DIRCLR>,
pub(crate) pin: RegClusterProxy<raw::gpio::PIN>,
pub(crate) set: RegClusterProxy<raw::gpio::SET>,
pub(crate) clr: RegClusterProxy<raw::gpio::CLR>,
pub(crate) _direction: D,
}
pub struct Analog<D: Direction> {
pub channel: u8,
pub(crate) dirclr: RegClusterProxy<raw::gpio::DIRCLR>,
pub(crate) _direction: D,
}
impl<D> PinState for Gpio<D> where D: Direction {}
impl<D> PinState for Analog<D> where D: Direction {}
pub struct Special<F: Function> {
pub(crate) _function: F,
}
impl<F> PinState for Special<F> where F: Function {}
}
pub mod gpio {
pub mod direction {
pub trait Direction {}
pub struct Unknown;
impl Direction for Unknown {}
pub struct Input;
impl Direction for Input {}
pub struct Output;
impl Direction for Output {}
pub struct AnalogInput;
impl Direction for AnalogInput {}
pub struct AnalogOutput;
impl Direction for AnalogOutput {}
pub trait NotInput: Direction {}
impl NotInput for Unknown {}
impl NotInput for Output {}
pub trait NotOutput: Direction {}
impl NotOutput for Unknown {}
impl NotOutput for Input {}
}
pub enum Level {
Low,
High,
}
}
pub mod function;
pub mod flexcomm;