ra4e1/gpt164/
gtber.rs

1#[doc = "Register `GTBER` reader"]
2pub struct R(crate::R<GTBER_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<GTBER_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<GTBER_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<GTBER_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `GTBER` writer"]
17pub struct W(crate::W<GTBER_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<GTBER_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<GTBER_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<GTBER_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `BD0` reader - GTCCR Buffer Operation Disable"]
38pub type BD0_R = crate::BitReader<BD0_A>;
39#[doc = "GTCCR Buffer Operation Disable\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum BD0_A {
42    #[doc = "0: Buffer operation is enabled"]
43    _0 = 0,
44    #[doc = "1: Buffer operation is disabled"]
45    _1 = 1,
46}
47impl From<BD0_A> for bool {
48    #[inline(always)]
49    fn from(variant: BD0_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl BD0_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> BD0_A {
57        match self.bits {
58            false => BD0_A::_0,
59            true => BD0_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 == BD0_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 == BD0_A::_1
71    }
72}
73#[doc = "Field `BD0` writer - GTCCR Buffer Operation Disable"]
74pub type BD0_W<'a, const O: u8> = crate::BitWriter<'a, u32, GTBER_SPEC, BD0_A, O>;
75impl<'a, const O: u8> BD0_W<'a, O> {
76    #[doc = "Buffer operation is enabled"]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(BD0_A::_0)
80    }
81    #[doc = "Buffer operation is disabled"]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(BD0_A::_1)
85    }
86}
87#[doc = "Field `BD1` reader - GTPR Buffer Operation Disable"]
88pub type BD1_R = crate::BitReader<BD1_A>;
89#[doc = "GTPR Buffer Operation Disable\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum BD1_A {
92    #[doc = "0: Buffer operation is enabled"]
93    _0 = 0,
94    #[doc = "1: Buffer operation is disabled"]
95    _1 = 1,
96}
97impl From<BD1_A> for bool {
98    #[inline(always)]
99    fn from(variant: BD1_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl BD1_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> BD1_A {
107        match self.bits {
108            false => BD1_A::_0,
109            true => BD1_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 == BD1_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 == BD1_A::_1
121    }
122}
123#[doc = "Field `BD1` writer - GTPR Buffer Operation Disable"]
124pub type BD1_W<'a, const O: u8> = crate::BitWriter<'a, u32, GTBER_SPEC, BD1_A, O>;
125impl<'a, const O: u8> BD1_W<'a, O> {
126    #[doc = "Buffer operation is enabled"]
127    #[inline(always)]
128    pub fn _0(self) -> &'a mut W {
129        self.variant(BD1_A::_0)
130    }
131    #[doc = "Buffer operation is disabled"]
132    #[inline(always)]
133    pub fn _1(self) -> &'a mut W {
134        self.variant(BD1_A::_1)
135    }
136}
137#[doc = "Field `CCRA` reader - GTCCRA Buffer Operation"]
138pub type CCRA_R = crate::FieldReader<u8, CCRA_A>;
139#[doc = "GTCCRA Buffer Operation\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141#[repr(u8)]
142pub enum CCRA_A {
143    #[doc = "0: No buffer operation"]
144    _00 = 0,
145    #[doc = "1: Single buffer operation (GTCCRA <---->GTCCRC)"]
146    _01 = 1,
147}
148impl From<CCRA_A> for u8 {
149    #[inline(always)]
150    fn from(variant: CCRA_A) -> Self {
151        variant as _
152    }
153}
154impl CCRA_R {
155    #[doc = "Get enumerated values variant"]
156    #[inline(always)]
157    pub fn variant(&self) -> Option<CCRA_A> {
158        match self.bits {
159            0 => Some(CCRA_A::_00),
160            1 => Some(CCRA_A::_01),
161            _ => None,
162        }
163    }
164    #[doc = "Checks if the value of the field is `_00`"]
165    #[inline(always)]
166    pub fn is_00(&self) -> bool {
167        *self == CCRA_A::_00
168    }
169    #[doc = "Checks if the value of the field is `_01`"]
170    #[inline(always)]
171    pub fn is_01(&self) -> bool {
172        *self == CCRA_A::_01
173    }
174}
175#[doc = "Field `CCRA` writer - GTCCRA Buffer Operation"]
176pub type CCRA_W<'a, const O: u8> = crate::FieldWriter<'a, u32, GTBER_SPEC, u8, CCRA_A, 2, O>;
177impl<'a, const O: u8> CCRA_W<'a, O> {
178    #[doc = "No buffer operation"]
179    #[inline(always)]
180    pub fn _00(self) -> &'a mut W {
181        self.variant(CCRA_A::_00)
182    }
183    #[doc = "Single buffer operation (GTCCRA <---->GTCCRC)"]
184    #[inline(always)]
185    pub fn _01(self) -> &'a mut W {
186        self.variant(CCRA_A::_01)
187    }
188}
189#[doc = "Field `CCRB` reader - GTCCRB Buffer Operation"]
190pub type CCRB_R = crate::FieldReader<u8, CCRB_A>;
191#[doc = "GTCCRB Buffer Operation\n\nValue on reset: 0"]
192#[derive(Clone, Copy, Debug, PartialEq, Eq)]
193#[repr(u8)]
194pub enum CCRB_A {
195    #[doc = "0: No buffer operation"]
196    _00 = 0,
197    #[doc = "1: Single buffer operation (GTCCRB <----> GTCCRE)"]
198    _01 = 1,
199}
200impl From<CCRB_A> for u8 {
201    #[inline(always)]
202    fn from(variant: CCRB_A) -> Self {
203        variant as _
204    }
205}
206impl CCRB_R {
207    #[doc = "Get enumerated values variant"]
208    #[inline(always)]
209    pub fn variant(&self) -> Option<CCRB_A> {
210        match self.bits {
211            0 => Some(CCRB_A::_00),
212            1 => Some(CCRB_A::_01),
213            _ => None,
214        }
215    }
216    #[doc = "Checks if the value of the field is `_00`"]
217    #[inline(always)]
218    pub fn is_00(&self) -> bool {
219        *self == CCRB_A::_00
220    }
221    #[doc = "Checks if the value of the field is `_01`"]
222    #[inline(always)]
223    pub fn is_01(&self) -> bool {
224        *self == CCRB_A::_01
225    }
226}
227#[doc = "Field `CCRB` writer - GTCCRB Buffer Operation"]
228pub type CCRB_W<'a, const O: u8> = crate::FieldWriter<'a, u32, GTBER_SPEC, u8, CCRB_A, 2, O>;
229impl<'a, const O: u8> CCRB_W<'a, O> {
230    #[doc = "No buffer operation"]
231    #[inline(always)]
232    pub fn _00(self) -> &'a mut W {
233        self.variant(CCRB_A::_00)
234    }
235    #[doc = "Single buffer operation (GTCCRB <----> GTCCRE)"]
236    #[inline(always)]
237    pub fn _01(self) -> &'a mut W {
238        self.variant(CCRB_A::_01)
239    }
240}
241#[doc = "Field `PR` reader - GTPR Buffer Operation"]
242pub type PR_R = crate::FieldReader<u8, PR_A>;
243#[doc = "GTPR Buffer Operation\n\nValue on reset: 0"]
244#[derive(Clone, Copy, Debug, PartialEq, Eq)]
245#[repr(u8)]
246pub enum PR_A {
247    #[doc = "0: No buffer operation"]
248    _00 = 0,
249    #[doc = "1: Single buffer operation (GTPBR --> GTPR)"]
250    _01 = 1,
251}
252impl From<PR_A> for u8 {
253    #[inline(always)]
254    fn from(variant: PR_A) -> Self {
255        variant as _
256    }
257}
258impl PR_R {
259    #[doc = "Get enumerated values variant"]
260    #[inline(always)]
261    pub fn variant(&self) -> Option<PR_A> {
262        match self.bits {
263            0 => Some(PR_A::_00),
264            1 => Some(PR_A::_01),
265            _ => None,
266        }
267    }
268    #[doc = "Checks if the value of the field is `_00`"]
269    #[inline(always)]
270    pub fn is_00(&self) -> bool {
271        *self == PR_A::_00
272    }
273    #[doc = "Checks if the value of the field is `_01`"]
274    #[inline(always)]
275    pub fn is_01(&self) -> bool {
276        *self == PR_A::_01
277    }
278}
279#[doc = "Field `PR` writer - GTPR Buffer Operation"]
280pub type PR_W<'a, const O: u8> = crate::FieldWriter<'a, u32, GTBER_SPEC, u8, PR_A, 2, O>;
281impl<'a, const O: u8> PR_W<'a, O> {
282    #[doc = "No buffer operation"]
283    #[inline(always)]
284    pub fn _00(self) -> &'a mut W {
285        self.variant(PR_A::_00)
286    }
287    #[doc = "Single buffer operation (GTPBR --> GTPR)"]
288    #[inline(always)]
289    pub fn _01(self) -> &'a mut W {
290        self.variant(PR_A::_01)
291    }
292}
293#[doc = "Field `CCRSWT` writer - GTCCRA and GTCCRB Forcible Buffer Operation"]
294pub type CCRSWT_W<'a, const O: u8> = crate::BitWriter<'a, u32, GTBER_SPEC, bool, O>;
295impl R {
296    #[doc = "Bit 0 - GTCCR Buffer Operation Disable"]
297    #[inline(always)]
298    pub fn bd0(&self) -> BD0_R {
299        BD0_R::new((self.bits & 1) != 0)
300    }
301    #[doc = "Bit 1 - GTPR Buffer Operation Disable"]
302    #[inline(always)]
303    pub fn bd1(&self) -> BD1_R {
304        BD1_R::new(((self.bits >> 1) & 1) != 0)
305    }
306    #[doc = "Bits 16:17 - GTCCRA Buffer Operation"]
307    #[inline(always)]
308    pub fn ccra(&self) -> CCRA_R {
309        CCRA_R::new(((self.bits >> 16) & 3) as u8)
310    }
311    #[doc = "Bits 18:19 - GTCCRB Buffer Operation"]
312    #[inline(always)]
313    pub fn ccrb(&self) -> CCRB_R {
314        CCRB_R::new(((self.bits >> 18) & 3) as u8)
315    }
316    #[doc = "Bits 20:21 - GTPR Buffer Operation"]
317    #[inline(always)]
318    pub fn pr(&self) -> PR_R {
319        PR_R::new(((self.bits >> 20) & 3) as u8)
320    }
321}
322impl W {
323    #[doc = "Bit 0 - GTCCR Buffer Operation Disable"]
324    #[inline(always)]
325    #[must_use]
326    pub fn bd0(&mut self) -> BD0_W<0> {
327        BD0_W::new(self)
328    }
329    #[doc = "Bit 1 - GTPR Buffer Operation Disable"]
330    #[inline(always)]
331    #[must_use]
332    pub fn bd1(&mut self) -> BD1_W<1> {
333        BD1_W::new(self)
334    }
335    #[doc = "Bits 16:17 - GTCCRA Buffer Operation"]
336    #[inline(always)]
337    #[must_use]
338    pub fn ccra(&mut self) -> CCRA_W<16> {
339        CCRA_W::new(self)
340    }
341    #[doc = "Bits 18:19 - GTCCRB Buffer Operation"]
342    #[inline(always)]
343    #[must_use]
344    pub fn ccrb(&mut self) -> CCRB_W<18> {
345        CCRB_W::new(self)
346    }
347    #[doc = "Bits 20:21 - GTPR Buffer Operation"]
348    #[inline(always)]
349    #[must_use]
350    pub fn pr(&mut self) -> PR_W<20> {
351        PR_W::new(self)
352    }
353    #[doc = "Bit 22 - GTCCRA and GTCCRB Forcible Buffer Operation"]
354    #[inline(always)]
355    #[must_use]
356    pub fn ccrswt(&mut self) -> CCRSWT_W<22> {
357        CCRSWT_W::new(self)
358    }
359    #[doc = "Writes raw bits to the register."]
360    #[inline(always)]
361    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
362        self.0.bits(bits);
363        self
364    }
365}
366#[doc = "General PWM Timer Buffer Enable 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 [gtber](index.html) module"]
367pub struct GTBER_SPEC;
368impl crate::RegisterSpec for GTBER_SPEC {
369    type Ux = u32;
370}
371#[doc = "`read()` method returns [gtber::R](R) reader structure"]
372impl crate::Readable for GTBER_SPEC {
373    type Reader = R;
374}
375#[doc = "`write(|w| ..)` method takes [gtber::W](W) writer structure"]
376impl crate::Writable for GTBER_SPEC {
377    type Writer = W;
378    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
379    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
380}
381#[doc = "`reset()` method sets GTBER to value 0"]
382impl crate::Resettable for GTBER_SPEC {
383    const RESET_VALUE: Self::Ux = 0;
384}