mcxa_pac/lpi2c0/
scfgr0.rs

1#[doc = "Register `SCFGR0` reader"]
2pub type R = crate::R<Scfgr0Spec>;
3#[doc = "Register `SCFGR0` writer"]
4pub type W = crate::W<Scfgr0Spec>;
5#[doc = "Read Request\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Rdreq {
9    #[doc = "0: Disable"]
10    Disabled = 0,
11    #[doc = "1: Enable"]
12    Enabled = 1,
13}
14impl From<Rdreq> for bool {
15    #[inline(always)]
16    fn from(variant: Rdreq) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `RDREQ` reader - Read Request"]
21pub type RdreqR = crate::BitReader<Rdreq>;
22impl RdreqR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Rdreq {
26        match self.bits {
27            false => Rdreq::Disabled,
28            true => Rdreq::Enabled,
29        }
30    }
31    #[doc = "Disable"]
32    #[inline(always)]
33    pub fn is_disabled(&self) -> bool {
34        *self == Rdreq::Disabled
35    }
36    #[doc = "Enable"]
37    #[inline(always)]
38    pub fn is_enabled(&self) -> bool {
39        *self == Rdreq::Enabled
40    }
41}
42#[doc = "Field `RDREQ` writer - Read Request"]
43pub type RdreqW<'a, REG> = crate::BitWriter<'a, REG, Rdreq>;
44impl<'a, REG> RdreqW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Disable"]
49    #[inline(always)]
50    pub fn disabled(self) -> &'a mut crate::W<REG> {
51        self.variant(Rdreq::Disabled)
52    }
53    #[doc = "Enable"]
54    #[inline(always)]
55    pub fn enabled(self) -> &'a mut crate::W<REG> {
56        self.variant(Rdreq::Enabled)
57    }
58}
59#[doc = "Read Acknowledge Flag\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Rdack {
63    #[doc = "0: Read Request not acknowledged"]
64    NotAcknowledged = 0,
65    #[doc = "1: Read Request acknowledged"]
66    Acknowledged = 1,
67}
68impl From<Rdack> for bool {
69    #[inline(always)]
70    fn from(variant: Rdack) -> Self {
71        variant as u8 != 0
72    }
73}
74#[doc = "Field `RDACK` reader - Read Acknowledge Flag"]
75pub type RdackR = crate::BitReader<Rdack>;
76impl RdackR {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> Rdack {
80        match self.bits {
81            false => Rdack::NotAcknowledged,
82            true => Rdack::Acknowledged,
83        }
84    }
85    #[doc = "Read Request not acknowledged"]
86    #[inline(always)]
87    pub fn is_not_acknowledged(&self) -> bool {
88        *self == Rdack::NotAcknowledged
89    }
90    #[doc = "Read Request acknowledged"]
91    #[inline(always)]
92    pub fn is_acknowledged(&self) -> bool {
93        *self == Rdack::Acknowledged
94    }
95}
96impl R {
97    #[doc = "Bit 0 - Read Request"]
98    #[inline(always)]
99    pub fn rdreq(&self) -> RdreqR {
100        RdreqR::new((self.bits & 1) != 0)
101    }
102    #[doc = "Bit 1 - Read Acknowledge Flag"]
103    #[inline(always)]
104    pub fn rdack(&self) -> RdackR {
105        RdackR::new(((self.bits >> 1) & 1) != 0)
106    }
107}
108#[cfg(feature = "debug")]
109impl core::fmt::Debug for R {
110    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
111        f.debug_struct("SCFGR0")
112            .field("rdreq", &self.rdreq())
113            .field("rdack", &self.rdack())
114            .finish()
115    }
116}
117impl W {
118    #[doc = "Bit 0 - Read Request"]
119    #[inline(always)]
120    pub fn rdreq(&mut self) -> RdreqW<'_, Scfgr0Spec> {
121        RdreqW::new(self, 0)
122    }
123}
124#[doc = "Target Configuration 0\n\nYou can [`read`](crate::Reg::read) this register and get [`scfgr0::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`scfgr0::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
125pub struct Scfgr0Spec;
126impl crate::RegisterSpec for Scfgr0Spec {
127    type Ux = u32;
128}
129#[doc = "`read()` method returns [`scfgr0::R`](R) reader structure"]
130impl crate::Readable for Scfgr0Spec {}
131#[doc = "`write(|w| ..)` method takes [`scfgr0::W`](W) writer structure"]
132impl crate::Writable for Scfgr0Spec {
133    type Safety = crate::Unsafe;
134}
135#[doc = "`reset()` method sets SCFGR0 to value 0"]
136impl crate::Resettable for Scfgr0Spec {}