ra4m2/sysc/
prcr.rs

1#[doc = "Register `PRCR` reader"]
2pub struct R(crate::R<PRCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PRCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PRCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PRCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PRCR` writer"]
17pub struct W(crate::W<PRCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PRCR_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<PRCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PRCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `PRC0` reader - Enable writing to the registers related to the clock generation circuit"]
38pub type PRC0_R = crate::BitReader<PRC0_A>;
39#[doc = "Enable writing to the registers related to the clock generation circuit\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum PRC0_A {
42    #[doc = "0: Disable writes"]
43    _0 = 0,
44    #[doc = "1: Enable writes"]
45    _1 = 1,
46}
47impl From<PRC0_A> for bool {
48    #[inline(always)]
49    fn from(variant: PRC0_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl PRC0_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> PRC0_A {
57        match self.bits {
58            false => PRC0_A::_0,
59            true => PRC0_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == PRC0_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == PRC0_A::_1
71    }
72}
73#[doc = "Field `PRC0` writer - Enable writing to the registers related to the clock generation circuit"]
74pub type PRC0_W<'a, const O: u8> = crate::BitWriter<'a, u16, PRCR_SPEC, PRC0_A, O>;
75impl<'a, const O: u8> PRC0_W<'a, O> {
76    #[doc = "Disable writes"]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(PRC0_A::_0)
80    }
81    #[doc = "Enable writes"]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(PRC0_A::_1)
85    }
86}
87#[doc = "Field `PRC1` reader - Enable writing to the registers related to the low power modes, and the battery backup function"]
88pub type PRC1_R = crate::BitReader<PRC1_A>;
89#[doc = "Enable writing to the registers related to the low power modes, and the battery backup function\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum PRC1_A {
92    #[doc = "0: Disable writes"]
93    _0 = 0,
94    #[doc = "1: Enable writes"]
95    _1 = 1,
96}
97impl From<PRC1_A> for bool {
98    #[inline(always)]
99    fn from(variant: PRC1_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl PRC1_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> PRC1_A {
107        match self.bits {
108            false => PRC1_A::_0,
109            true => PRC1_A::_1,
110        }
111    }
112    #[doc = "Checks if the value of the field is `_0`"]
113    #[inline(always)]
114    pub fn is_0(&self) -> bool {
115        *self == PRC1_A::_0
116    }
117    #[doc = "Checks if the value of the field is `_1`"]
118    #[inline(always)]
119    pub fn is_1(&self) -> bool {
120        *self == PRC1_A::_1
121    }
122}
123#[doc = "Field `PRC1` writer - Enable writing to the registers related to the low power modes, and the battery backup function"]
124pub type PRC1_W<'a, const O: u8> = crate::BitWriter<'a, u16, PRCR_SPEC, PRC1_A, O>;
125impl<'a, const O: u8> PRC1_W<'a, O> {
126    #[doc = "Disable writes"]
127    #[inline(always)]
128    pub fn _0(self) -> &'a mut W {
129        self.variant(PRC1_A::_0)
130    }
131    #[doc = "Enable writes"]
132    #[inline(always)]
133    pub fn _1(self) -> &'a mut W {
134        self.variant(PRC1_A::_1)
135    }
136}
137#[doc = "Field `PRC3` reader - Enable writing to the registers related to the LVD"]
138pub type PRC3_R = crate::BitReader<PRC3_A>;
139#[doc = "Enable writing to the registers related to the LVD\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum PRC3_A {
142    #[doc = "0: Disable writes"]
143    _0 = 0,
144    #[doc = "1: Enable writes"]
145    _1 = 1,
146}
147impl From<PRC3_A> for bool {
148    #[inline(always)]
149    fn from(variant: PRC3_A) -> Self {
150        variant as u8 != 0
151    }
152}
153impl PRC3_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> PRC3_A {
157        match self.bits {
158            false => PRC3_A::_0,
159            true => PRC3_A::_1,
160        }
161    }
162    #[doc = "Checks if the value of the field is `_0`"]
163    #[inline(always)]
164    pub fn is_0(&self) -> bool {
165        *self == PRC3_A::_0
166    }
167    #[doc = "Checks if the value of the field is `_1`"]
168    #[inline(always)]
169    pub fn is_1(&self) -> bool {
170        *self == PRC3_A::_1
171    }
172}
173#[doc = "Field `PRC3` writer - Enable writing to the registers related to the LVD"]
174pub type PRC3_W<'a, const O: u8> = crate::BitWriter<'a, u16, PRCR_SPEC, PRC3_A, O>;
175impl<'a, const O: u8> PRC3_W<'a, O> {
176    #[doc = "Disable writes"]
177    #[inline(always)]
178    pub fn _0(self) -> &'a mut W {
179        self.variant(PRC3_A::_0)
180    }
181    #[doc = "Enable writes"]
182    #[inline(always)]
183    pub fn _1(self) -> &'a mut W {
184        self.variant(PRC3_A::_1)
185    }
186}
187#[doc = "Field `PRC4` reader - "]
188pub type PRC4_R = crate::BitReader<PRC4_A>;
189#[doc = "\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191pub enum PRC4_A {
192    #[doc = "0: Disable writes"]
193    _0 = 0,
194    #[doc = "1: Enable writes"]
195    _1 = 1,
196}
197impl From<PRC4_A> for bool {
198    #[inline(always)]
199    fn from(variant: PRC4_A) -> Self {
200        variant as u8 != 0
201    }
202}
203impl PRC4_R {
204    #[doc = "Get enumerated values variant"]
205    #[inline(always)]
206    pub fn variant(&self) -> PRC4_A {
207        match self.bits {
208            false => PRC4_A::_0,
209            true => PRC4_A::_1,
210        }
211    }
212    #[doc = "Checks if the value of the field is `_0`"]
213    #[inline(always)]
214    pub fn is_0(&self) -> bool {
215        *self == PRC4_A::_0
216    }
217    #[doc = "Checks if the value of the field is `_1`"]
218    #[inline(always)]
219    pub fn is_1(&self) -> bool {
220        *self == PRC4_A::_1
221    }
222}
223#[doc = "Field `PRC4` writer - "]
224pub type PRC4_W<'a, const O: u8> = crate::BitWriter<'a, u16, PRCR_SPEC, PRC4_A, O>;
225impl<'a, const O: u8> PRC4_W<'a, O> {
226    #[doc = "Disable writes"]
227    #[inline(always)]
228    pub fn _0(self) -> &'a mut W {
229        self.variant(PRC4_A::_0)
230    }
231    #[doc = "Enable writes"]
232    #[inline(always)]
233    pub fn _1(self) -> &'a mut W {
234        self.variant(PRC4_A::_1)
235    }
236}
237#[doc = "Field `PRKEY` writer - PRC Key Code"]
238pub type PRKEY_W<'a, const O: u8> = crate::FieldWriter<'a, u16, PRCR_SPEC, u8, u8, 8, O>;
239impl R {
240    #[doc = "Bit 0 - Enable writing to the registers related to the clock generation circuit"]
241    #[inline(always)]
242    pub fn prc0(&self) -> PRC0_R {
243        PRC0_R::new((self.bits & 1) != 0)
244    }
245    #[doc = "Bit 1 - Enable writing to the registers related to the low power modes, and the battery backup function"]
246    #[inline(always)]
247    pub fn prc1(&self) -> PRC1_R {
248        PRC1_R::new(((self.bits >> 1) & 1) != 0)
249    }
250    #[doc = "Bit 3 - Enable writing to the registers related to the LVD"]
251    #[inline(always)]
252    pub fn prc3(&self) -> PRC3_R {
253        PRC3_R::new(((self.bits >> 3) & 1) != 0)
254    }
255    #[doc = "Bit 4"]
256    #[inline(always)]
257    pub fn prc4(&self) -> PRC4_R {
258        PRC4_R::new(((self.bits >> 4) & 1) != 0)
259    }
260}
261impl W {
262    #[doc = "Bit 0 - Enable writing to the registers related to the clock generation circuit"]
263    #[inline(always)]
264    #[must_use]
265    pub fn prc0(&mut self) -> PRC0_W<0> {
266        PRC0_W::new(self)
267    }
268    #[doc = "Bit 1 - Enable writing to the registers related to the low power modes, and the battery backup function"]
269    #[inline(always)]
270    #[must_use]
271    pub fn prc1(&mut self) -> PRC1_W<1> {
272        PRC1_W::new(self)
273    }
274    #[doc = "Bit 3 - Enable writing to the registers related to the LVD"]
275    #[inline(always)]
276    #[must_use]
277    pub fn prc3(&mut self) -> PRC3_W<3> {
278        PRC3_W::new(self)
279    }
280    #[doc = "Bit 4"]
281    #[inline(always)]
282    #[must_use]
283    pub fn prc4(&mut self) -> PRC4_W<4> {
284        PRC4_W::new(self)
285    }
286    #[doc = "Bits 8:15 - PRC Key Code"]
287    #[inline(always)]
288    #[must_use]
289    pub fn prkey(&mut self) -> PRKEY_W<8> {
290        PRKEY_W::new(self)
291    }
292    #[doc = "Writes raw bits to the register."]
293    #[inline(always)]
294    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
295        self.0.bits(bits);
296        self
297    }
298}
299#[doc = "Protect 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 [prcr](index.html) module"]
300pub struct PRCR_SPEC;
301impl crate::RegisterSpec for PRCR_SPEC {
302    type Ux = u16;
303}
304#[doc = "`read()` method returns [prcr::R](R) reader structure"]
305impl crate::Readable for PRCR_SPEC {
306    type Reader = R;
307}
308#[doc = "`write(|w| ..)` method takes [prcr::W](W) writer structure"]
309impl crate::Writable for PRCR_SPEC {
310    type Writer = W;
311    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
312    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
313}
314#[doc = "`reset()` method sets PRCR to value 0"]
315impl crate::Resettable for PRCR_SPEC {
316    const RESET_VALUE: Self::Ux = 0;
317}