mcxa_pac/can0/
mb9_32b_id.rs

1#[doc = "Register `MB9_32B_ID` reader"]
2pub type R = crate::R<Mb9_32bIdSpec>;
3#[doc = "Register `MB9_32B_ID` writer"]
4pub type W = crate::W<Mb9_32bIdSpec>;
5#[doc = "Field `EXT` reader - Contains extended (LOW word) identifier of message buffer."]
6pub type ExtR = crate::FieldReader<u32>;
7#[doc = "Field `EXT` writer - Contains extended (LOW word) identifier of message buffer."]
8pub type ExtW<'a, REG> = crate::FieldWriter<'a, REG, 18, u32>;
9#[doc = "Field `STD` reader - Contains standard/extended (HIGH word) identifier of message buffer."]
10pub type StdR = crate::FieldReader<u16>;
11#[doc = "Field `STD` writer - Contains standard/extended (HIGH word) identifier of message buffer."]
12pub type StdW<'a, REG> = crate::FieldWriter<'a, REG, 11, u16>;
13#[doc = "Field `PRIO` reader - Local priority. This 3-bit fieldis only used when LPRIO_EN bit is set in MCR and it only makes sense for Tx buffers. These bits are not transmitted. They are appended to the regular ID to define the transmission priority."]
14pub type PrioR = crate::FieldReader;
15#[doc = "Field `PRIO` writer - Local priority. This 3-bit fieldis only used when LPRIO_EN bit is set in MCR and it only makes sense for Tx buffers. These bits are not transmitted. They are appended to the regular ID to define the transmission priority."]
16pub type PrioW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
17impl R {
18    #[doc = "Bits 0:17 - Contains extended (LOW word) identifier of message buffer."]
19    #[inline(always)]
20    pub fn ext(&self) -> ExtR {
21        ExtR::new(self.bits & 0x0003_ffff)
22    }
23    #[doc = "Bits 18:28 - Contains standard/extended (HIGH word) identifier of message buffer."]
24    #[inline(always)]
25    pub fn std(&self) -> StdR {
26        StdR::new(((self.bits >> 18) & 0x07ff) as u16)
27    }
28    #[doc = "Bits 29:31 - Local priority. This 3-bit fieldis only used when LPRIO_EN bit is set in MCR and it only makes sense for Tx buffers. These bits are not transmitted. They are appended to the regular ID to define the transmission priority."]
29    #[inline(always)]
30    pub fn prio(&self) -> PrioR {
31        PrioR::new(((self.bits >> 29) & 7) as u8)
32    }
33}
34#[cfg(feature = "debug")]
35impl core::fmt::Debug for R {
36    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
37        f.debug_struct("MB9_32B_ID")
38            .field("ext", &self.ext())
39            .field("std", &self.std())
40            .field("prio", &self.prio())
41            .finish()
42    }
43}
44impl W {
45    #[doc = "Bits 0:17 - Contains extended (LOW word) identifier of message buffer."]
46    #[inline(always)]
47    pub fn ext(&mut self) -> ExtW<'_, Mb9_32bIdSpec> {
48        ExtW::new(self, 0)
49    }
50    #[doc = "Bits 18:28 - Contains standard/extended (HIGH word) identifier of message buffer."]
51    #[inline(always)]
52    pub fn std(&mut self) -> StdW<'_, Mb9_32bIdSpec> {
53        StdW::new(self, 18)
54    }
55    #[doc = "Bits 29:31 - Local priority. This 3-bit fieldis only used when LPRIO_EN bit is set in MCR and it only makes sense for Tx buffers. These bits are not transmitted. They are appended to the regular ID to define the transmission priority."]
56    #[inline(always)]
57    pub fn prio(&mut self) -> PrioW<'_, Mb9_32bIdSpec> {
58        PrioW::new(self, 29)
59    }
60}
61#[doc = "Message Buffer 9 ID Register\n\nYou can [`read`](crate::Reg::read) this register and get [`mb9_32b_id::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`mb9_32b_id::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
62pub struct Mb9_32bIdSpec;
63impl crate::RegisterSpec for Mb9_32bIdSpec {
64    type Ux = u32;
65}
66#[doc = "`read()` method returns [`mb9_32b_id::R`](R) reader structure"]
67impl crate::Readable for Mb9_32bIdSpec {}
68#[doc = "`write(|w| ..)` method takes [`mb9_32b_id::W`](W) writer structure"]
69impl crate::Writable for Mb9_32bIdSpec {
70    type Safety = crate::Unsafe;
71}
72#[doc = "`reset()` method sets MB9_32B_ID to value 0"]
73impl crate::Resettable for Mb9_32bIdSpec {}