pub type R = crate::R<RGCRrs>;
pub type W = crate::W<RGCRrs>;
pub type SIG_ID_R = crate::FieldReader;
pub type SIG_ID_W<'a, REG> = crate::FieldWriter<'a, REG, 5>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OIE {
Disabled = 0,
Enabled = 1,
}
impl From<OIE> for bool {
#[inline(always)]
fn from(variant: OIE) -> Self {
variant as u8 != 0
}
}
pub type OIE_R = crate::BitReader<OIE>;
impl OIE_R {
#[inline(always)]
pub const fn variant(&self) -> OIE {
match self.bits {
false => OIE::Disabled,
true => OIE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == OIE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == OIE::Enabled
}
}
pub type OIE_W<'a, REG> = crate::BitWriter<'a, REG, OIE>;
impl<'a, REG> OIE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(OIE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(OIE::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum GE {
Disabled = 0,
Enabled = 1,
}
impl From<GE> for bool {
#[inline(always)]
fn from(variant: GE) -> Self {
variant as u8 != 0
}
}
pub type GE_R = crate::BitReader<GE>;
impl GE_R {
#[inline(always)]
pub const fn variant(&self) -> GE {
match self.bits {
false => GE::Disabled,
true => GE::Enabled,
}
}
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == GE::Disabled
}
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == GE::Enabled
}
}
pub type GE_W<'a, REG> = crate::BitWriter<'a, REG, GE>;
impl<'a, REG> GE_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
{
#[inline(always)]
pub fn disabled(self) -> &'a mut crate::W<REG> {
self.variant(GE::Disabled)
}
#[inline(always)]
pub fn enabled(self) -> &'a mut crate::W<REG> {
self.variant(GE::Enabled)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum GPOL {
NoEdge = 0,
RisingEdge = 1,
FallingEdge = 2,
BothEdges = 3,
}
impl From<GPOL> for u8 {
#[inline(always)]
fn from(variant: GPOL) -> Self {
variant as _
}
}
impl crate::FieldSpec for GPOL {
type Ux = u8;
}
impl crate::IsEnum for GPOL {}
pub type GPOL_R = crate::FieldReader<GPOL>;
impl GPOL_R {
#[inline(always)]
pub const fn variant(&self) -> GPOL {
match self.bits {
0 => GPOL::NoEdge,
1 => GPOL::RisingEdge,
2 => GPOL::FallingEdge,
3 => GPOL::BothEdges,
_ => unreachable!(),
}
}
#[inline(always)]
pub fn is_no_edge(&self) -> bool {
*self == GPOL::NoEdge
}
#[inline(always)]
pub fn is_rising_edge(&self) -> bool {
*self == GPOL::RisingEdge
}
#[inline(always)]
pub fn is_falling_edge(&self) -> bool {
*self == GPOL::FallingEdge
}
#[inline(always)]
pub fn is_both_edges(&self) -> bool {
*self == GPOL::BothEdges
}
}
pub type GPOL_W<'a, REG> = crate::FieldWriter<'a, REG, 2, GPOL, crate::Safe>;
impl<'a, REG> GPOL_W<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn no_edge(self) -> &'a mut crate::W<REG> {
self.variant(GPOL::NoEdge)
}
#[inline(always)]
pub fn rising_edge(self) -> &'a mut crate::W<REG> {
self.variant(GPOL::RisingEdge)
}
#[inline(always)]
pub fn falling_edge(self) -> &'a mut crate::W<REG> {
self.variant(GPOL::FallingEdge)
}
#[inline(always)]
pub fn both_edges(self) -> &'a mut crate::W<REG> {
self.variant(GPOL::BothEdges)
}
}
pub type GNBREQ_R = crate::FieldReader;
pub type GNBREQ_W<'a, REG> = crate::FieldWriter<'a, REG, 5, u8, crate::Safe>;
impl R {
#[inline(always)]
pub fn sig_id(&self) -> SIG_ID_R {
SIG_ID_R::new((self.bits & 0x1f) as u8)
}
#[inline(always)]
pub fn oie(&self) -> OIE_R {
OIE_R::new(((self.bits >> 8) & 1) != 0)
}
#[inline(always)]
pub fn ge(&self) -> GE_R {
GE_R::new(((self.bits >> 16) & 1) != 0)
}
#[inline(always)]
pub fn gpol(&self) -> GPOL_R {
GPOL_R::new(((self.bits >> 17) & 3) as u8)
}
#[inline(always)]
pub fn gnbreq(&self) -> GNBREQ_R {
GNBREQ_R::new(((self.bits >> 19) & 0x1f) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("RGCR")
.field("sig_id", &self.sig_id())
.field("oie", &self.oie())
.field("ge", &self.ge())
.field("gpol", &self.gpol())
.field("gnbreq", &self.gnbreq())
.finish()
}
}
impl W {
#[inline(always)]
pub fn sig_id(&mut self) -> SIG_ID_W<RGCRrs> {
SIG_ID_W::new(self, 0)
}
#[inline(always)]
pub fn oie(&mut self) -> OIE_W<RGCRrs> {
OIE_W::new(self, 8)
}
#[inline(always)]
pub fn ge(&mut self) -> GE_W<RGCRrs> {
GE_W::new(self, 16)
}
#[inline(always)]
pub fn gpol(&mut self) -> GPOL_W<RGCRrs> {
GPOL_W::new(self, 17)
}
#[inline(always)]
pub fn gnbreq(&mut self) -> GNBREQ_W<RGCRrs> {
GNBREQ_W::new(self, 19)
}
}
pub struct RGCRrs;
impl crate::RegisterSpec for RGCRrs {
type Ux = u32;
}
impl crate::Readable for RGCRrs {}
impl crate::Writable for RGCRrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for RGCRrs {}