use derive_where::derive_where;
use crate::{Error, Id, Support};
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive_where(Debug, PartialEq, Eq)]
pub struct Event<B: crate::Api + ?Sized> {
pub button: Id<crate::Button<B>>,
pub pressed: bool,
}
impl<B: crate::Api> From<Event<B>> for crate::Event<B> {
fn from(event: Event<B>) -> Self {
crate::Event::Button(event)
}
}
pub trait Api: Support<usize> + Send {
fn enable(button: Id<Self>) -> Result<(), Error>;
fn disable(button: Id<Self>) -> Result<(), Error>;
}