ra4m3/gpt164/
gtwp.rs

1#[doc = "Register `GTWP` reader"]
2pub struct R(crate::R<GTWP_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<GTWP_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<GTWP_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<GTWP_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `GTWP` writer"]
17pub struct W(crate::W<GTWP_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<GTWP_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<GTWP_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<GTWP_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `WP` reader - Register Write Disable"]
38pub type WP_R = crate::BitReader<WP_A>;
39#[doc = "Register Write Disable\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum WP_A {
42    #[doc = "0: Write to the register enabled"]
43    _0 = 0,
44    #[doc = "1: Write to the register disabled"]
45    _1 = 1,
46}
47impl From<WP_A> for bool {
48    #[inline(always)]
49    fn from(variant: WP_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl WP_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> WP_A {
57        match self.bits {
58            false => WP_A::_0,
59            true => WP_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 == WP_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 == WP_A::_1
71    }
72}
73#[doc = "Field `WP` writer - Register Write Disable"]
74pub type WP_W<'a, const O: u8> = crate::BitWriter<'a, u32, GTWP_SPEC, WP_A, O>;
75impl<'a, const O: u8> WP_W<'a, O> {
76    #[doc = "Write to the register enabled"]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(WP_A::_0)
80    }
81    #[doc = "Write to the register disabled"]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(WP_A::_1)
85    }
86}
87#[doc = "Field `STRWP` reader - GTSTR.CSTRT Bit Write Disable"]
88pub type STRWP_R = crate::BitReader<STRWP_A>;
89#[doc = "GTSTR.CSTRT Bit Write Disable\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum STRWP_A {
92    #[doc = "0: Write to the bit is enabled"]
93    _0 = 0,
94    #[doc = "1: Write to the bit is disabled"]
95    _1 = 1,
96}
97impl From<STRWP_A> for bool {
98    #[inline(always)]
99    fn from(variant: STRWP_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl STRWP_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> STRWP_A {
107        match self.bits {
108            false => STRWP_A::_0,
109            true => STRWP_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 == STRWP_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 == STRWP_A::_1
121    }
122}
123#[doc = "Field `STRWP` writer - GTSTR.CSTRT Bit Write Disable"]
124pub type STRWP_W<'a, const O: u8> = crate::BitWriter<'a, u32, GTWP_SPEC, STRWP_A, O>;
125impl<'a, const O: u8> STRWP_W<'a, O> {
126    #[doc = "Write to the bit is enabled"]
127    #[inline(always)]
128    pub fn _0(self) -> &'a mut W {
129        self.variant(STRWP_A::_0)
130    }
131    #[doc = "Write to the bit is disabled"]
132    #[inline(always)]
133    pub fn _1(self) -> &'a mut W {
134        self.variant(STRWP_A::_1)
135    }
136}
137#[doc = "Field `STPWP` reader - GTSTP.CSTOP Bit Write Disable"]
138pub type STPWP_R = crate::BitReader<STPWP_A>;
139#[doc = "GTSTP.CSTOP Bit Write Disable\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum STPWP_A {
142    #[doc = "0: Write to the bit is enabled"]
143    _0 = 0,
144    #[doc = "1: Write to the bit is disabled"]
145    _1 = 1,
146}
147impl From<STPWP_A> for bool {
148    #[inline(always)]
149    fn from(variant: STPWP_A) -> Self {
150        variant as u8 != 0
151    }
152}
153impl STPWP_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> STPWP_A {
157        match self.bits {
158            false => STPWP_A::_0,
159            true => STPWP_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 == STPWP_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 == STPWP_A::_1
171    }
172}
173#[doc = "Field `STPWP` writer - GTSTP.CSTOP Bit Write Disable"]
174pub type STPWP_W<'a, const O: u8> = crate::BitWriter<'a, u32, GTWP_SPEC, STPWP_A, O>;
175impl<'a, const O: u8> STPWP_W<'a, O> {
176    #[doc = "Write to the bit is enabled"]
177    #[inline(always)]
178    pub fn _0(self) -> &'a mut W {
179        self.variant(STPWP_A::_0)
180    }
181    #[doc = "Write to the bit is disabled"]
182    #[inline(always)]
183    pub fn _1(self) -> &'a mut W {
184        self.variant(STPWP_A::_1)
185    }
186}
187#[doc = "Field `CLRWP` reader - GTCLR.CCLR Bit Write Disable"]
188pub type CLRWP_R = crate::BitReader<CLRWP_A>;
189#[doc = "GTCLR.CCLR Bit Write Disable\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191pub enum CLRWP_A {
192    #[doc = "0: Write to the bit is enabled"]
193    _0 = 0,
194    #[doc = "1: Write to the bit is disabled"]
195    _1 = 1,
196}
197impl From<CLRWP_A> for bool {
198    #[inline(always)]
199    fn from(variant: CLRWP_A) -> Self {
200        variant as u8 != 0
201    }
202}
203impl CLRWP_R {
204    #[doc = "Get enumerated values variant"]
205    #[inline(always)]
206    pub fn variant(&self) -> CLRWP_A {
207        match self.bits {
208            false => CLRWP_A::_0,
209            true => CLRWP_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 == CLRWP_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 == CLRWP_A::_1
221    }
222}
223#[doc = "Field `CLRWP` writer - GTCLR.CCLR Bit Write Disable"]
224pub type CLRWP_W<'a, const O: u8> = crate::BitWriter<'a, u32, GTWP_SPEC, CLRWP_A, O>;
225impl<'a, const O: u8> CLRWP_W<'a, O> {
226    #[doc = "Write to the bit is enabled"]
227    #[inline(always)]
228    pub fn _0(self) -> &'a mut W {
229        self.variant(CLRWP_A::_0)
230    }
231    #[doc = "Write to the bit is disabled"]
232    #[inline(always)]
233    pub fn _1(self) -> &'a mut W {
234        self.variant(CLRWP_A::_1)
235    }
236}
237#[doc = "Field `CMNWP` reader - Common Register Write Disabled"]
238pub type CMNWP_R = crate::BitReader<CMNWP_A>;
239#[doc = "Common Register Write Disabled\n\nValue on reset: 0"]
240#[derive(Clone, Copy, Debug, PartialEq, Eq)]
241pub enum CMNWP_A {
242    #[doc = "0: Write to the register is enabled"]
243    _0 = 0,
244    #[doc = "1: Write to the register is disabled"]
245    _1 = 1,
246}
247impl From<CMNWP_A> for bool {
248    #[inline(always)]
249    fn from(variant: CMNWP_A) -> Self {
250        variant as u8 != 0
251    }
252}
253impl CMNWP_R {
254    #[doc = "Get enumerated values variant"]
255    #[inline(always)]
256    pub fn variant(&self) -> CMNWP_A {
257        match self.bits {
258            false => CMNWP_A::_0,
259            true => CMNWP_A::_1,
260        }
261    }
262    #[doc = "Checks if the value of the field is `_0`"]
263    #[inline(always)]
264    pub fn is_0(&self) -> bool {
265        *self == CMNWP_A::_0
266    }
267    #[doc = "Checks if the value of the field is `_1`"]
268    #[inline(always)]
269    pub fn is_1(&self) -> bool {
270        *self == CMNWP_A::_1
271    }
272}
273#[doc = "Field `CMNWP` writer - Common Register Write Disabled"]
274pub type CMNWP_W<'a, const O: u8> = crate::BitWriter<'a, u32, GTWP_SPEC, CMNWP_A, O>;
275impl<'a, const O: u8> CMNWP_W<'a, O> {
276    #[doc = "Write to the register is enabled"]
277    #[inline(always)]
278    pub fn _0(self) -> &'a mut W {
279        self.variant(CMNWP_A::_0)
280    }
281    #[doc = "Write to the register is disabled"]
282    #[inline(always)]
283    pub fn _1(self) -> &'a mut W {
284        self.variant(CMNWP_A::_1)
285    }
286}
287#[doc = "Field `PRKEY` writer - GTWP Key Code"]
288pub type PRKEY_W<'a, const O: u8> = crate::FieldWriter<'a, u32, GTWP_SPEC, u8, u8, 8, O>;
289impl R {
290    #[doc = "Bit 0 - Register Write Disable"]
291    #[inline(always)]
292    pub fn wp(&self) -> WP_R {
293        WP_R::new((self.bits & 1) != 0)
294    }
295    #[doc = "Bit 1 - GTSTR.CSTRT Bit Write Disable"]
296    #[inline(always)]
297    pub fn strwp(&self) -> STRWP_R {
298        STRWP_R::new(((self.bits >> 1) & 1) != 0)
299    }
300    #[doc = "Bit 2 - GTSTP.CSTOP Bit Write Disable"]
301    #[inline(always)]
302    pub fn stpwp(&self) -> STPWP_R {
303        STPWP_R::new(((self.bits >> 2) & 1) != 0)
304    }
305    #[doc = "Bit 3 - GTCLR.CCLR Bit Write Disable"]
306    #[inline(always)]
307    pub fn clrwp(&self) -> CLRWP_R {
308        CLRWP_R::new(((self.bits >> 3) & 1) != 0)
309    }
310    #[doc = "Bit 4 - Common Register Write Disabled"]
311    #[inline(always)]
312    pub fn cmnwp(&self) -> CMNWP_R {
313        CMNWP_R::new(((self.bits >> 4) & 1) != 0)
314    }
315}
316impl W {
317    #[doc = "Bit 0 - Register Write Disable"]
318    #[inline(always)]
319    #[must_use]
320    pub fn wp(&mut self) -> WP_W<0> {
321        WP_W::new(self)
322    }
323    #[doc = "Bit 1 - GTSTR.CSTRT Bit Write Disable"]
324    #[inline(always)]
325    #[must_use]
326    pub fn strwp(&mut self) -> STRWP_W<1> {
327        STRWP_W::new(self)
328    }
329    #[doc = "Bit 2 - GTSTP.CSTOP Bit Write Disable"]
330    #[inline(always)]
331    #[must_use]
332    pub fn stpwp(&mut self) -> STPWP_W<2> {
333        STPWP_W::new(self)
334    }
335    #[doc = "Bit 3 - GTCLR.CCLR Bit Write Disable"]
336    #[inline(always)]
337    #[must_use]
338    pub fn clrwp(&mut self) -> CLRWP_W<3> {
339        CLRWP_W::new(self)
340    }
341    #[doc = "Bit 4 - Common Register Write Disabled"]
342    #[inline(always)]
343    #[must_use]
344    pub fn cmnwp(&mut self) -> CMNWP_W<4> {
345        CMNWP_W::new(self)
346    }
347    #[doc = "Bits 8:15 - GTWP Key Code"]
348    #[inline(always)]
349    #[must_use]
350    pub fn prkey(&mut self) -> PRKEY_W<8> {
351        PRKEY_W::new(self)
352    }
353    #[doc = "Writes raw bits to the register."]
354    #[inline(always)]
355    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
356        self.0.bits(bits);
357        self
358    }
359}
360#[doc = "General PWM Timer Write-Protection 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 [gtwp](index.html) module"]
361pub struct GTWP_SPEC;
362impl crate::RegisterSpec for GTWP_SPEC {
363    type Ux = u32;
364}
365#[doc = "`read()` method returns [gtwp::R](R) reader structure"]
366impl crate::Readable for GTWP_SPEC {
367    type Reader = R;
368}
369#[doc = "`write(|w| ..)` method takes [gtwp::W](W) writer structure"]
370impl crate::Writable for GTWP_SPEC {
371    type Writer = W;
372    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
373    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
374}
375#[doc = "`reset()` method sets GTWP to value 0"]
376impl crate::Resettable for GTWP_SPEC {
377    const RESET_VALUE: Self::Ux = 0;
378}