ra6t2/canfd_b/
cfdgcfg.rs

1#[doc = "Register `CFDGCFG` reader"]
2pub struct R(crate::R<CFDGCFG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CFDGCFG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CFDGCFG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CFDGCFG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CFDGCFG` writer"]
17pub struct W(crate::W<CFDGCFG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CFDGCFG_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<CFDGCFG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CFDGCFG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TPRI` reader - Transmission Priority"]
38pub type TPRI_R = crate::BitReader<TPRI_A>;
39#[doc = "Transmission Priority\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum TPRI_A {
42    #[doc = "0: ID priority"]
43    _0 = 0,
44    #[doc = "1: Message buffer number priority"]
45    _1 = 1,
46}
47impl From<TPRI_A> for bool {
48    #[inline(always)]
49    fn from(variant: TPRI_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl TPRI_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> TPRI_A {
57        match self.bits {
58            false => TPRI_A::_0,
59            true => TPRI_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 == TPRI_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 == TPRI_A::_1
71    }
72}
73#[doc = "Field `TPRI` writer - Transmission Priority"]
74pub type TPRI_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFDGCFG_SPEC, TPRI_A, O>;
75impl<'a, const O: u8> TPRI_W<'a, O> {
76    #[doc = "ID priority"]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(TPRI_A::_0)
80    }
81    #[doc = "Message buffer number priority"]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(TPRI_A::_1)
85    }
86}
87#[doc = "Field `DCE` reader - DLC Check Enable"]
88pub type DCE_R = crate::BitReader<DCE_A>;
89#[doc = "DLC Check Enable\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum DCE_A {
92    #[doc = "0: DLC check disabled"]
93    _0 = 0,
94    #[doc = "1: DLC check enabled"]
95    _1 = 1,
96}
97impl From<DCE_A> for bool {
98    #[inline(always)]
99    fn from(variant: DCE_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl DCE_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> DCE_A {
107        match self.bits {
108            false => DCE_A::_0,
109            true => DCE_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 == DCE_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 == DCE_A::_1
121    }
122}
123#[doc = "Field `DCE` writer - DLC Check Enable"]
124pub type DCE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFDGCFG_SPEC, DCE_A, O>;
125impl<'a, const O: u8> DCE_W<'a, O> {
126    #[doc = "DLC check disabled"]
127    #[inline(always)]
128    pub fn _0(self) -> &'a mut W {
129        self.variant(DCE_A::_0)
130    }
131    #[doc = "DLC check enabled"]
132    #[inline(always)]
133    pub fn _1(self) -> &'a mut W {
134        self.variant(DCE_A::_1)
135    }
136}
137#[doc = "Field `DRE` reader - DLC Replacement Enable"]
138pub type DRE_R = crate::BitReader<DRE_A>;
139#[doc = "DLC Replacement Enable\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum DRE_A {
142    #[doc = "0: DLC replacement disabled"]
143    _0 = 0,
144    #[doc = "1: DLC replacement enabled"]
145    _1 = 1,
146}
147impl From<DRE_A> for bool {
148    #[inline(always)]
149    fn from(variant: DRE_A) -> Self {
150        variant as u8 != 0
151    }
152}
153impl DRE_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> DRE_A {
157        match self.bits {
158            false => DRE_A::_0,
159            true => DRE_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 == DRE_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 == DRE_A::_1
171    }
172}
173#[doc = "Field `DRE` writer - DLC Replacement Enable"]
174pub type DRE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFDGCFG_SPEC, DRE_A, O>;
175impl<'a, const O: u8> DRE_W<'a, O> {
176    #[doc = "DLC replacement disabled"]
177    #[inline(always)]
178    pub fn _0(self) -> &'a mut W {
179        self.variant(DRE_A::_0)
180    }
181    #[doc = "DLC replacement enabled"]
182    #[inline(always)]
183    pub fn _1(self) -> &'a mut W {
184        self.variant(DRE_A::_1)
185    }
186}
187#[doc = "Field `MME` reader - Mirror Mode Enable"]
188pub type MME_R = crate::BitReader<MME_A>;
189#[doc = "Mirror Mode Enable\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191pub enum MME_A {
192    #[doc = "0: Mirror mode disabled"]
193    _0 = 0,
194    #[doc = "1: Mirror mode enabled"]
195    _1 = 1,
196}
197impl From<MME_A> for bool {
198    #[inline(always)]
199    fn from(variant: MME_A) -> Self {
200        variant as u8 != 0
201    }
202}
203impl MME_R {
204    #[doc = "Get enumerated values variant"]
205    #[inline(always)]
206    pub fn variant(&self) -> MME_A {
207        match self.bits {
208            false => MME_A::_0,
209            true => MME_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 == MME_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 == MME_A::_1
221    }
222}
223#[doc = "Field `MME` writer - Mirror Mode Enable"]
224pub type MME_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFDGCFG_SPEC, MME_A, O>;
225impl<'a, const O: u8> MME_W<'a, O> {
226    #[doc = "Mirror mode disabled"]
227    #[inline(always)]
228    pub fn _0(self) -> &'a mut W {
229        self.variant(MME_A::_0)
230    }
231    #[doc = "Mirror mode enabled"]
232    #[inline(always)]
233    pub fn _1(self) -> &'a mut W {
234        self.variant(MME_A::_1)
235    }
236}
237#[doc = "Field `DCS` reader - Data Link Controller Clock Select"]
238pub type DCS_R = crate::BitReader<DCS_A>;
239#[doc = "Data Link Controller Clock Select\n\nValue on reset: 0"]
240#[derive(Clone, Copy, Debug, PartialEq, Eq)]
241pub enum DCS_A {
242    #[doc = "0: Internal clean clock"]
243    _0 = 0,
244    #[doc = "1: External clock source connected to CANMCLK pin"]
245    _1 = 1,
246}
247impl From<DCS_A> for bool {
248    #[inline(always)]
249    fn from(variant: DCS_A) -> Self {
250        variant as u8 != 0
251    }
252}
253impl DCS_R {
254    #[doc = "Get enumerated values variant"]
255    #[inline(always)]
256    pub fn variant(&self) -> DCS_A {
257        match self.bits {
258            false => DCS_A::_0,
259            true => DCS_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 == DCS_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 == DCS_A::_1
271    }
272}
273#[doc = "Field `DCS` writer - Data Link Controller Clock Select"]
274pub type DCS_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFDGCFG_SPEC, DCS_A, O>;
275impl<'a, const O: u8> DCS_W<'a, O> {
276    #[doc = "Internal clean clock"]
277    #[inline(always)]
278    pub fn _0(self) -> &'a mut W {
279        self.variant(DCS_A::_0)
280    }
281    #[doc = "External clock source connected to CANMCLK pin"]
282    #[inline(always)]
283    pub fn _1(self) -> &'a mut W {
284        self.variant(DCS_A::_1)
285    }
286}
287#[doc = "Field `CMPOC` reader - CANFD Message Payload Overflow Configuration"]
288pub type CMPOC_R = crate::BitReader<CMPOC_A>;
289#[doc = "CANFD Message Payload Overflow Configuration\n\nValue on reset: 0"]
290#[derive(Clone, Copy, Debug, PartialEq, Eq)]
291pub enum CMPOC_A {
292    #[doc = "0: Message is rejected"]
293    _0 = 0,
294    #[doc = "1: Message payload is cut to fit to configured message size"]
295    _1 = 1,
296}
297impl From<CMPOC_A> for bool {
298    #[inline(always)]
299    fn from(variant: CMPOC_A) -> Self {
300        variant as u8 != 0
301    }
302}
303impl CMPOC_R {
304    #[doc = "Get enumerated values variant"]
305    #[inline(always)]
306    pub fn variant(&self) -> CMPOC_A {
307        match self.bits {
308            false => CMPOC_A::_0,
309            true => CMPOC_A::_1,
310        }
311    }
312    #[doc = "Checks if the value of the field is `_0`"]
313    #[inline(always)]
314    pub fn is_0(&self) -> bool {
315        *self == CMPOC_A::_0
316    }
317    #[doc = "Checks if the value of the field is `_1`"]
318    #[inline(always)]
319    pub fn is_1(&self) -> bool {
320        *self == CMPOC_A::_1
321    }
322}
323#[doc = "Field `CMPOC` writer - CANFD Message Payload Overflow Configuration"]
324pub type CMPOC_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFDGCFG_SPEC, CMPOC_A, O>;
325impl<'a, const O: u8> CMPOC_W<'a, O> {
326    #[doc = "Message is rejected"]
327    #[inline(always)]
328    pub fn _0(self) -> &'a mut W {
329        self.variant(CMPOC_A::_0)
330    }
331    #[doc = "Message payload is cut to fit to configured message size"]
332    #[inline(always)]
333    pub fn _1(self) -> &'a mut W {
334        self.variant(CMPOC_A::_1)
335    }
336}
337#[doc = "Field `TSP` reader - Timestamp Prescaler"]
338pub type TSP_R = crate::FieldReader<u8, u8>;
339#[doc = "Field `TSP` writer - Timestamp Prescaler"]
340pub type TSP_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFDGCFG_SPEC, u8, u8, 4, O>;
341#[doc = "Field `TSSS` reader - Timestamp Source Select"]
342pub type TSSS_R = crate::BitReader<TSSS_A>;
343#[doc = "Timestamp Source Select\n\nValue on reset: 0"]
344#[derive(Clone, Copy, Debug, PartialEq, Eq)]
345pub enum TSSS_A {
346    #[doc = "0: Source clock for timestamp counter is peripheral clock"]
347    _0 = 0,
348    #[doc = "1: Source clock for timestamp counter is bit time clock"]
349    _1 = 1,
350}
351impl From<TSSS_A> for bool {
352    #[inline(always)]
353    fn from(variant: TSSS_A) -> Self {
354        variant as u8 != 0
355    }
356}
357impl TSSS_R {
358    #[doc = "Get enumerated values variant"]
359    #[inline(always)]
360    pub fn variant(&self) -> TSSS_A {
361        match self.bits {
362            false => TSSS_A::_0,
363            true => TSSS_A::_1,
364        }
365    }
366    #[doc = "Checks if the value of the field is `_0`"]
367    #[inline(always)]
368    pub fn is_0(&self) -> bool {
369        *self == TSSS_A::_0
370    }
371    #[doc = "Checks if the value of the field is `_1`"]
372    #[inline(always)]
373    pub fn is_1(&self) -> bool {
374        *self == TSSS_A::_1
375    }
376}
377#[doc = "Field `TSSS` writer - Timestamp Source Select"]
378pub type TSSS_W<'a, const O: u8> = crate::BitWriter<'a, u32, CFDGCFG_SPEC, TSSS_A, O>;
379impl<'a, const O: u8> TSSS_W<'a, O> {
380    #[doc = "Source clock for timestamp counter is peripheral clock"]
381    #[inline(always)]
382    pub fn _0(self) -> &'a mut W {
383        self.variant(TSSS_A::_0)
384    }
385    #[doc = "Source clock for timestamp counter is bit time clock"]
386    #[inline(always)]
387    pub fn _1(self) -> &'a mut W {
388        self.variant(TSSS_A::_1)
389    }
390}
391#[doc = "Field `ITRCP` reader - Interval Timer Reference Clock Prescaler"]
392pub type ITRCP_R = crate::FieldReader<u16, u16>;
393#[doc = "Field `ITRCP` writer - Interval Timer Reference Clock Prescaler"]
394pub type ITRCP_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CFDGCFG_SPEC, u16, u16, 16, O>;
395impl R {
396    #[doc = "Bit 0 - Transmission Priority"]
397    #[inline(always)]
398    pub fn tpri(&self) -> TPRI_R {
399        TPRI_R::new((self.bits & 1) != 0)
400    }
401    #[doc = "Bit 1 - DLC Check Enable"]
402    #[inline(always)]
403    pub fn dce(&self) -> DCE_R {
404        DCE_R::new(((self.bits >> 1) & 1) != 0)
405    }
406    #[doc = "Bit 2 - DLC Replacement Enable"]
407    #[inline(always)]
408    pub fn dre(&self) -> DRE_R {
409        DRE_R::new(((self.bits >> 2) & 1) != 0)
410    }
411    #[doc = "Bit 3 - Mirror Mode Enable"]
412    #[inline(always)]
413    pub fn mme(&self) -> MME_R {
414        MME_R::new(((self.bits >> 3) & 1) != 0)
415    }
416    #[doc = "Bit 4 - Data Link Controller Clock Select"]
417    #[inline(always)]
418    pub fn dcs(&self) -> DCS_R {
419        DCS_R::new(((self.bits >> 4) & 1) != 0)
420    }
421    #[doc = "Bit 5 - CANFD Message Payload Overflow Configuration"]
422    #[inline(always)]
423    pub fn cmpoc(&self) -> CMPOC_R {
424        CMPOC_R::new(((self.bits >> 5) & 1) != 0)
425    }
426    #[doc = "Bits 8:11 - Timestamp Prescaler"]
427    #[inline(always)]
428    pub fn tsp(&self) -> TSP_R {
429        TSP_R::new(((self.bits >> 8) & 0x0f) as u8)
430    }
431    #[doc = "Bit 12 - Timestamp Source Select"]
432    #[inline(always)]
433    pub fn tsss(&self) -> TSSS_R {
434        TSSS_R::new(((self.bits >> 12) & 1) != 0)
435    }
436    #[doc = "Bits 16:31 - Interval Timer Reference Clock Prescaler"]
437    #[inline(always)]
438    pub fn itrcp(&self) -> ITRCP_R {
439        ITRCP_R::new(((self.bits >> 16) & 0xffff) as u16)
440    }
441}
442impl W {
443    #[doc = "Bit 0 - Transmission Priority"]
444    #[inline(always)]
445    #[must_use]
446    pub fn tpri(&mut self) -> TPRI_W<0> {
447        TPRI_W::new(self)
448    }
449    #[doc = "Bit 1 - DLC Check Enable"]
450    #[inline(always)]
451    #[must_use]
452    pub fn dce(&mut self) -> DCE_W<1> {
453        DCE_W::new(self)
454    }
455    #[doc = "Bit 2 - DLC Replacement Enable"]
456    #[inline(always)]
457    #[must_use]
458    pub fn dre(&mut self) -> DRE_W<2> {
459        DRE_W::new(self)
460    }
461    #[doc = "Bit 3 - Mirror Mode Enable"]
462    #[inline(always)]
463    #[must_use]
464    pub fn mme(&mut self) -> MME_W<3> {
465        MME_W::new(self)
466    }
467    #[doc = "Bit 4 - Data Link Controller Clock Select"]
468    #[inline(always)]
469    #[must_use]
470    pub fn dcs(&mut self) -> DCS_W<4> {
471        DCS_W::new(self)
472    }
473    #[doc = "Bit 5 - CANFD Message Payload Overflow Configuration"]
474    #[inline(always)]
475    #[must_use]
476    pub fn cmpoc(&mut self) -> CMPOC_W<5> {
477        CMPOC_W::new(self)
478    }
479    #[doc = "Bits 8:11 - Timestamp Prescaler"]
480    #[inline(always)]
481    #[must_use]
482    pub fn tsp(&mut self) -> TSP_W<8> {
483        TSP_W::new(self)
484    }
485    #[doc = "Bit 12 - Timestamp Source Select"]
486    #[inline(always)]
487    #[must_use]
488    pub fn tsss(&mut self) -> TSSS_W<12> {
489        TSSS_W::new(self)
490    }
491    #[doc = "Bits 16:31 - Interval Timer Reference Clock Prescaler"]
492    #[inline(always)]
493    #[must_use]
494    pub fn itrcp(&mut self) -> ITRCP_W<16> {
495        ITRCP_W::new(self)
496    }
497    #[doc = "Writes raw bits to the register."]
498    #[inline(always)]
499    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
500        self.0.bits(bits);
501        self
502    }
503}
504#[doc = "Global Configuration 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 [cfdgcfg](index.html) module"]
505pub struct CFDGCFG_SPEC;
506impl crate::RegisterSpec for CFDGCFG_SPEC {
507    type Ux = u32;
508}
509#[doc = "`read()` method returns [cfdgcfg::R](R) reader structure"]
510impl crate::Readable for CFDGCFG_SPEC {
511    type Reader = R;
512}
513#[doc = "`write(|w| ..)` method takes [cfdgcfg::W](W) writer structure"]
514impl crate::Writable for CFDGCFG_SPEC {
515    type Writer = W;
516    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
517    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
518}
519#[doc = "`reset()` method sets CFDGCFG to value 0"]
520impl crate::Resettable for CFDGCFG_SPEC {
521    const RESET_VALUE: Self::Ux = 0;
522}