use avr_oxide::alloc::boxed::Box;
use avr_oxide::devices::button::Button;
use avr_oxide::devices::led::Led;
use avr_oxide::devices::masterclock::MasterClock;
use avr_oxide::devices::serialbus::SerialBus;
use avr_oxide::devices::serialport::SerialPort;
use avr_oxide::devices::wallclock::WallClock;
use avr_oxide::hal::generic::port::Pin;
use avr_oxide::oxide::OxideSupervisor;
use avr_oxide::util::OwnOrBorrow;
pub mod masterclock;
pub mod wallclock;
pub mod led;
pub mod button;
pub mod serialport;
pub mod debouncer;
pub mod inverter;
pub mod nc;
pub mod serialbus;
pub type OxideButton<'a,'b> = Button<'a,OxideSupervisor<'b>>;
pub type OxideLed = Led;
pub type OxideMasterClock<'a,'b,T> = MasterClock<'a,T,OxideSupervisor<'b>>;
pub type OxideSerialPort<'a,'s> = SerialPort<'a,OxideSupervisor<'s>>;
pub type OxideWallClock<'a,'b,T> = WallClock<'a,T,OxideSupervisor<'b>>;
pub type OxideSerialBus<'s> = SerialBus<OxideSupervisor<'s>>;
pub trait UsesPin {
fn using<OP: Into<OwnOrBorrow<'static, dyn Pin>>>(pin: OP) -> Self;
fn with_pin(pin: &'static dyn Pin) -> Self
where
Self: Sized
{
Self::using(pin)
}
fn static_using<OP: Into<OwnOrBorrow<'static, dyn Pin>>>(pin: OP) -> &'static mut Self where Self:Sized {
Box::leak(Box::new(Self::using(pin)))
}
fn static_with_pin(pin: &'static dyn Pin) -> &'static mut Self where Self:Sized {
Box::leak(Box::new(Self::with_pin(pin)))
}
}