mcxa_pac/can0/
fdcbt.rs

1#[doc = "Register `FDCBT` reader"]
2pub type R = crate::R<FdcbtSpec>;
3#[doc = "Register `FDCBT` writer"]
4pub type W = crate::W<FdcbtSpec>;
5#[doc = "Field `FPSEG2` reader - Fast Phase Segment 2"]
6pub type Fpseg2R = crate::FieldReader;
7#[doc = "Field `FPSEG2` writer - Fast Phase Segment 2"]
8pub type Fpseg2W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
9#[doc = "Field `FPSEG1` reader - Fast Phase Segment 1"]
10pub type Fpseg1R = crate::FieldReader;
11#[doc = "Field `FPSEG1` writer - Fast Phase Segment 1"]
12pub type Fpseg1W<'a, REG> = crate::FieldWriter<'a, REG, 3>;
13#[doc = "Field `FPROPSEG` reader - Fast Propagation Segment"]
14pub type FpropsegR = crate::FieldReader;
15#[doc = "Field `FPROPSEG` writer - Fast Propagation Segment"]
16pub type FpropsegW<'a, REG> = crate::FieldWriter<'a, REG, 5>;
17#[doc = "Field `FRJW` reader - Fast Resync Jump Width"]
18pub type FrjwR = crate::FieldReader;
19#[doc = "Field `FRJW` writer - Fast Resync Jump Width"]
20pub type FrjwW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
21#[doc = "Field `FPRESDIV` reader - Fast Prescaler Division Factor"]
22pub type FpresdivR = crate::FieldReader<u16>;
23#[doc = "Field `FPRESDIV` writer - Fast Prescaler Division Factor"]
24pub type FpresdivW<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>;
25impl R {
26    #[doc = "Bits 0:2 - Fast Phase Segment 2"]
27    #[inline(always)]
28    pub fn fpseg2(&self) -> Fpseg2R {
29        Fpseg2R::new((self.bits & 7) as u8)
30    }
31    #[doc = "Bits 5:7 - Fast Phase Segment 1"]
32    #[inline(always)]
33    pub fn fpseg1(&self) -> Fpseg1R {
34        Fpseg1R::new(((self.bits >> 5) & 7) as u8)
35    }
36    #[doc = "Bits 10:14 - Fast Propagation Segment"]
37    #[inline(always)]
38    pub fn fpropseg(&self) -> FpropsegR {
39        FpropsegR::new(((self.bits >> 10) & 0x1f) as u8)
40    }
41    #[doc = "Bits 16:18 - Fast Resync Jump Width"]
42    #[inline(always)]
43    pub fn frjw(&self) -> FrjwR {
44        FrjwR::new(((self.bits >> 16) & 7) as u8)
45    }
46    #[doc = "Bits 20:29 - Fast Prescaler Division Factor"]
47    #[inline(always)]
48    pub fn fpresdiv(&self) -> FpresdivR {
49        FpresdivR::new(((self.bits >> 20) & 0x03ff) as u16)
50    }
51}
52#[cfg(feature = "debug")]
53impl core::fmt::Debug for R {
54    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
55        f.debug_struct("FDCBT")
56            .field("fpseg2", &self.fpseg2())
57            .field("fpseg1", &self.fpseg1())
58            .field("fpropseg", &self.fpropseg())
59            .field("frjw", &self.frjw())
60            .field("fpresdiv", &self.fpresdiv())
61            .finish()
62    }
63}
64impl W {
65    #[doc = "Bits 0:2 - Fast Phase Segment 2"]
66    #[inline(always)]
67    pub fn fpseg2(&mut self) -> Fpseg2W<'_, FdcbtSpec> {
68        Fpseg2W::new(self, 0)
69    }
70    #[doc = "Bits 5:7 - Fast Phase Segment 1"]
71    #[inline(always)]
72    pub fn fpseg1(&mut self) -> Fpseg1W<'_, FdcbtSpec> {
73        Fpseg1W::new(self, 5)
74    }
75    #[doc = "Bits 10:14 - Fast Propagation Segment"]
76    #[inline(always)]
77    pub fn fpropseg(&mut self) -> FpropsegW<'_, FdcbtSpec> {
78        FpropsegW::new(self, 10)
79    }
80    #[doc = "Bits 16:18 - Fast Resync Jump Width"]
81    #[inline(always)]
82    pub fn frjw(&mut self) -> FrjwW<'_, FdcbtSpec> {
83        FrjwW::new(self, 16)
84    }
85    #[doc = "Bits 20:29 - Fast Prescaler Division Factor"]
86    #[inline(always)]
87    pub fn fpresdiv(&mut self) -> FpresdivW<'_, FdcbtSpec> {
88        FpresdivW::new(self, 20)
89    }
90}
91#[doc = "CAN FD Bit Timing\n\nYou can [`read`](crate::Reg::read) this register and get [`fdcbt::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`fdcbt::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
92pub struct FdcbtSpec;
93impl crate::RegisterSpec for FdcbtSpec {
94    type Ux = u32;
95}
96#[doc = "`read()` method returns [`fdcbt::R`](R) reader structure"]
97impl crate::Readable for FdcbtSpec {}
98#[doc = "`write(|w| ..)` method takes [`fdcbt::W`](W) writer structure"]
99impl crate::Writable for FdcbtSpec {
100    type Safety = crate::Unsafe;
101}
102#[doc = "`reset()` method sets FDCBT to value 0"]
103impl crate::Resettable for FdcbtSpec {}