stm32wb_pac/crc/
cr.rs

1#[doc = "Reader of register CR"]
2pub type R = crate::R<u32, super::CR>;
3#[doc = "Writer for register CR"]
4pub type W = crate::W<u32, super::CR>;
5#[doc = "Register CR `reset()`'s with value 0"]
6impl crate::ResetValue for super::CR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `REV_OUT`"]
14pub type REV_OUT_R = crate::R<bool, bool>;
15#[doc = "Write proxy for field `REV_OUT`"]
16pub struct REV_OUT_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> REV_OUT_W<'a> {
20    #[doc = r"Sets the field bit"]
21    #[inline(always)]
22    pub fn set_bit(self) -> &'a mut W {
23        self.bit(true)
24    }
25    #[doc = r"Clears the field bit"]
26    #[inline(always)]
27    pub fn clear_bit(self) -> &'a mut W {
28        self.bit(false)
29    }
30    #[doc = r"Writes raw bits to the field"]
31    #[inline(always)]
32    pub fn bit(self, value: bool) -> &'a mut W {
33        self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
34        self.w
35    }
36}
37#[doc = "Reader of field `REV_IN`"]
38pub type REV_IN_R = crate::R<u8, u8>;
39#[doc = "Write proxy for field `REV_IN`"]
40pub struct REV_IN_W<'a> {
41    w: &'a mut W,
42}
43impl<'a> REV_IN_W<'a> {
44    #[doc = r"Writes raw bits to the field"]
45    #[inline(always)]
46    pub unsafe fn bits(self, value: u8) -> &'a mut W {
47        self.w.bits = (self.w.bits & !(0x03 << 5)) | (((value as u32) & 0x03) << 5);
48        self.w
49    }
50}
51#[doc = "Reader of field `POLYSIZE`"]
52pub type POLYSIZE_R = crate::R<u8, u8>;
53#[doc = "Write proxy for field `POLYSIZE`"]
54pub struct POLYSIZE_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> POLYSIZE_W<'a> {
58    #[doc = r"Writes raw bits to the field"]
59    #[inline(always)]
60    pub unsafe fn bits(self, value: u8) -> &'a mut W {
61        self.w.bits = (self.w.bits & !(0x03 << 3)) | (((value as u32) & 0x03) << 3);
62        self.w
63    }
64}
65#[doc = "Reader of field `RESET`"]
66pub type RESET_R = crate::R<bool, bool>;
67#[doc = "Write proxy for field `RESET`"]
68pub struct RESET_W<'a> {
69    w: &'a mut W,
70}
71impl<'a> RESET_W<'a> {
72    #[doc = r"Sets the field bit"]
73    #[inline(always)]
74    pub fn set_bit(self) -> &'a mut W {
75        self.bit(true)
76    }
77    #[doc = r"Clears the field bit"]
78    #[inline(always)]
79    pub fn clear_bit(self) -> &'a mut W {
80        self.bit(false)
81    }
82    #[doc = r"Writes raw bits to the field"]
83    #[inline(always)]
84    pub fn bit(self, value: bool) -> &'a mut W {
85        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
86        self.w
87    }
88}
89impl R {
90    #[doc = "Bit 7 - Reverse output data"]
91    #[inline(always)]
92    pub fn rev_out(&self) -> REV_OUT_R {
93        REV_OUT_R::new(((self.bits >> 7) & 0x01) != 0)
94    }
95    #[doc = "Bits 5:6 - Reverse input data"]
96    #[inline(always)]
97    pub fn rev_in(&self) -> REV_IN_R {
98        REV_IN_R::new(((self.bits >> 5) & 0x03) as u8)
99    }
100    #[doc = "Bits 3:4 - Polynomial size"]
101    #[inline(always)]
102    pub fn polysize(&self) -> POLYSIZE_R {
103        POLYSIZE_R::new(((self.bits >> 3) & 0x03) as u8)
104    }
105    #[doc = "Bit 0 - RESET bit"]
106    #[inline(always)]
107    pub fn reset(&self) -> RESET_R {
108        RESET_R::new((self.bits & 0x01) != 0)
109    }
110}
111impl W {
112    #[doc = "Bit 7 - Reverse output data"]
113    #[inline(always)]
114    pub fn rev_out(&mut self) -> REV_OUT_W {
115        REV_OUT_W { w: self }
116    }
117    #[doc = "Bits 5:6 - Reverse input data"]
118    #[inline(always)]
119    pub fn rev_in(&mut self) -> REV_IN_W {
120        REV_IN_W { w: self }
121    }
122    #[doc = "Bits 3:4 - Polynomial size"]
123    #[inline(always)]
124    pub fn polysize(&mut self) -> POLYSIZE_W {
125        POLYSIZE_W { w: self }
126    }
127    #[doc = "Bit 0 - RESET bit"]
128    #[inline(always)]
129    pub fn reset(&mut self) -> RESET_W {
130        RESET_W { w: self }
131    }
132}