efm32pg22_pac/efm32pg22c200/gpcrc_s/
ctrl.rs1#[doc = "Register `CTRL` reader"]
2pub struct R(crate::R<CTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CTRL` writer"]
17pub struct W(crate::W<CTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CTRL_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<CTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `POLYSEL` reader - Polynomial Select"]
38pub type POLYSEL_R = crate::BitReader<POLYSEL_A>;
39#[doc = "Polynomial Select\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum POLYSEL_A {
42 #[doc = "0: CRC-32 (0x04C11DB7) polynomial selected"]
43 CRC32 = 0,
44 #[doc = "1: 16-bit CRC programmable polynomial selected"]
45 CRC16 = 1,
46}
47impl From<POLYSEL_A> for bool {
48 #[inline(always)]
49 fn from(variant: POLYSEL_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl POLYSEL_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> POLYSEL_A {
57 match self.bits {
58 false => POLYSEL_A::CRC32,
59 true => POLYSEL_A::CRC16,
60 }
61 }
62 #[doc = "Checks if the value of the field is `CRC32`"]
63 #[inline(always)]
64 pub fn is_crc32(&self) -> bool {
65 *self == POLYSEL_A::CRC32
66 }
67 #[doc = "Checks if the value of the field is `CRC16`"]
68 #[inline(always)]
69 pub fn is_crc16(&self) -> bool {
70 *self == POLYSEL_A::CRC16
71 }
72}
73#[doc = "Field `POLYSEL` writer - Polynomial Select"]
74pub type POLYSEL_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, POLYSEL_A, O>;
75impl<'a, const O: u8> POLYSEL_W<'a, O> {
76 #[doc = "CRC-32 (0x04C11DB7) polynomial selected"]
77 #[inline(always)]
78 pub fn crc32(self) -> &'a mut W {
79 self.variant(POLYSEL_A::CRC32)
80 }
81 #[doc = "16-bit CRC programmable polynomial selected"]
82 #[inline(always)]
83 pub fn crc16(self) -> &'a mut W {
84 self.variant(POLYSEL_A::CRC16)
85 }
86}
87#[doc = "Field `BYTEMODE` reader - Byte Mode Enable"]
88pub type BYTEMODE_R = crate::BitReader<bool>;
89#[doc = "Field `BYTEMODE` writer - Byte Mode Enable"]
90pub type BYTEMODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
91#[doc = "Field `BITREVERSE` reader - Byte-level Bit Reverse Enable"]
92pub type BITREVERSE_R = crate::BitReader<BITREVERSE_A>;
93#[doc = "Byte-level Bit Reverse Enable\n\nValue on reset: 0"]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum BITREVERSE_A {
96 #[doc = "0: No reverse"]
97 NORMAL = 0,
98 #[doc = "1: Reverse bit order in each byte"]
99 REVERSED = 1,
100}
101impl From<BITREVERSE_A> for bool {
102 #[inline(always)]
103 fn from(variant: BITREVERSE_A) -> Self {
104 variant as u8 != 0
105 }
106}
107impl BITREVERSE_R {
108 #[doc = "Get enumerated values variant"]
109 #[inline(always)]
110 pub fn variant(&self) -> BITREVERSE_A {
111 match self.bits {
112 false => BITREVERSE_A::NORMAL,
113 true => BITREVERSE_A::REVERSED,
114 }
115 }
116 #[doc = "Checks if the value of the field is `NORMAL`"]
117 #[inline(always)]
118 pub fn is_normal(&self) -> bool {
119 *self == BITREVERSE_A::NORMAL
120 }
121 #[doc = "Checks if the value of the field is `REVERSED`"]
122 #[inline(always)]
123 pub fn is_reversed(&self) -> bool {
124 *self == BITREVERSE_A::REVERSED
125 }
126}
127#[doc = "Field `BITREVERSE` writer - Byte-level Bit Reverse Enable"]
128pub type BITREVERSE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, BITREVERSE_A, O>;
129impl<'a, const O: u8> BITREVERSE_W<'a, O> {
130 #[doc = "No reverse"]
131 #[inline(always)]
132 pub fn normal(self) -> &'a mut W {
133 self.variant(BITREVERSE_A::NORMAL)
134 }
135 #[doc = "Reverse bit order in each byte"]
136 #[inline(always)]
137 pub fn reversed(self) -> &'a mut W {
138 self.variant(BITREVERSE_A::REVERSED)
139 }
140}
141#[doc = "Field `BYTEREVERSE` reader - Byte Reverse Mode"]
142pub type BYTEREVERSE_R = crate::BitReader<BYTEREVERSE_A>;
143#[doc = "Byte Reverse Mode\n\nValue on reset: 0"]
144#[derive(Clone, Copy, Debug, PartialEq, Eq)]
145pub enum BYTEREVERSE_A {
146 #[doc = "0: No reverse: B3, B2, B1, B0"]
147 NORMAL = 0,
148 #[doc = "1: Reverse byte order. For 32-bit: B0, B1, B2, B3; For 16-bit: 0, 0, B0, B1"]
149 REVERSED = 1,
150}
151impl From<BYTEREVERSE_A> for bool {
152 #[inline(always)]
153 fn from(variant: BYTEREVERSE_A) -> Self {
154 variant as u8 != 0
155 }
156}
157impl BYTEREVERSE_R {
158 #[doc = "Get enumerated values variant"]
159 #[inline(always)]
160 pub fn variant(&self) -> BYTEREVERSE_A {
161 match self.bits {
162 false => BYTEREVERSE_A::NORMAL,
163 true => BYTEREVERSE_A::REVERSED,
164 }
165 }
166 #[doc = "Checks if the value of the field is `NORMAL`"]
167 #[inline(always)]
168 pub fn is_normal(&self) -> bool {
169 *self == BYTEREVERSE_A::NORMAL
170 }
171 #[doc = "Checks if the value of the field is `REVERSED`"]
172 #[inline(always)]
173 pub fn is_reversed(&self) -> bool {
174 *self == BYTEREVERSE_A::REVERSED
175 }
176}
177#[doc = "Field `BYTEREVERSE` writer - Byte Reverse Mode"]
178pub type BYTEREVERSE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, BYTEREVERSE_A, O>;
179impl<'a, const O: u8> BYTEREVERSE_W<'a, O> {
180 #[doc = "No reverse: B3, B2, B1, B0"]
181 #[inline(always)]
182 pub fn normal(self) -> &'a mut W {
183 self.variant(BYTEREVERSE_A::NORMAL)
184 }
185 #[doc = "Reverse byte order. For 32-bit: B0, B1, B2, B3; For 16-bit: 0, 0, B0, B1"]
186 #[inline(always)]
187 pub fn reversed(self) -> &'a mut W {
188 self.variant(BYTEREVERSE_A::REVERSED)
189 }
190}
191#[doc = "Field `AUTOINIT` reader - Auto Init Enable"]
192pub type AUTOINIT_R = crate::BitReader<bool>;
193#[doc = "Field `AUTOINIT` writer - Auto Init Enable"]
194pub type AUTOINIT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, O>;
195impl R {
196 #[doc = "Bit 4 - Polynomial Select"]
197 #[inline(always)]
198 pub fn polysel(&self) -> POLYSEL_R {
199 POLYSEL_R::new(((self.bits >> 4) & 1) != 0)
200 }
201 #[doc = "Bit 8 - Byte Mode Enable"]
202 #[inline(always)]
203 pub fn bytemode(&self) -> BYTEMODE_R {
204 BYTEMODE_R::new(((self.bits >> 8) & 1) != 0)
205 }
206 #[doc = "Bit 9 - Byte-level Bit Reverse Enable"]
207 #[inline(always)]
208 pub fn bitreverse(&self) -> BITREVERSE_R {
209 BITREVERSE_R::new(((self.bits >> 9) & 1) != 0)
210 }
211 #[doc = "Bit 10 - Byte Reverse Mode"]
212 #[inline(always)]
213 pub fn bytereverse(&self) -> BYTEREVERSE_R {
214 BYTEREVERSE_R::new(((self.bits >> 10) & 1) != 0)
215 }
216 #[doc = "Bit 13 - Auto Init Enable"]
217 #[inline(always)]
218 pub fn autoinit(&self) -> AUTOINIT_R {
219 AUTOINIT_R::new(((self.bits >> 13) & 1) != 0)
220 }
221}
222impl W {
223 #[doc = "Bit 4 - Polynomial Select"]
224 #[inline(always)]
225 #[must_use]
226 pub fn polysel(&mut self) -> POLYSEL_W<4> {
227 POLYSEL_W::new(self)
228 }
229 #[doc = "Bit 8 - Byte Mode Enable"]
230 #[inline(always)]
231 #[must_use]
232 pub fn bytemode(&mut self) -> BYTEMODE_W<8> {
233 BYTEMODE_W::new(self)
234 }
235 #[doc = "Bit 9 - Byte-level Bit Reverse Enable"]
236 #[inline(always)]
237 #[must_use]
238 pub fn bitreverse(&mut self) -> BITREVERSE_W<9> {
239 BITREVERSE_W::new(self)
240 }
241 #[doc = "Bit 10 - Byte Reverse Mode"]
242 #[inline(always)]
243 #[must_use]
244 pub fn bytereverse(&mut self) -> BYTEREVERSE_W<10> {
245 BYTEREVERSE_W::new(self)
246 }
247 #[doc = "Bit 13 - Auto Init Enable"]
248 #[inline(always)]
249 #[must_use]
250 pub fn autoinit(&mut self) -> AUTOINIT_W<13> {
251 AUTOINIT_W::new(self)
252 }
253 #[doc = "Writes raw bits to the register."]
254 #[inline(always)]
255 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
256 self.0.bits(bits);
257 self
258 }
259}
260#[doc = "No Description\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 [ctrl](index.html) module"]
261pub struct CTRL_SPEC;
262impl crate::RegisterSpec for CTRL_SPEC {
263 type Ux = u32;
264}
265#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
266impl crate::Readable for CTRL_SPEC {
267 type Reader = R;
268}
269#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
270impl crate::Writable for CTRL_SPEC {
271 type Writer = W;
272 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
273 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
274}
275#[doc = "`reset()` method sets CTRL to value 0"]
276impl crate::Resettable for CTRL_SPEC {
277 const RESET_VALUE: Self::Ux = 0;
278}