swm341_pac/qei/
cr.rs

1#[doc = "Register `CR` reader"]
2pub struct R(crate::R<CR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CR` writer"]
17pub struct W(crate::W<CR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CR_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<CR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `ENA` reader - ENA field"]
38pub type ENA_R = crate::BitReader<bool>;
39#[doc = "Field `ENA` writer - ENA field"]
40pub type ENA_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
41#[doc = "Field `ABSWAP` reader - ABSWAP field"]
42pub type ABSWAP_R = crate::BitReader<bool>;
43#[doc = "Field `ABSWAP` writer - ABSWAP field"]
44pub type ABSWAP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
45#[doc = "Field `X2X4` reader - X2X4 field"]
46pub type X2X4_R = crate::BitReader<bool>;
47#[doc = "Field `X2X4` writer - X2X4 field"]
48pub type X2X4_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
49#[doc = "Field `RSTSRC` reader - RSTSRC field"]
50pub type RSTSRC_R = crate::BitReader<bool>;
51#[doc = "Field `RSTSRC` writer - RSTSRC field"]
52pub type RSTSRC_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
53#[doc = "Field `MODE` reader - MODE field"]
54pub type MODE_R = crate::BitReader<bool>;
55#[doc = "Field `MODE` writer - MODE field"]
56pub type MODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
57#[doc = "Field `INDEX` reader - INDEX field"]
58pub type INDEX_R = crate::BitReader<bool>;
59#[doc = "Field `INDEX` writer - INDEX field"]
60pub type INDEX_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
61#[doc = "Field `PAUSE` reader - PAUSE field"]
62pub type PAUSE_R = crate::BitReader<bool>;
63#[doc = "Field `PAUSE` writer - PAUSE field"]
64pub type PAUSE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
65impl R {
66    #[doc = "Bit 0 - ENA field"]
67    #[inline(always)]
68    pub fn ena(&self) -> ENA_R {
69        ENA_R::new((self.bits & 1) != 0)
70    }
71    #[doc = "Bit 4 - ABSWAP field"]
72    #[inline(always)]
73    pub fn abswap(&self) -> ABSWAP_R {
74        ABSWAP_R::new(((self.bits >> 4) & 1) != 0)
75    }
76    #[doc = "Bit 5 - X2X4 field"]
77    #[inline(always)]
78    pub fn x2x4(&self) -> X2X4_R {
79        X2X4_R::new(((self.bits >> 5) & 1) != 0)
80    }
81    #[doc = "Bit 6 - RSTSRC field"]
82    #[inline(always)]
83    pub fn rstsrc(&self) -> RSTSRC_R {
84        RSTSRC_R::new(((self.bits >> 6) & 1) != 0)
85    }
86    #[doc = "Bit 7 - MODE field"]
87    #[inline(always)]
88    pub fn mode(&self) -> MODE_R {
89        MODE_R::new(((self.bits >> 7) & 1) != 0)
90    }
91    #[doc = "Bit 9 - INDEX field"]
92    #[inline(always)]
93    pub fn index(&self) -> INDEX_R {
94        INDEX_R::new(((self.bits >> 9) & 1) != 0)
95    }
96    #[doc = "Bit 10 - PAUSE field"]
97    #[inline(always)]
98    pub fn pause(&self) -> PAUSE_R {
99        PAUSE_R::new(((self.bits >> 10) & 1) != 0)
100    }
101}
102impl W {
103    #[doc = "Bit 0 - ENA field"]
104    #[inline(always)]
105    pub fn ena(&mut self) -> ENA_W<0> {
106        ENA_W::new(self)
107    }
108    #[doc = "Bit 4 - ABSWAP field"]
109    #[inline(always)]
110    pub fn abswap(&mut self) -> ABSWAP_W<4> {
111        ABSWAP_W::new(self)
112    }
113    #[doc = "Bit 5 - X2X4 field"]
114    #[inline(always)]
115    pub fn x2x4(&mut self) -> X2X4_W<5> {
116        X2X4_W::new(self)
117    }
118    #[doc = "Bit 6 - RSTSRC field"]
119    #[inline(always)]
120    pub fn rstsrc(&mut self) -> RSTSRC_W<6> {
121        RSTSRC_W::new(self)
122    }
123    #[doc = "Bit 7 - MODE field"]
124    #[inline(always)]
125    pub fn mode(&mut self) -> MODE_W<7> {
126        MODE_W::new(self)
127    }
128    #[doc = "Bit 9 - INDEX field"]
129    #[inline(always)]
130    pub fn index(&mut self) -> INDEX_W<9> {
131        INDEX_W::new(self)
132    }
133    #[doc = "Bit 10 - PAUSE field"]
134    #[inline(always)]
135    pub fn pause(&mut self) -> PAUSE_W<10> {
136        PAUSE_W::new(self)
137    }
138    #[doc = "Writes raw bits to the register."]
139    #[inline(always)]
140    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
141        self.0.bits(bits);
142        self
143    }
144}
145#[doc = "CR register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cr](index.html) module"]
146pub struct CR_SPEC;
147impl crate::RegisterSpec for CR_SPEC {
148    type Ux = u32;
149}
150#[doc = "`read()` method returns [cr::R](R) reader structure"]
151impl crate::Readable for CR_SPEC {
152    type Reader = R;
153}
154#[doc = "`write(|w| ..)` method takes [cr::W](W) writer structure"]
155impl crate::Writable for CR_SPEC {
156    type Writer = W;
157}
158#[doc = "`reset()` method sets CR to value 0"]
159impl crate::Resettable for CR_SPEC {
160    #[inline(always)]
161    fn reset_value() -> Self::Ux {
162        0
163    }
164}