pub type R = crate::R<RGSRrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OF0 {
NoTrigger = 0,
Trigger = 1,
}
impl From<OF0> for bool {
#[inline(always)]
fn from(variant: OF0) -> Self {
variant as u8 != 0
}
}
pub type OF_R = crate::BitReader<OF0>;
impl OF_R {
#[inline(always)]
pub const fn variant(&self) -> OF0 {
match self.bits {
false => OF0::NoTrigger,
true => OF0::Trigger,
}
}
#[inline(always)]
pub fn is_no_trigger(&self) -> bool {
*self == OF0::NoTrigger
}
#[inline(always)]
pub fn is_trigger(&self) -> bool {
*self == OF0::Trigger
}
}
impl R {
#[inline(always)]
pub fn of(&self, n: u8) -> OF_R {
#[allow(clippy::no_effect)]
[(); 4][n as usize];
OF_R::new(((self.bits >> n) & 1) != 0)
}
#[inline(always)]
pub fn of_iter(&self) -> impl Iterator<Item = OF_R> + '_ {
(0..4).map(move |n| OF_R::new(((self.bits >> n) & 1) != 0))
}
#[inline(always)]
pub fn of0(&self) -> OF_R {
OF_R::new((self.bits & 1) != 0)
}
#[inline(always)]
pub fn of1(&self) -> OF_R {
OF_R::new(((self.bits >> 1) & 1) != 0)
}
#[inline(always)]
pub fn of2(&self) -> OF_R {
OF_R::new(((self.bits >> 2) & 1) != 0)
}
#[inline(always)]
pub fn of3(&self) -> OF_R {
OF_R::new(((self.bits >> 3) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RGSR")
.field("of0", &self.of0())
.field("of1", &self.of1())
.field("of2", &self.of2())
.field("of3", &self.of3())
.finish()
}
}
pub struct RGSRrs;
impl crate::RegisterSpec for RGSRrs {
type Ux = u32;
}
impl crate::Readable for RGSRrs {}
impl crate::Resettable for RGSRrs {}