stm32wb_pac/i2c1/
timeoutr.rs

1#[doc = "Reader of register TIMEOUTR"]
2pub type R = crate::R<u32, super::TIMEOUTR>;
3#[doc = "Writer for register TIMEOUTR"]
4pub type W = crate::W<u32, super::TIMEOUTR>;
5#[doc = "Register TIMEOUTR `reset()`'s with value 0"]
6impl crate::ResetValue for super::TIMEOUTR {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `TIMEOUTA`"]
14pub type TIMEOUTA_R = crate::R<u16, u16>;
15#[doc = "Write proxy for field `TIMEOUTA`"]
16pub struct TIMEOUTA_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> TIMEOUTA_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u16) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0x0fff) | ((value as u32) & 0x0fff);
24        self.w
25    }
26}
27#[doc = "Reader of field `TIDLE`"]
28pub type TIDLE_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `TIDLE`"]
30pub struct TIDLE_W<'a> {
31    w: &'a mut W,
32}
33impl<'a> TIDLE_W<'a> {
34    #[doc = r"Sets the field bit"]
35    #[inline(always)]
36    pub fn set_bit(self) -> &'a mut W {
37        self.bit(true)
38    }
39    #[doc = r"Clears the field bit"]
40    #[inline(always)]
41    pub fn clear_bit(self) -> &'a mut W {
42        self.bit(false)
43    }
44    #[doc = r"Writes raw bits to the field"]
45    #[inline(always)]
46    pub fn bit(self, value: bool) -> &'a mut W {
47        self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12);
48        self.w
49    }
50}
51#[doc = "Reader of field `TIMOUTEN`"]
52pub type TIMOUTEN_R = crate::R<bool, bool>;
53#[doc = "Write proxy for field `TIMOUTEN`"]
54pub struct TIMOUTEN_W<'a> {
55    w: &'a mut W,
56}
57impl<'a> TIMOUTEN_W<'a> {
58    #[doc = r"Sets the field bit"]
59    #[inline(always)]
60    pub fn set_bit(self) -> &'a mut W {
61        self.bit(true)
62    }
63    #[doc = r"Clears the field bit"]
64    #[inline(always)]
65    pub fn clear_bit(self) -> &'a mut W {
66        self.bit(false)
67    }
68    #[doc = r"Writes raw bits to the field"]
69    #[inline(always)]
70    pub fn bit(self, value: bool) -> &'a mut W {
71        self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15);
72        self.w
73    }
74}
75#[doc = "Reader of field `TIMEOUTB`"]
76pub type TIMEOUTB_R = crate::R<u16, u16>;
77#[doc = "Write proxy for field `TIMEOUTB`"]
78pub struct TIMEOUTB_W<'a> {
79    w: &'a mut W,
80}
81impl<'a> TIMEOUTB_W<'a> {
82    #[doc = r"Writes raw bits to the field"]
83    #[inline(always)]
84    pub unsafe fn bits(self, value: u16) -> &'a mut W {
85        self.w.bits = (self.w.bits & !(0x0fff << 16)) | (((value as u32) & 0x0fff) << 16);
86        self.w
87    }
88}
89#[doc = "Reader of field `TEXTEN`"]
90pub type TEXTEN_R = crate::R<bool, bool>;
91#[doc = "Write proxy for field `TEXTEN`"]
92pub struct TEXTEN_W<'a> {
93    w: &'a mut W,
94}
95impl<'a> TEXTEN_W<'a> {
96    #[doc = r"Sets the field bit"]
97    #[inline(always)]
98    pub fn set_bit(self) -> &'a mut W {
99        self.bit(true)
100    }
101    #[doc = r"Clears the field bit"]
102    #[inline(always)]
103    pub fn clear_bit(self) -> &'a mut W {
104        self.bit(false)
105    }
106    #[doc = r"Writes raw bits to the field"]
107    #[inline(always)]
108    pub fn bit(self, value: bool) -> &'a mut W {
109        self.w.bits = (self.w.bits & !(0x01 << 31)) | (((value as u32) & 0x01) << 31);
110        self.w
111    }
112}
113impl R {
114    #[doc = "Bits 0:11 - Bus timeout A"]
115    #[inline(always)]
116    pub fn timeouta(&self) -> TIMEOUTA_R {
117        TIMEOUTA_R::new((self.bits & 0x0fff) as u16)
118    }
119    #[doc = "Bit 12 - Idle clock timeout detection"]
120    #[inline(always)]
121    pub fn tidle(&self) -> TIDLE_R {
122        TIDLE_R::new(((self.bits >> 12) & 0x01) != 0)
123    }
124    #[doc = "Bit 15 - Clock timeout enable"]
125    #[inline(always)]
126    pub fn timouten(&self) -> TIMOUTEN_R {
127        TIMOUTEN_R::new(((self.bits >> 15) & 0x01) != 0)
128    }
129    #[doc = "Bits 16:27 - Bus timeout B"]
130    #[inline(always)]
131    pub fn timeoutb(&self) -> TIMEOUTB_R {
132        TIMEOUTB_R::new(((self.bits >> 16) & 0x0fff) as u16)
133    }
134    #[doc = "Bit 31 - Extended clock timeout enable"]
135    #[inline(always)]
136    pub fn texten(&self) -> TEXTEN_R {
137        TEXTEN_R::new(((self.bits >> 31) & 0x01) != 0)
138    }
139}
140impl W {
141    #[doc = "Bits 0:11 - Bus timeout A"]
142    #[inline(always)]
143    pub fn timeouta(&mut self) -> TIMEOUTA_W {
144        TIMEOUTA_W { w: self }
145    }
146    #[doc = "Bit 12 - Idle clock timeout detection"]
147    #[inline(always)]
148    pub fn tidle(&mut self) -> TIDLE_W {
149        TIDLE_W { w: self }
150    }
151    #[doc = "Bit 15 - Clock timeout enable"]
152    #[inline(always)]
153    pub fn timouten(&mut self) -> TIMOUTEN_W {
154        TIMOUTEN_W { w: self }
155    }
156    #[doc = "Bits 16:27 - Bus timeout B"]
157    #[inline(always)]
158    pub fn timeoutb(&mut self) -> TIMEOUTB_W {
159        TIMEOUTB_W { w: self }
160    }
161    #[doc = "Bit 31 - Extended clock timeout enable"]
162    #[inline(always)]
163    pub fn texten(&mut self) -> TEXTEN_W {
164        TEXTEN_W { w: self }
165    }
166}