ra6t1/iic0/
icsr2.rs

1#[doc = "Register `ICSR2` reader"]
2pub struct R(crate::R<ICSR2_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ICSR2_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ICSR2_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ICSR2_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `ICSR2` writer"]
17pub struct W(crate::W<ICSR2_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ICSR2_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<ICSR2_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ICSR2_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TMOF` reader - Timeout Detection Flag\n\nThe field is **modified** in some way after a read operation."]
38pub type TMOF_R = crate::BitReader<TMOF_A>;
39#[doc = "Timeout Detection Flag\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum TMOF_A {
42    #[doc = "0: Timeout is not detected."]
43    _0 = 0,
44    #[doc = "1: Timeout is detected."]
45    _1 = 1,
46}
47impl From<TMOF_A> for bool {
48    #[inline(always)]
49    fn from(variant: TMOF_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl TMOF_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> TMOF_A {
57        match self.bits {
58            false => TMOF_A::_0,
59            true => TMOF_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == TMOF_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == TMOF_A::_1
71    }
72}
73#[doc = "Field `TMOF` writer - Timeout Detection Flag"]
74pub type TMOF_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, ICSR2_SPEC, TMOF_A, O>;
75impl<'a, const O: u8> TMOF_W<'a, O> {
76    #[doc = "Timeout is not detected."]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(TMOF_A::_0)
80    }
81    #[doc = "Timeout is detected."]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(TMOF_A::_1)
85    }
86}
87#[doc = "Field `AL` reader - Arbitration-Lost Flag\n\nThe field is **modified** in some way after a read operation."]
88pub type AL_R = crate::BitReader<AL_A>;
89#[doc = "Arbitration-Lost Flag\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum AL_A {
92    #[doc = "0: Arbitration is not lost."]
93    _0 = 0,
94    #[doc = "1: Arbitration is lost."]
95    _1 = 1,
96}
97impl From<AL_A> for bool {
98    #[inline(always)]
99    fn from(variant: AL_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl AL_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> AL_A {
107        match self.bits {
108            false => AL_A::_0,
109            true => AL_A::_1,
110        }
111    }
112    #[doc = "Checks if the value of the field is `_0`"]
113    #[inline(always)]
114    pub fn is_0(&self) -> bool {
115        *self == AL_A::_0
116    }
117    #[doc = "Checks if the value of the field is `_1`"]
118    #[inline(always)]
119    pub fn is_1(&self) -> bool {
120        *self == AL_A::_1
121    }
122}
123#[doc = "Field `AL` writer - Arbitration-Lost Flag"]
124pub type AL_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, ICSR2_SPEC, AL_A, O>;
125impl<'a, const O: u8> AL_W<'a, O> {
126    #[doc = "Arbitration is not lost."]
127    #[inline(always)]
128    pub fn _0(self) -> &'a mut W {
129        self.variant(AL_A::_0)
130    }
131    #[doc = "Arbitration is lost."]
132    #[inline(always)]
133    pub fn _1(self) -> &'a mut W {
134        self.variant(AL_A::_1)
135    }
136}
137#[doc = "Field `START` reader - Start Condition Detection Flag\n\nThe field is **modified** in some way after a read operation."]
138pub type START_R = crate::BitReader<START_A>;
139#[doc = "Start Condition Detection Flag\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum START_A {
142    #[doc = "0: Start condition is not detected."]
143    _0 = 0,
144    #[doc = "1: Start condition is detected."]
145    _1 = 1,
146}
147impl From<START_A> for bool {
148    #[inline(always)]
149    fn from(variant: START_A) -> Self {
150        variant as u8 != 0
151    }
152}
153impl START_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> START_A {
157        match self.bits {
158            false => START_A::_0,
159            true => START_A::_1,
160        }
161    }
162    #[doc = "Checks if the value of the field is `_0`"]
163    #[inline(always)]
164    pub fn is_0(&self) -> bool {
165        *self == START_A::_0
166    }
167    #[doc = "Checks if the value of the field is `_1`"]
168    #[inline(always)]
169    pub fn is_1(&self) -> bool {
170        *self == START_A::_1
171    }
172}
173#[doc = "Field `START` writer - Start Condition Detection Flag"]
174pub type START_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, ICSR2_SPEC, START_A, O>;
175impl<'a, const O: u8> START_W<'a, O> {
176    #[doc = "Start condition is not detected."]
177    #[inline(always)]
178    pub fn _0(self) -> &'a mut W {
179        self.variant(START_A::_0)
180    }
181    #[doc = "Start condition is detected."]
182    #[inline(always)]
183    pub fn _1(self) -> &'a mut W {
184        self.variant(START_A::_1)
185    }
186}
187#[doc = "Field `STOP` reader - Stop Condition Detection Flag\n\nThe field is **modified** in some way after a read operation."]
188pub type STOP_R = crate::BitReader<STOP_A>;
189#[doc = "Stop Condition Detection Flag\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191pub enum STOP_A {
192    #[doc = "0: Stop condition is not detected."]
193    _0 = 0,
194    #[doc = "1: Stop condition is detected."]
195    _1 = 1,
196}
197impl From<STOP_A> for bool {
198    #[inline(always)]
199    fn from(variant: STOP_A) -> Self {
200        variant as u8 != 0
201    }
202}
203impl STOP_R {
204    #[doc = "Get enumerated values variant"]
205    #[inline(always)]
206    pub fn variant(&self) -> STOP_A {
207        match self.bits {
208            false => STOP_A::_0,
209            true => STOP_A::_1,
210        }
211    }
212    #[doc = "Checks if the value of the field is `_0`"]
213    #[inline(always)]
214    pub fn is_0(&self) -> bool {
215        *self == STOP_A::_0
216    }
217    #[doc = "Checks if the value of the field is `_1`"]
218    #[inline(always)]
219    pub fn is_1(&self) -> bool {
220        *self == STOP_A::_1
221    }
222}
223#[doc = "Field `STOP` writer - Stop Condition Detection Flag"]
224pub type STOP_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, ICSR2_SPEC, STOP_A, O>;
225impl<'a, const O: u8> STOP_W<'a, O> {
226    #[doc = "Stop condition is not detected."]
227    #[inline(always)]
228    pub fn _0(self) -> &'a mut W {
229        self.variant(STOP_A::_0)
230    }
231    #[doc = "Stop condition is detected."]
232    #[inline(always)]
233    pub fn _1(self) -> &'a mut W {
234        self.variant(STOP_A::_1)
235    }
236}
237#[doc = "Field `NACKF` reader - NACK Detection Flag\n\nThe field is **modified** in some way after a read operation."]
238pub type NACKF_R = crate::BitReader<NACKF_A>;
239#[doc = "NACK Detection Flag\n\nValue on reset: 0"]
240#[derive(Clone, Copy, Debug, PartialEq, Eq)]
241pub enum NACKF_A {
242    #[doc = "0: NACK is not detected."]
243    _0 = 0,
244    #[doc = "1: NACK is detected."]
245    _1 = 1,
246}
247impl From<NACKF_A> for bool {
248    #[inline(always)]
249    fn from(variant: NACKF_A) -> Self {
250        variant as u8 != 0
251    }
252}
253impl NACKF_R {
254    #[doc = "Get enumerated values variant"]
255    #[inline(always)]
256    pub fn variant(&self) -> NACKF_A {
257        match self.bits {
258            false => NACKF_A::_0,
259            true => NACKF_A::_1,
260        }
261    }
262    #[doc = "Checks if the value of the field is `_0`"]
263    #[inline(always)]
264    pub fn is_0(&self) -> bool {
265        *self == NACKF_A::_0
266    }
267    #[doc = "Checks if the value of the field is `_1`"]
268    #[inline(always)]
269    pub fn is_1(&self) -> bool {
270        *self == NACKF_A::_1
271    }
272}
273#[doc = "Field `NACKF` writer - NACK Detection Flag"]
274pub type NACKF_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, ICSR2_SPEC, NACKF_A, O>;
275impl<'a, const O: u8> NACKF_W<'a, O> {
276    #[doc = "NACK is not detected."]
277    #[inline(always)]
278    pub fn _0(self) -> &'a mut W {
279        self.variant(NACKF_A::_0)
280    }
281    #[doc = "NACK is detected."]
282    #[inline(always)]
283    pub fn _1(self) -> &'a mut W {
284        self.variant(NACKF_A::_1)
285    }
286}
287#[doc = "Field `RDRF` reader - Receive Data Full Flag\n\nThe field is **modified** in some way after a read operation."]
288pub type RDRF_R = crate::BitReader<RDRF_A>;
289#[doc = "Receive Data Full Flag\n\nValue on reset: 0"]
290#[derive(Clone, Copy, Debug, PartialEq, Eq)]
291pub enum RDRF_A {
292    #[doc = "0: ICDRR contains no receive data."]
293    _0 = 0,
294    #[doc = "1: ICDRR contains receive data."]
295    _1 = 1,
296}
297impl From<RDRF_A> for bool {
298    #[inline(always)]
299    fn from(variant: RDRF_A) -> Self {
300        variant as u8 != 0
301    }
302}
303impl RDRF_R {
304    #[doc = "Get enumerated values variant"]
305    #[inline(always)]
306    pub fn variant(&self) -> RDRF_A {
307        match self.bits {
308            false => RDRF_A::_0,
309            true => RDRF_A::_1,
310        }
311    }
312    #[doc = "Checks if the value of the field is `_0`"]
313    #[inline(always)]
314    pub fn is_0(&self) -> bool {
315        *self == RDRF_A::_0
316    }
317    #[doc = "Checks if the value of the field is `_1`"]
318    #[inline(always)]
319    pub fn is_1(&self) -> bool {
320        *self == RDRF_A::_1
321    }
322}
323#[doc = "Field `RDRF` writer - Receive Data Full Flag"]
324pub type RDRF_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, ICSR2_SPEC, RDRF_A, O>;
325impl<'a, const O: u8> RDRF_W<'a, O> {
326    #[doc = "ICDRR contains no receive data."]
327    #[inline(always)]
328    pub fn _0(self) -> &'a mut W {
329        self.variant(RDRF_A::_0)
330    }
331    #[doc = "ICDRR contains receive data."]
332    #[inline(always)]
333    pub fn _1(self) -> &'a mut W {
334        self.variant(RDRF_A::_1)
335    }
336}
337#[doc = "Field `TEND` reader - Transmit End Flag\n\nThe field is **modified** in some way after a read operation."]
338pub type TEND_R = crate::BitReader<TEND_A>;
339#[doc = "Transmit End Flag\n\nValue on reset: 0"]
340#[derive(Clone, Copy, Debug, PartialEq, Eq)]
341pub enum TEND_A {
342    #[doc = "0: Data is being transmitted."]
343    _0 = 0,
344    #[doc = "1: Data has been transmitted."]
345    _1 = 1,
346}
347impl From<TEND_A> for bool {
348    #[inline(always)]
349    fn from(variant: TEND_A) -> Self {
350        variant as u8 != 0
351    }
352}
353impl TEND_R {
354    #[doc = "Get enumerated values variant"]
355    #[inline(always)]
356    pub fn variant(&self) -> TEND_A {
357        match self.bits {
358            false => TEND_A::_0,
359            true => TEND_A::_1,
360        }
361    }
362    #[doc = "Checks if the value of the field is `_0`"]
363    #[inline(always)]
364    pub fn is_0(&self) -> bool {
365        *self == TEND_A::_0
366    }
367    #[doc = "Checks if the value of the field is `_1`"]
368    #[inline(always)]
369    pub fn is_1(&self) -> bool {
370        *self == TEND_A::_1
371    }
372}
373#[doc = "Field `TEND` writer - Transmit End Flag"]
374pub type TEND_W<'a, const O: u8> = crate::BitWriter0C<'a, u8, ICSR2_SPEC, TEND_A, O>;
375impl<'a, const O: u8> TEND_W<'a, O> {
376    #[doc = "Data is being transmitted."]
377    #[inline(always)]
378    pub fn _0(self) -> &'a mut W {
379        self.variant(TEND_A::_0)
380    }
381    #[doc = "Data has been transmitted."]
382    #[inline(always)]
383    pub fn _1(self) -> &'a mut W {
384        self.variant(TEND_A::_1)
385    }
386}
387#[doc = "Field `TDRE` reader - Transmit Data Empty Flag"]
388pub type TDRE_R = crate::BitReader<TDRE_A>;
389#[doc = "Transmit Data Empty Flag\n\nValue on reset: 0"]
390#[derive(Clone, Copy, Debug, PartialEq, Eq)]
391pub enum TDRE_A {
392    #[doc = "0: ICDRT contains transmit data."]
393    _0 = 0,
394    #[doc = "1: ICDRT contains no transmit data."]
395    _1 = 1,
396}
397impl From<TDRE_A> for bool {
398    #[inline(always)]
399    fn from(variant: TDRE_A) -> Self {
400        variant as u8 != 0
401    }
402}
403impl TDRE_R {
404    #[doc = "Get enumerated values variant"]
405    #[inline(always)]
406    pub fn variant(&self) -> TDRE_A {
407        match self.bits {
408            false => TDRE_A::_0,
409            true => TDRE_A::_1,
410        }
411    }
412    #[doc = "Checks if the value of the field is `_0`"]
413    #[inline(always)]
414    pub fn is_0(&self) -> bool {
415        *self == TDRE_A::_0
416    }
417    #[doc = "Checks if the value of the field is `_1`"]
418    #[inline(always)]
419    pub fn is_1(&self) -> bool {
420        *self == TDRE_A::_1
421    }
422}
423impl R {
424    #[doc = "Bit 0 - Timeout Detection Flag"]
425    #[inline(always)]
426    pub fn tmof(&self) -> TMOF_R {
427        TMOF_R::new((self.bits & 1) != 0)
428    }
429    #[doc = "Bit 1 - Arbitration-Lost Flag"]
430    #[inline(always)]
431    pub fn al(&self) -> AL_R {
432        AL_R::new(((self.bits >> 1) & 1) != 0)
433    }
434    #[doc = "Bit 2 - Start Condition Detection Flag"]
435    #[inline(always)]
436    pub fn start(&self) -> START_R {
437        START_R::new(((self.bits >> 2) & 1) != 0)
438    }
439    #[doc = "Bit 3 - Stop Condition Detection Flag"]
440    #[inline(always)]
441    pub fn stop(&self) -> STOP_R {
442        STOP_R::new(((self.bits >> 3) & 1) != 0)
443    }
444    #[doc = "Bit 4 - NACK Detection Flag"]
445    #[inline(always)]
446    pub fn nackf(&self) -> NACKF_R {
447        NACKF_R::new(((self.bits >> 4) & 1) != 0)
448    }
449    #[doc = "Bit 5 - Receive Data Full Flag"]
450    #[inline(always)]
451    pub fn rdrf(&self) -> RDRF_R {
452        RDRF_R::new(((self.bits >> 5) & 1) != 0)
453    }
454    #[doc = "Bit 6 - Transmit End Flag"]
455    #[inline(always)]
456    pub fn tend(&self) -> TEND_R {
457        TEND_R::new(((self.bits >> 6) & 1) != 0)
458    }
459    #[doc = "Bit 7 - Transmit Data Empty Flag"]
460    #[inline(always)]
461    pub fn tdre(&self) -> TDRE_R {
462        TDRE_R::new(((self.bits >> 7) & 1) != 0)
463    }
464}
465impl W {
466    #[doc = "Bit 0 - Timeout Detection Flag"]
467    #[inline(always)]
468    #[must_use]
469    pub fn tmof(&mut self) -> TMOF_W<0> {
470        TMOF_W::new(self)
471    }
472    #[doc = "Bit 1 - Arbitration-Lost Flag"]
473    #[inline(always)]
474    #[must_use]
475    pub fn al(&mut self) -> AL_W<1> {
476        AL_W::new(self)
477    }
478    #[doc = "Bit 2 - Start Condition Detection Flag"]
479    #[inline(always)]
480    #[must_use]
481    pub fn start(&mut self) -> START_W<2> {
482        START_W::new(self)
483    }
484    #[doc = "Bit 3 - Stop Condition Detection Flag"]
485    #[inline(always)]
486    #[must_use]
487    pub fn stop(&mut self) -> STOP_W<3> {
488        STOP_W::new(self)
489    }
490    #[doc = "Bit 4 - NACK Detection Flag"]
491    #[inline(always)]
492    #[must_use]
493    pub fn nackf(&mut self) -> NACKF_W<4> {
494        NACKF_W::new(self)
495    }
496    #[doc = "Bit 5 - Receive Data Full Flag"]
497    #[inline(always)]
498    #[must_use]
499    pub fn rdrf(&mut self) -> RDRF_W<5> {
500        RDRF_W::new(self)
501    }
502    #[doc = "Bit 6 - Transmit End Flag"]
503    #[inline(always)]
504    #[must_use]
505    pub fn tend(&mut self) -> TEND_W<6> {
506        TEND_W::new(self)
507    }
508    #[doc = "Writes raw bits to the register."]
509    #[inline(always)]
510    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
511        self.0.bits(bits);
512        self
513    }
514}
515#[doc = "I2C Bus Status Register 2\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 [icsr2](index.html) module"]
516pub struct ICSR2_SPEC;
517impl crate::RegisterSpec for ICSR2_SPEC {
518    type Ux = u8;
519}
520#[doc = "`read()` method returns [icsr2::R](R) reader structure"]
521impl crate::Readable for ICSR2_SPEC {
522    type Reader = R;
523}
524#[doc = "`write(|w| ..)` method takes [icsr2::W](W) writer structure"]
525impl crate::Writable for ICSR2_SPEC {
526    type Writer = W;
527    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0x7f;
528    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
529}
530#[doc = "`reset()` method sets ICSR2 to value 0"]
531impl crate::Resettable for ICSR2_SPEC {
532    const RESET_VALUE: Self::Ux = 0;
533}