Skip to main content

ra2e2/i3c/
tmoctl.rs

1#[doc = "Register `TMOCTL` reader"]
2pub struct R(crate::R<TMOCTL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<TMOCTL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<TMOCTL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<TMOCTL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `TMOCTL` writer"]
17pub struct W(crate::W<TMOCTL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<TMOCTL_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<TMOCTL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<TMOCTL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TODTS` reader - Timeout Detection Time Selection"]
38pub type TODTS_R = crate::FieldReader<u8, TODTS_A>;
39#[doc = "Timeout Detection Time Selection\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum TODTS_A {
43    #[doc = "0: 16bit-timeout"]
44    _00 = 0,
45    #[doc = "1: 14bit-timeout"]
46    _01 = 1,
47    #[doc = "2: 8bit-timeout"]
48    _10 = 2,
49    #[doc = "3: 6bit-timeout"]
50    _11 = 3,
51}
52impl From<TODTS_A> for u8 {
53    #[inline(always)]
54    fn from(variant: TODTS_A) -> Self {
55        variant as _
56    }
57}
58impl TODTS_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> TODTS_A {
62        match self.bits {
63            0 => TODTS_A::_00,
64            1 => TODTS_A::_01,
65            2 => TODTS_A::_10,
66            3 => TODTS_A::_11,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `_00`"]
71    #[inline(always)]
72    pub fn is_00(&self) -> bool {
73        *self == TODTS_A::_00
74    }
75    #[doc = "Checks if the value of the field is `_01`"]
76    #[inline(always)]
77    pub fn is_01(&self) -> bool {
78        *self == TODTS_A::_01
79    }
80    #[doc = "Checks if the value of the field is `_10`"]
81    #[inline(always)]
82    pub fn is_10(&self) -> bool {
83        *self == TODTS_A::_10
84    }
85    #[doc = "Checks if the value of the field is `_11`"]
86    #[inline(always)]
87    pub fn is_11(&self) -> bool {
88        *self == TODTS_A::_11
89    }
90}
91#[doc = "Field `TODTS` writer - Timeout Detection Time Selection"]
92pub type TODTS_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, TMOCTL_SPEC, u8, TODTS_A, 2, O>;
93impl<'a, const O: u8> TODTS_W<'a, O> {
94    #[doc = "16bit-timeout"]
95    #[inline(always)]
96    pub fn _00(self) -> &'a mut W {
97        self.variant(TODTS_A::_00)
98    }
99    #[doc = "14bit-timeout"]
100    #[inline(always)]
101    pub fn _01(self) -> &'a mut W {
102        self.variant(TODTS_A::_01)
103    }
104    #[doc = "8bit-timeout"]
105    #[inline(always)]
106    pub fn _10(self) -> &'a mut W {
107        self.variant(TODTS_A::_10)
108    }
109    #[doc = "6bit-timeout"]
110    #[inline(always)]
111    pub fn _11(self) -> &'a mut W {
112        self.variant(TODTS_A::_11)
113    }
114}
115#[doc = "Field `TOLCTL` reader - Timeout L Count Control"]
116pub type TOLCTL_R = crate::BitReader<TOLCTL_A>;
117#[doc = "Timeout L Count Control\n\nValue on reset: 1"]
118#[derive(Clone, Copy, Debug, PartialEq, Eq)]
119pub enum TOLCTL_A {
120    #[doc = "0: Count is disabled while the SCLn line is at a low level."]
121    _0 = 0,
122    #[doc = "1: Count is enabled while the SCLn line is at a low level."]
123    _1 = 1,
124}
125impl From<TOLCTL_A> for bool {
126    #[inline(always)]
127    fn from(variant: TOLCTL_A) -> Self {
128        variant as u8 != 0
129    }
130}
131impl TOLCTL_R {
132    #[doc = "Get enumerated values variant"]
133    #[inline(always)]
134    pub fn variant(&self) -> TOLCTL_A {
135        match self.bits {
136            false => TOLCTL_A::_0,
137            true => TOLCTL_A::_1,
138        }
139    }
140    #[doc = "Checks if the value of the field is `_0`"]
141    #[inline(always)]
142    pub fn is_0(&self) -> bool {
143        *self == TOLCTL_A::_0
144    }
145    #[doc = "Checks if the value of the field is `_1`"]
146    #[inline(always)]
147    pub fn is_1(&self) -> bool {
148        *self == TOLCTL_A::_1
149    }
150}
151#[doc = "Field `TOLCTL` writer - Timeout L Count Control"]
152pub type TOLCTL_W<'a, const O: u8> = crate::BitWriter<'a, u32, TMOCTL_SPEC, TOLCTL_A, O>;
153impl<'a, const O: u8> TOLCTL_W<'a, O> {
154    #[doc = "Count is disabled while the SCLn line is at a low level."]
155    #[inline(always)]
156    pub fn _0(self) -> &'a mut W {
157        self.variant(TOLCTL_A::_0)
158    }
159    #[doc = "Count is enabled while the SCLn line is at a low level."]
160    #[inline(always)]
161    pub fn _1(self) -> &'a mut W {
162        self.variant(TOLCTL_A::_1)
163    }
164}
165#[doc = "Field `TOHCTL` reader - Timeout H Count Control"]
166pub type TOHCTL_R = crate::BitReader<TOHCTL_A>;
167#[doc = "Timeout H Count Control\n\nValue on reset: 1"]
168#[derive(Clone, Copy, Debug, PartialEq, Eq)]
169pub enum TOHCTL_A {
170    #[doc = "0: Count is disabled while the SCLn line is at a high level."]
171    _0 = 0,
172    #[doc = "1: Count is enabled while the SCLn line is at a high level."]
173    _1 = 1,
174}
175impl From<TOHCTL_A> for bool {
176    #[inline(always)]
177    fn from(variant: TOHCTL_A) -> Self {
178        variant as u8 != 0
179    }
180}
181impl TOHCTL_R {
182    #[doc = "Get enumerated values variant"]
183    #[inline(always)]
184    pub fn variant(&self) -> TOHCTL_A {
185        match self.bits {
186            false => TOHCTL_A::_0,
187            true => TOHCTL_A::_1,
188        }
189    }
190    #[doc = "Checks if the value of the field is `_0`"]
191    #[inline(always)]
192    pub fn is_0(&self) -> bool {
193        *self == TOHCTL_A::_0
194    }
195    #[doc = "Checks if the value of the field is `_1`"]
196    #[inline(always)]
197    pub fn is_1(&self) -> bool {
198        *self == TOHCTL_A::_1
199    }
200}
201#[doc = "Field `TOHCTL` writer - Timeout H Count Control"]
202pub type TOHCTL_W<'a, const O: u8> = crate::BitWriter<'a, u32, TMOCTL_SPEC, TOHCTL_A, O>;
203impl<'a, const O: u8> TOHCTL_W<'a, O> {
204    #[doc = "Count is disabled while the SCLn line is at a high level."]
205    #[inline(always)]
206    pub fn _0(self) -> &'a mut W {
207        self.variant(TOHCTL_A::_0)
208    }
209    #[doc = "Count is enabled while the SCLn line is at a high level."]
210    #[inline(always)]
211    pub fn _1(self) -> &'a mut W {
212        self.variant(TOHCTL_A::_1)
213    }
214}
215#[doc = "Field `TOMDS` reader - Timeout Operation Mode Selection"]
216pub type TOMDS_R = crate::FieldReader<u8, TOMDS_A>;
217#[doc = "Timeout Operation Mode Selection\n\nValue on reset: 0"]
218#[derive(Clone, Copy, Debug, PartialEq, Eq)]
219#[repr(u8)]
220pub enum TOMDS_A {
221    #[doc = "0: Timeout is detected during the following conditions: The bus is busy (BCST.BFREF = 0) in master mode.I3C’s own slave address is detected and the bus is busy in slave mode.The bus is free (BCST.BFREF = 1) while generation of a START condition is requested (CNDCTL.STCND = 1)."]
222    _00 = 0,
223    #[doc = "1: Timeout is detected while the bus is busy."]
224    _01 = 1,
225    #[doc = "2: Timeout is detected while the bus is free."]
226    _10 = 2,
227    #[doc = "3: Setting prohibited"]
228    _11 = 3,
229}
230impl From<TOMDS_A> for u8 {
231    #[inline(always)]
232    fn from(variant: TOMDS_A) -> Self {
233        variant as _
234    }
235}
236impl TOMDS_R {
237    #[doc = "Get enumerated values variant"]
238    #[inline(always)]
239    pub fn variant(&self) -> TOMDS_A {
240        match self.bits {
241            0 => TOMDS_A::_00,
242            1 => TOMDS_A::_01,
243            2 => TOMDS_A::_10,
244            3 => TOMDS_A::_11,
245            _ => unreachable!(),
246        }
247    }
248    #[doc = "Checks if the value of the field is `_00`"]
249    #[inline(always)]
250    pub fn is_00(&self) -> bool {
251        *self == TOMDS_A::_00
252    }
253    #[doc = "Checks if the value of the field is `_01`"]
254    #[inline(always)]
255    pub fn is_01(&self) -> bool {
256        *self == TOMDS_A::_01
257    }
258    #[doc = "Checks if the value of the field is `_10`"]
259    #[inline(always)]
260    pub fn is_10(&self) -> bool {
261        *self == TOMDS_A::_10
262    }
263    #[doc = "Checks if the value of the field is `_11`"]
264    #[inline(always)]
265    pub fn is_11(&self) -> bool {
266        *self == TOMDS_A::_11
267    }
268}
269#[doc = "Field `TOMDS` writer - Timeout Operation Mode Selection"]
270pub type TOMDS_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, TMOCTL_SPEC, u8, TOMDS_A, 2, O>;
271impl<'a, const O: u8> TOMDS_W<'a, O> {
272    #[doc = "Timeout is detected during the following conditions: The bus is busy (BCST.BFREF = 0) in master mode.I3C’s own slave address is detected and the bus is busy in slave mode.The bus is free (BCST.BFREF = 1) while generation of a START condition is requested (CNDCTL.STCND = 1)."]
273    #[inline(always)]
274    pub fn _00(self) -> &'a mut W {
275        self.variant(TOMDS_A::_00)
276    }
277    #[doc = "Timeout is detected while the bus is busy."]
278    #[inline(always)]
279    pub fn _01(self) -> &'a mut W {
280        self.variant(TOMDS_A::_01)
281    }
282    #[doc = "Timeout is detected while the bus is free."]
283    #[inline(always)]
284    pub fn _10(self) -> &'a mut W {
285        self.variant(TOMDS_A::_10)
286    }
287    #[doc = "Setting prohibited"]
288    #[inline(always)]
289    pub fn _11(self) -> &'a mut W {
290        self.variant(TOMDS_A::_11)
291    }
292}
293impl R {
294    #[doc = "Bits 0:1 - Timeout Detection Time Selection"]
295    #[inline(always)]
296    pub fn todts(&self) -> TODTS_R {
297        TODTS_R::new((self.bits & 3) as u8)
298    }
299    #[doc = "Bit 4 - Timeout L Count Control"]
300    #[inline(always)]
301    pub fn tolctl(&self) -> TOLCTL_R {
302        TOLCTL_R::new(((self.bits >> 4) & 1) != 0)
303    }
304    #[doc = "Bit 5 - Timeout H Count Control"]
305    #[inline(always)]
306    pub fn tohctl(&self) -> TOHCTL_R {
307        TOHCTL_R::new(((self.bits >> 5) & 1) != 0)
308    }
309    #[doc = "Bits 6:7 - Timeout Operation Mode Selection"]
310    #[inline(always)]
311    pub fn tomds(&self) -> TOMDS_R {
312        TOMDS_R::new(((self.bits >> 6) & 3) as u8)
313    }
314}
315impl W {
316    #[doc = "Bits 0:1 - Timeout Detection Time Selection"]
317    #[inline(always)]
318    #[must_use]
319    pub fn todts(&mut self) -> TODTS_W<0> {
320        TODTS_W::new(self)
321    }
322    #[doc = "Bit 4 - Timeout L Count Control"]
323    #[inline(always)]
324    #[must_use]
325    pub fn tolctl(&mut self) -> TOLCTL_W<4> {
326        TOLCTL_W::new(self)
327    }
328    #[doc = "Bit 5 - Timeout H Count Control"]
329    #[inline(always)]
330    #[must_use]
331    pub fn tohctl(&mut self) -> TOHCTL_W<5> {
332        TOHCTL_W::new(self)
333    }
334    #[doc = "Bits 6:7 - Timeout Operation Mode Selection"]
335    #[inline(always)]
336    #[must_use]
337    pub fn tomds(&mut self) -> TOMDS_W<6> {
338        TOMDS_W::new(self)
339    }
340    #[doc = "Writes raw bits to the register."]
341    #[inline(always)]
342    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
343        self.0.bits(bits);
344        self
345    }
346}
347#[doc = "Timeout Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [tmoctl](index.html) module"]
348pub struct TMOCTL_SPEC;
349impl crate::RegisterSpec for TMOCTL_SPEC {
350    type Ux = u32;
351}
352#[doc = "`read()` method returns [tmoctl::R](R) reader structure"]
353impl crate::Readable for TMOCTL_SPEC {
354    type Reader = R;
355}
356#[doc = "`write(|w| ..)` method takes [tmoctl::W](W) writer structure"]
357impl crate::Writable for TMOCTL_SPEC {
358    type Writer = W;
359    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
360    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
361}
362#[doc = "`reset()` method sets TMOCTL to value 0x30"]
363impl crate::Resettable for TMOCTL_SPEC {
364    const RESET_VALUE: Self::Ux = 0x30;
365}