Skip to main content

mcxa_pac/can0/
eprs.rs

1#[doc = "Register `EPRS` reader"]
2pub type R = crate::R<EprsSpec>;
3#[doc = "Register `EPRS` writer"]
4pub type W = crate::W<EprsSpec>;
5#[doc = "Field `ENPRESDIV` reader - Extended Nominal Prescaler Division Factor"]
6pub type EnpresdivR = crate::FieldReader<u16>;
7#[doc = "Field `ENPRESDIV` writer - Extended Nominal Prescaler Division Factor"]
8pub type EnpresdivW<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>;
9#[doc = "Field `EDPRESDIV` reader - Extended Data Phase Prescaler Division Factor"]
10pub type EdpresdivR = crate::FieldReader<u16>;
11#[doc = "Field `EDPRESDIV` writer - Extended Data Phase Prescaler Division Factor"]
12pub type EdpresdivW<'a, REG> = crate::FieldWriter<'a, REG, 10, u16>;
13impl R {
14    #[doc = "Bits 0:9 - Extended Nominal Prescaler Division Factor"]
15    #[inline(always)]
16    pub fn enpresdiv(&self) -> EnpresdivR {
17        EnpresdivR::new((self.bits & 0x03ff) as u16)
18    }
19    #[doc = "Bits 16:25 - Extended Data Phase Prescaler Division Factor"]
20    #[inline(always)]
21    pub fn edpresdiv(&self) -> EdpresdivR {
22        EdpresdivR::new(((self.bits >> 16) & 0x03ff) as u16)
23    }
24}
25#[cfg(feature = "debug")]
26impl core::fmt::Debug for R {
27    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
28        f.debug_struct("EPRS")
29            .field("enpresdiv", &self.enpresdiv())
30            .field("edpresdiv", &self.edpresdiv())
31            .finish()
32    }
33}
34impl W {
35    #[doc = "Bits 0:9 - Extended Nominal Prescaler Division Factor"]
36    #[inline(always)]
37    pub fn enpresdiv(&mut self) -> EnpresdivW<'_, EprsSpec> {
38        EnpresdivW::new(self, 0)
39    }
40    #[doc = "Bits 16:25 - Extended Data Phase Prescaler Division Factor"]
41    #[inline(always)]
42    pub fn edpresdiv(&mut self) -> EdpresdivW<'_, EprsSpec> {
43        EdpresdivW::new(self, 16)
44    }
45}
46#[doc = "Enhanced CAN Bit Timing Prescalers\n\nYou can [`read`](crate::Reg::read) this register and get [`eprs::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`eprs::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
47pub struct EprsSpec;
48impl crate::RegisterSpec for EprsSpec {
49    type Ux = u32;
50}
51#[doc = "`read()` method returns [`eprs::R`](R) reader structure"]
52impl crate::Readable for EprsSpec {}
53#[doc = "`write(|w| ..)` method takes [`eprs::W`](W) writer structure"]
54impl crate::Writable for EprsSpec {
55    type Safety = crate::Unsafe;
56}
57#[doc = "`reset()` method sets EPRS to value 0"]
58impl crate::Resettable for EprsSpec {}