swm341_pac/crc/
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 `EN` reader - EN field"]
38pub type EN_R = crate::BitReader<bool>;
39#[doc = "Field `EN` writer - EN field"]
40pub type EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
41#[doc = "Field `IREV` reader - IREV field"]
42pub type IREV_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `IREV` writer - IREV field"]
44pub type IREV_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CR_SPEC, u8, u8, 2, O>;
45#[doc = "Field `INOT` reader - INOT field"]
46pub type INOT_R = crate::BitReader<bool>;
47#[doc = "Field `INOT` writer - INOT field"]
48pub type INOT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
49#[doc = "Field `OREV` reader - OREV field"]
50pub type OREV_R = crate::FieldReader<u8, u8>;
51#[doc = "Field `OREV` writer - OREV field"]
52pub type OREV_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CR_SPEC, u8, u8, 2, O>;
53#[doc = "Field `ONOT` reader - ONOT field"]
54pub type ONOT_R = crate::BitReader<bool>;
55#[doc = "Field `ONOT` writer - ONOT field"]
56pub type ONOT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CR_SPEC, bool, O>;
57#[doc = "Field `POLY` reader - POLY field"]
58pub type POLY_R = crate::FieldReader<u8, u8>;
59#[doc = "Field `POLY` writer - POLY field"]
60pub type POLY_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CR_SPEC, u8, u8, 2, O>;
61#[doc = "Field `IBIT` reader - IBIT field"]
62pub type IBIT_R = crate::FieldReader<u8, u8>;
63#[doc = "Field `IBIT` writer - IBIT field"]
64pub type IBIT_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CR_SPEC, u8, u8, 2, O>;
65impl R {
66    #[doc = "Bit 0 - EN field"]
67    #[inline(always)]
68    pub fn en(&self) -> EN_R {
69        EN_R::new((self.bits & 1) != 0)
70    }
71    #[doc = "Bits 1:2 - IREV field"]
72    #[inline(always)]
73    pub fn irev(&self) -> IREV_R {
74        IREV_R::new(((self.bits >> 1) & 3) as u8)
75    }
76    #[doc = "Bit 3 - INOT field"]
77    #[inline(always)]
78    pub fn inot(&self) -> INOT_R {
79        INOT_R::new(((self.bits >> 3) & 1) != 0)
80    }
81    #[doc = "Bits 4:5 - OREV field"]
82    #[inline(always)]
83    pub fn orev(&self) -> OREV_R {
84        OREV_R::new(((self.bits >> 4) & 3) as u8)
85    }
86    #[doc = "Bit 6 - ONOT field"]
87    #[inline(always)]
88    pub fn onot(&self) -> ONOT_R {
89        ONOT_R::new(((self.bits >> 6) & 1) != 0)
90    }
91    #[doc = "Bits 7:8 - POLY field"]
92    #[inline(always)]
93    pub fn poly(&self) -> POLY_R {
94        POLY_R::new(((self.bits >> 7) & 3) as u8)
95    }
96    #[doc = "Bits 9:10 - IBIT field"]
97    #[inline(always)]
98    pub fn ibit(&self) -> IBIT_R {
99        IBIT_R::new(((self.bits >> 9) & 3) as u8)
100    }
101}
102impl W {
103    #[doc = "Bit 0 - EN field"]
104    #[inline(always)]
105    pub fn en(&mut self) -> EN_W<0> {
106        EN_W::new(self)
107    }
108    #[doc = "Bits 1:2 - IREV field"]
109    #[inline(always)]
110    pub fn irev(&mut self) -> IREV_W<1> {
111        IREV_W::new(self)
112    }
113    #[doc = "Bit 3 - INOT field"]
114    #[inline(always)]
115    pub fn inot(&mut self) -> INOT_W<3> {
116        INOT_W::new(self)
117    }
118    #[doc = "Bits 4:5 - OREV field"]
119    #[inline(always)]
120    pub fn orev(&mut self) -> OREV_W<4> {
121        OREV_W::new(self)
122    }
123    #[doc = "Bit 6 - ONOT field"]
124    #[inline(always)]
125    pub fn onot(&mut self) -> ONOT_W<6> {
126        ONOT_W::new(self)
127    }
128    #[doc = "Bits 7:8 - POLY field"]
129    #[inline(always)]
130    pub fn poly(&mut self) -> POLY_W<7> {
131        POLY_W::new(self)
132    }
133    #[doc = "Bits 9:10 - IBIT field"]
134    #[inline(always)]
135    pub fn ibit(&mut self) -> IBIT_W<9> {
136        IBIT_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}