Skip to main content

k22f/can0/
id15.rs

1#[doc = "Reader of register ID15"]
2pub type R = crate::R<u32, super::ID15>;
3#[doc = "Writer for register ID15"]
4pub type W = crate::W<u32, super::ID15>;
5#[doc = "Register ID15 `reset()`'s with value 0"]
6impl crate::ResetValue for super::ID15 {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `EXT`"]
14pub type EXT_R = crate::R<u32, u32>;
15#[doc = "Write proxy for field `EXT`"]
16pub struct EXT_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> EXT_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u32) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0x0003_ffff) | ((value as u32) & 0x0003_ffff);
24        self.w
25    }
26}
27#[doc = "Reader of field `STD`"]
28pub type STD_R = crate::R<u16, u16>;
29#[doc = "Write proxy for field `STD`"]
30pub struct STD_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> STD_W<'a> {
34    #[doc = r"Writes raw bits to the field"]
35    #[inline(always)]
36    pub unsafe fn bits(self, value: u16) -> &'a mut W {
37        self.w.bits = (self.w.bits & !(0x07ff << 18)) | (((value as u32) & 0x07ff) << 18);
38        self.w
39    }
40}
41#[doc = "Reader of field `PRIO`"]
42pub type PRIO_R = crate::R<u8, u8>;
43#[doc = "Write proxy for field `PRIO`"]
44pub struct PRIO_W<'a> {
45    w: &'a mut W,
46}
47impl<'a> PRIO_W<'a> {
48    #[doc = r"Writes raw bits to the field"]
49    #[inline(always)]
50    pub unsafe fn bits(self, value: u8) -> &'a mut W {
51        self.w.bits = (self.w.bits & !(0x07 << 29)) | (((value as u32) & 0x07) << 29);
52        self.w
53    }
54}
55impl R {
56    #[doc = "Bits 0:17 - Contains extended (LOW word) identifier of message buffer."]
57    #[inline(always)]
58    pub fn ext(&self) -> EXT_R {
59        EXT_R::new((self.bits & 0x0003_ffff) as u32)
60    }
61    #[doc = "Bits 18:28 - Contains standard/extended (HIGH word) identifier of message buffer."]
62    #[inline(always)]
63    pub fn std(&self) -> STD_R {
64        STD_R::new(((self.bits >> 18) & 0x07ff) as u16)
65    }
66    #[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."]
67    #[inline(always)]
68    pub fn prio(&self) -> PRIO_R {
69        PRIO_R::new(((self.bits >> 29) & 0x07) as u8)
70    }
71}
72impl W {
73    #[doc = "Bits 0:17 - Contains extended (LOW word) identifier of message buffer."]
74    #[inline(always)]
75    pub fn ext(&mut self) -> EXT_W {
76        EXT_W { w: self }
77    }
78    #[doc = "Bits 18:28 - Contains standard/extended (HIGH word) identifier of message buffer."]
79    #[inline(always)]
80    pub fn std(&mut self) -> STD_W {
81        STD_W { w: self }
82    }
83    #[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."]
84    #[inline(always)]
85    pub fn prio(&mut self) -> PRIO_W {
86        PRIO_W { w: self }
87    }
88}