stm32l4x2_pac/i2c1/
isr.rs

1#[doc = r" Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7    bits: u32,
8}
9impl super::ISR {
10    #[doc = r" Modifies the contents of the register"]
11    #[inline]
12    pub fn modify<F>(&self, f: F)
13    where
14        for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15    {
16        let bits = self.register.get();
17        let r = R { bits: bits };
18        let mut w = W { bits: bits };
19        f(&r, &mut w);
20        self.register.set(w.bits);
21    }
22    #[doc = r" Reads the contents of the register"]
23    #[inline]
24    pub fn read(&self) -> R {
25        R {
26            bits: self.register.get(),
27        }
28    }
29    #[doc = r" Writes to the register"]
30    #[inline]
31    pub fn write<F>(&self, f: F)
32    where
33        F: FnOnce(&mut W) -> &mut W,
34    {
35        let mut w = W::reset_value();
36        f(&mut w);
37        self.register.set(w.bits);
38    }
39    #[doc = r" Writes the reset value to the register"]
40    #[inline]
41    pub fn reset(&self) {
42        self.write(|w| w)
43    }
44}
45#[doc = r" Value of the field"]
46pub struct ADDCODER {
47    bits: u8,
48}
49impl ADDCODER {
50    #[doc = r" Value of the field as raw bits"]
51    #[inline]
52    pub fn bits(&self) -> u8 {
53        self.bits
54    }
55}
56#[doc = "Possible values of the field `DIR`"]
57#[derive(Clone, Copy, Debug, PartialEq)]
58pub enum DIRR {
59    #[doc = "Write transfer, slave enters receiver mode"]
60    WRITE,
61    #[doc = "Read transfer, slave enters transmitter mode"]
62    READ,
63}
64impl DIRR {
65    #[doc = r" Returns `true` if the bit is clear (0)"]
66    #[inline]
67    pub fn bit_is_clear(&self) -> bool {
68        !self.bit()
69    }
70    #[doc = r" Returns `true` if the bit is set (1)"]
71    #[inline]
72    pub fn bit_is_set(&self) -> bool {
73        self.bit()
74    }
75    #[doc = r" Value of the field as raw bits"]
76    #[inline]
77    pub fn bit(&self) -> bool {
78        match *self {
79            DIRR::WRITE => false,
80            DIRR::READ => true,
81        }
82    }
83    #[allow(missing_docs)]
84    #[doc(hidden)]
85    #[inline]
86    pub fn _from(value: bool) -> DIRR {
87        match value {
88            false => DIRR::WRITE,
89            true => DIRR::READ,
90        }
91    }
92    #[doc = "Checks if the value of the field is `WRITE`"]
93    #[inline]
94    pub fn is_write(&self) -> bool {
95        *self == DIRR::WRITE
96    }
97    #[doc = "Checks if the value of the field is `READ`"]
98    #[inline]
99    pub fn is_read(&self) -> bool {
100        *self == DIRR::READ
101    }
102}
103#[doc = "Possible values of the field `BUSY`"]
104#[derive(Clone, Copy, Debug, PartialEq)]
105pub enum BUSYR {
106    #[doc = "No communication is in progress on the bus"]
107    NOTBUSY,
108    #[doc = "A communication is in progress on the bus"]
109    BUSY,
110}
111impl BUSYR {
112    #[doc = r" Returns `true` if the bit is clear (0)"]
113    #[inline]
114    pub fn bit_is_clear(&self) -> bool {
115        !self.bit()
116    }
117    #[doc = r" Returns `true` if the bit is set (1)"]
118    #[inline]
119    pub fn bit_is_set(&self) -> bool {
120        self.bit()
121    }
122    #[doc = r" Value of the field as raw bits"]
123    #[inline]
124    pub fn bit(&self) -> bool {
125        match *self {
126            BUSYR::NOTBUSY => false,
127            BUSYR::BUSY => true,
128        }
129    }
130    #[allow(missing_docs)]
131    #[doc(hidden)]
132    #[inline]
133    pub fn _from(value: bool) -> BUSYR {
134        match value {
135            false => BUSYR::NOTBUSY,
136            true => BUSYR::BUSY,
137        }
138    }
139    #[doc = "Checks if the value of the field is `NOTBUSY`"]
140    #[inline]
141    pub fn is_not_busy(&self) -> bool {
142        *self == BUSYR::NOTBUSY
143    }
144    #[doc = "Checks if the value of the field is `BUSY`"]
145    #[inline]
146    pub fn is_busy(&self) -> bool {
147        *self == BUSYR::BUSY
148    }
149}
150#[doc = "Possible values of the field `ALERT`"]
151#[derive(Clone, Copy, Debug, PartialEq)]
152pub enum ALERTR {
153    #[doc = "SMBA alert is not detected"]
154    NOALERT,
155    #[doc = "SMBA alert event is detected on SMBA pin"]
156    ALERT,
157}
158impl ALERTR {
159    #[doc = r" Returns `true` if the bit is clear (0)"]
160    #[inline]
161    pub fn bit_is_clear(&self) -> bool {
162        !self.bit()
163    }
164    #[doc = r" Returns `true` if the bit is set (1)"]
165    #[inline]
166    pub fn bit_is_set(&self) -> bool {
167        self.bit()
168    }
169    #[doc = r" Value of the field as raw bits"]
170    #[inline]
171    pub fn bit(&self) -> bool {
172        match *self {
173            ALERTR::NOALERT => false,
174            ALERTR::ALERT => true,
175        }
176    }
177    #[allow(missing_docs)]
178    #[doc(hidden)]
179    #[inline]
180    pub fn _from(value: bool) -> ALERTR {
181        match value {
182            false => ALERTR::NOALERT,
183            true => ALERTR::ALERT,
184        }
185    }
186    #[doc = "Checks if the value of the field is `NOALERT`"]
187    #[inline]
188    pub fn is_no_alert(&self) -> bool {
189        *self == ALERTR::NOALERT
190    }
191    #[doc = "Checks if the value of the field is `ALERT`"]
192    #[inline]
193    pub fn is_alert(&self) -> bool {
194        *self == ALERTR::ALERT
195    }
196}
197#[doc = "Possible values of the field `TIMEOUT`"]
198#[derive(Clone, Copy, Debug, PartialEq)]
199pub enum TIMEOUTR {
200    #[doc = "No timeout occured"]
201    NOTIMEOUT,
202    #[doc = "Timeout occured"]
203    TIMEOUT,
204}
205impl TIMEOUTR {
206    #[doc = r" Returns `true` if the bit is clear (0)"]
207    #[inline]
208    pub fn bit_is_clear(&self) -> bool {
209        !self.bit()
210    }
211    #[doc = r" Returns `true` if the bit is set (1)"]
212    #[inline]
213    pub fn bit_is_set(&self) -> bool {
214        self.bit()
215    }
216    #[doc = r" Value of the field as raw bits"]
217    #[inline]
218    pub fn bit(&self) -> bool {
219        match *self {
220            TIMEOUTR::NOTIMEOUT => false,
221            TIMEOUTR::TIMEOUT => true,
222        }
223    }
224    #[allow(missing_docs)]
225    #[doc(hidden)]
226    #[inline]
227    pub fn _from(value: bool) -> TIMEOUTR {
228        match value {
229            false => TIMEOUTR::NOTIMEOUT,
230            true => TIMEOUTR::TIMEOUT,
231        }
232    }
233    #[doc = "Checks if the value of the field is `NOTIMEOUT`"]
234    #[inline]
235    pub fn is_no_timeout(&self) -> bool {
236        *self == TIMEOUTR::NOTIMEOUT
237    }
238    #[doc = "Checks if the value of the field is `TIMEOUT`"]
239    #[inline]
240    pub fn is_timeout(&self) -> bool {
241        *self == TIMEOUTR::TIMEOUT
242    }
243}
244#[doc = "Possible values of the field `PECERR`"]
245#[derive(Clone, Copy, Debug, PartialEq)]
246pub enum PECERRR {
247    #[doc = "Received PEC does match with PEC register"]
248    MATCH,
249    #[doc = "Received PEC does not match with PEC register"]
250    NOMATCH,
251}
252impl PECERRR {
253    #[doc = r" Returns `true` if the bit is clear (0)"]
254    #[inline]
255    pub fn bit_is_clear(&self) -> bool {
256        !self.bit()
257    }
258    #[doc = r" Returns `true` if the bit is set (1)"]
259    #[inline]
260    pub fn bit_is_set(&self) -> bool {
261        self.bit()
262    }
263    #[doc = r" Value of the field as raw bits"]
264    #[inline]
265    pub fn bit(&self) -> bool {
266        match *self {
267            PECERRR::MATCH => false,
268            PECERRR::NOMATCH => true,
269        }
270    }
271    #[allow(missing_docs)]
272    #[doc(hidden)]
273    #[inline]
274    pub fn _from(value: bool) -> PECERRR {
275        match value {
276            false => PECERRR::MATCH,
277            true => PECERRR::NOMATCH,
278        }
279    }
280    #[doc = "Checks if the value of the field is `MATCH`"]
281    #[inline]
282    pub fn is_match_(&self) -> bool {
283        *self == PECERRR::MATCH
284    }
285    #[doc = "Checks if the value of the field is `NOMATCH`"]
286    #[inline]
287    pub fn is_no_match(&self) -> bool {
288        *self == PECERRR::NOMATCH
289    }
290}
291#[doc = "Possible values of the field `OVR`"]
292#[derive(Clone, Copy, Debug, PartialEq)]
293pub enum OVRR {
294    #[doc = "No overrun/underrun error occurs"]
295    NOOVERRUN,
296    #[doc = "slave mode with NOSTRETCH=1, when an overrun/underrun error occurs"]
297    OVERRUN,
298}
299impl OVRR {
300    #[doc = r" Returns `true` if the bit is clear (0)"]
301    #[inline]
302    pub fn bit_is_clear(&self) -> bool {
303        !self.bit()
304    }
305    #[doc = r" Returns `true` if the bit is set (1)"]
306    #[inline]
307    pub fn bit_is_set(&self) -> bool {
308        self.bit()
309    }
310    #[doc = r" Value of the field as raw bits"]
311    #[inline]
312    pub fn bit(&self) -> bool {
313        match *self {
314            OVRR::NOOVERRUN => false,
315            OVRR::OVERRUN => true,
316        }
317    }
318    #[allow(missing_docs)]
319    #[doc(hidden)]
320    #[inline]
321    pub fn _from(value: bool) -> OVRR {
322        match value {
323            false => OVRR::NOOVERRUN,
324            true => OVRR::OVERRUN,
325        }
326    }
327    #[doc = "Checks if the value of the field is `NOOVERRUN`"]
328    #[inline]
329    pub fn is_no_overrun(&self) -> bool {
330        *self == OVRR::NOOVERRUN
331    }
332    #[doc = "Checks if the value of the field is `OVERRUN`"]
333    #[inline]
334    pub fn is_overrun(&self) -> bool {
335        *self == OVRR::OVERRUN
336    }
337}
338#[doc = "Possible values of the field `ARLO`"]
339#[derive(Clone, Copy, Debug, PartialEq)]
340pub enum ARLOR {
341    #[doc = "No arbitration lost"]
342    NOTLOST,
343    #[doc = "Arbitration lost"]
344    LOST,
345}
346impl ARLOR {
347    #[doc = r" Returns `true` if the bit is clear (0)"]
348    #[inline]
349    pub fn bit_is_clear(&self) -> bool {
350        !self.bit()
351    }
352    #[doc = r" Returns `true` if the bit is set (1)"]
353    #[inline]
354    pub fn bit_is_set(&self) -> bool {
355        self.bit()
356    }
357    #[doc = r" Value of the field as raw bits"]
358    #[inline]
359    pub fn bit(&self) -> bool {
360        match *self {
361            ARLOR::NOTLOST => false,
362            ARLOR::LOST => true,
363        }
364    }
365    #[allow(missing_docs)]
366    #[doc(hidden)]
367    #[inline]
368    pub fn _from(value: bool) -> ARLOR {
369        match value {
370            false => ARLOR::NOTLOST,
371            true => ARLOR::LOST,
372        }
373    }
374    #[doc = "Checks if the value of the field is `NOTLOST`"]
375    #[inline]
376    pub fn is_not_lost(&self) -> bool {
377        *self == ARLOR::NOTLOST
378    }
379    #[doc = "Checks if the value of the field is `LOST`"]
380    #[inline]
381    pub fn is_lost(&self) -> bool {
382        *self == ARLOR::LOST
383    }
384}
385#[doc = "Possible values of the field `BERR`"]
386#[derive(Clone, Copy, Debug, PartialEq)]
387pub enum BERRR {
388    #[doc = "No bus error"]
389    NOERROR,
390    #[doc = "Misplaced Start and Stop condition is detected"]
391    ERROR,
392}
393impl BERRR {
394    #[doc = r" Returns `true` if the bit is clear (0)"]
395    #[inline]
396    pub fn bit_is_clear(&self) -> bool {
397        !self.bit()
398    }
399    #[doc = r" Returns `true` if the bit is set (1)"]
400    #[inline]
401    pub fn bit_is_set(&self) -> bool {
402        self.bit()
403    }
404    #[doc = r" Value of the field as raw bits"]
405    #[inline]
406    pub fn bit(&self) -> bool {
407        match *self {
408            BERRR::NOERROR => false,
409            BERRR::ERROR => true,
410        }
411    }
412    #[allow(missing_docs)]
413    #[doc(hidden)]
414    #[inline]
415    pub fn _from(value: bool) -> BERRR {
416        match value {
417            false => BERRR::NOERROR,
418            true => BERRR::ERROR,
419        }
420    }
421    #[doc = "Checks if the value of the field is `NOERROR`"]
422    #[inline]
423    pub fn is_no_error(&self) -> bool {
424        *self == BERRR::NOERROR
425    }
426    #[doc = "Checks if the value of the field is `ERROR`"]
427    #[inline]
428    pub fn is_error(&self) -> bool {
429        *self == BERRR::ERROR
430    }
431}
432#[doc = "Possible values of the field `TCR`"]
433#[derive(Clone, Copy, Debug, PartialEq)]
434pub enum TCRR {
435    #[doc = "Transfer is not complete"]
436    NOTCOMPLETE,
437    #[doc = "NBYTES has been transfered"]
438    COMPLETE,
439}
440impl TCRR {
441    #[doc = r" Returns `true` if the bit is clear (0)"]
442    #[inline]
443    pub fn bit_is_clear(&self) -> bool {
444        !self.bit()
445    }
446    #[doc = r" Returns `true` if the bit is set (1)"]
447    #[inline]
448    pub fn bit_is_set(&self) -> bool {
449        self.bit()
450    }
451    #[doc = r" Value of the field as raw bits"]
452    #[inline]
453    pub fn bit(&self) -> bool {
454        match *self {
455            TCRR::NOTCOMPLETE => false,
456            TCRR::COMPLETE => true,
457        }
458    }
459    #[allow(missing_docs)]
460    #[doc(hidden)]
461    #[inline]
462    pub fn _from(value: bool) -> TCRR {
463        match value {
464            false => TCRR::NOTCOMPLETE,
465            true => TCRR::COMPLETE,
466        }
467    }
468    #[doc = "Checks if the value of the field is `NOTCOMPLETE`"]
469    #[inline]
470    pub fn is_not_complete(&self) -> bool {
471        *self == TCRR::NOTCOMPLETE
472    }
473    #[doc = "Checks if the value of the field is `COMPLETE`"]
474    #[inline]
475    pub fn is_complete(&self) -> bool {
476        *self == TCRR::COMPLETE
477    }
478}
479#[doc = "Possible values of the field `TC`"]
480#[derive(Clone, Copy, Debug, PartialEq)]
481pub enum TCR {
482    #[doc = "Transfer is not complete"]
483    NOTCOMPLETE,
484    #[doc = "NBYTES has been transfered"]
485    COMPLETE,
486}
487impl TCR {
488    #[doc = r" Returns `true` if the bit is clear (0)"]
489    #[inline]
490    pub fn bit_is_clear(&self) -> bool {
491        !self.bit()
492    }
493    #[doc = r" Returns `true` if the bit is set (1)"]
494    #[inline]
495    pub fn bit_is_set(&self) -> bool {
496        self.bit()
497    }
498    #[doc = r" Value of the field as raw bits"]
499    #[inline]
500    pub fn bit(&self) -> bool {
501        match *self {
502            TCR::NOTCOMPLETE => false,
503            TCR::COMPLETE => true,
504        }
505    }
506    #[allow(missing_docs)]
507    #[doc(hidden)]
508    #[inline]
509    pub fn _from(value: bool) -> TCR {
510        match value {
511            false => TCR::NOTCOMPLETE,
512            true => TCR::COMPLETE,
513        }
514    }
515    #[doc = "Checks if the value of the field is `NOTCOMPLETE`"]
516    #[inline]
517    pub fn is_not_complete(&self) -> bool {
518        *self == TCR::NOTCOMPLETE
519    }
520    #[doc = "Checks if the value of the field is `COMPLETE`"]
521    #[inline]
522    pub fn is_complete(&self) -> bool {
523        *self == TCR::COMPLETE
524    }
525}
526#[doc = "Possible values of the field `STOPF`"]
527#[derive(Clone, Copy, Debug, PartialEq)]
528pub enum STOPFR {
529    #[doc = "No Stop condition detected"]
530    NOSTOP,
531    #[doc = "Stop condition detected"]
532    STOP,
533}
534impl STOPFR {
535    #[doc = r" Returns `true` if the bit is clear (0)"]
536    #[inline]
537    pub fn bit_is_clear(&self) -> bool {
538        !self.bit()
539    }
540    #[doc = r" Returns `true` if the bit is set (1)"]
541    #[inline]
542    pub fn bit_is_set(&self) -> bool {
543        self.bit()
544    }
545    #[doc = r" Value of the field as raw bits"]
546    #[inline]
547    pub fn bit(&self) -> bool {
548        match *self {
549            STOPFR::NOSTOP => false,
550            STOPFR::STOP => true,
551        }
552    }
553    #[allow(missing_docs)]
554    #[doc(hidden)]
555    #[inline]
556    pub fn _from(value: bool) -> STOPFR {
557        match value {
558            false => STOPFR::NOSTOP,
559            true => STOPFR::STOP,
560        }
561    }
562    #[doc = "Checks if the value of the field is `NOSTOP`"]
563    #[inline]
564    pub fn is_no_stop(&self) -> bool {
565        *self == STOPFR::NOSTOP
566    }
567    #[doc = "Checks if the value of the field is `STOP`"]
568    #[inline]
569    pub fn is_stop(&self) -> bool {
570        *self == STOPFR::STOP
571    }
572}
573#[doc = "Possible values of the field `NACKF`"]
574#[derive(Clone, Copy, Debug, PartialEq)]
575pub enum NACKFR {
576    #[doc = "No NACK has been received"]
577    NONACK,
578    #[doc = "NACK has been received"]
579    NACK,
580}
581impl NACKFR {
582    #[doc = r" Returns `true` if the bit is clear (0)"]
583    #[inline]
584    pub fn bit_is_clear(&self) -> bool {
585        !self.bit()
586    }
587    #[doc = r" Returns `true` if the bit is set (1)"]
588    #[inline]
589    pub fn bit_is_set(&self) -> bool {
590        self.bit()
591    }
592    #[doc = r" Value of the field as raw bits"]
593    #[inline]
594    pub fn bit(&self) -> bool {
595        match *self {
596            NACKFR::NONACK => false,
597            NACKFR::NACK => true,
598        }
599    }
600    #[allow(missing_docs)]
601    #[doc(hidden)]
602    #[inline]
603    pub fn _from(value: bool) -> NACKFR {
604        match value {
605            false => NACKFR::NONACK,
606            true => NACKFR::NACK,
607        }
608    }
609    #[doc = "Checks if the value of the field is `NONACK`"]
610    #[inline]
611    pub fn is_no_nack(&self) -> bool {
612        *self == NACKFR::NONACK
613    }
614    #[doc = "Checks if the value of the field is `NACK`"]
615    #[inline]
616    pub fn is_nack(&self) -> bool {
617        *self == NACKFR::NACK
618    }
619}
620#[doc = "Possible values of the field `ADDR`"]
621#[derive(Clone, Copy, Debug, PartialEq)]
622pub enum ADDRR {
623    #[doc = "Adress mismatched or not received"]
624    NOTMATCH,
625    #[doc = "Received slave address matched with one of the enabled slave addresses"]
626    MATCH,
627}
628impl ADDRR {
629    #[doc = r" Returns `true` if the bit is clear (0)"]
630    #[inline]
631    pub fn bit_is_clear(&self) -> bool {
632        !self.bit()
633    }
634    #[doc = r" Returns `true` if the bit is set (1)"]
635    #[inline]
636    pub fn bit_is_set(&self) -> bool {
637        self.bit()
638    }
639    #[doc = r" Value of the field as raw bits"]
640    #[inline]
641    pub fn bit(&self) -> bool {
642        match *self {
643            ADDRR::NOTMATCH => false,
644            ADDRR::MATCH => true,
645        }
646    }
647    #[allow(missing_docs)]
648    #[doc(hidden)]
649    #[inline]
650    pub fn _from(value: bool) -> ADDRR {
651        match value {
652            false => ADDRR::NOTMATCH,
653            true => ADDRR::MATCH,
654        }
655    }
656    #[doc = "Checks if the value of the field is `NOTMATCH`"]
657    #[inline]
658    pub fn is_not_match(&self) -> bool {
659        *self == ADDRR::NOTMATCH
660    }
661    #[doc = "Checks if the value of the field is `MATCH`"]
662    #[inline]
663    pub fn is_match_(&self) -> bool {
664        *self == ADDRR::MATCH
665    }
666}
667#[doc = "Possible values of the field `RXNE`"]
668#[derive(Clone, Copy, Debug, PartialEq)]
669pub enum RXNER {
670    #[doc = "The RXDR register is empty"]
671    EMPTY,
672    #[doc = "Received data is copied into the RXDR register, and is ready to be read"]
673    NOTEMPTY,
674}
675impl RXNER {
676    #[doc = r" Returns `true` if the bit is clear (0)"]
677    #[inline]
678    pub fn bit_is_clear(&self) -> bool {
679        !self.bit()
680    }
681    #[doc = r" Returns `true` if the bit is set (1)"]
682    #[inline]
683    pub fn bit_is_set(&self) -> bool {
684        self.bit()
685    }
686    #[doc = r" Value of the field as raw bits"]
687    #[inline]
688    pub fn bit(&self) -> bool {
689        match *self {
690            RXNER::EMPTY => false,
691            RXNER::NOTEMPTY => true,
692        }
693    }
694    #[allow(missing_docs)]
695    #[doc(hidden)]
696    #[inline]
697    pub fn _from(value: bool) -> RXNER {
698        match value {
699            false => RXNER::EMPTY,
700            true => RXNER::NOTEMPTY,
701        }
702    }
703    #[doc = "Checks if the value of the field is `EMPTY`"]
704    #[inline]
705    pub fn is_empty(&self) -> bool {
706        *self == RXNER::EMPTY
707    }
708    #[doc = "Checks if the value of the field is `NOTEMPTY`"]
709    #[inline]
710    pub fn is_not_empty(&self) -> bool {
711        *self == RXNER::NOTEMPTY
712    }
713}
714#[doc = "Possible values of the field `TXIS`"]
715#[derive(Clone, Copy, Debug, PartialEq)]
716pub enum TXISR {
717    #[doc = "The TXDR register is not empty"]
718    NOTEMPTY,
719    #[doc = "The TXDR register is empty and the data to be transmitted must be written in the TXDR register"]
720    EMPTY,
721}
722impl TXISR {
723    #[doc = r" Returns `true` if the bit is clear (0)"]
724    #[inline]
725    pub fn bit_is_clear(&self) -> bool {
726        !self.bit()
727    }
728    #[doc = r" Returns `true` if the bit is set (1)"]
729    #[inline]
730    pub fn bit_is_set(&self) -> bool {
731        self.bit()
732    }
733    #[doc = r" Value of the field as raw bits"]
734    #[inline]
735    pub fn bit(&self) -> bool {
736        match *self {
737            TXISR::NOTEMPTY => false,
738            TXISR::EMPTY => true,
739        }
740    }
741    #[allow(missing_docs)]
742    #[doc(hidden)]
743    #[inline]
744    pub fn _from(value: bool) -> TXISR {
745        match value {
746            false => TXISR::NOTEMPTY,
747            true => TXISR::EMPTY,
748        }
749    }
750    #[doc = "Checks if the value of the field is `NOTEMPTY`"]
751    #[inline]
752    pub fn is_not_empty(&self) -> bool {
753        *self == TXISR::NOTEMPTY
754    }
755    #[doc = "Checks if the value of the field is `EMPTY`"]
756    #[inline]
757    pub fn is_empty(&self) -> bool {
758        *self == TXISR::EMPTY
759    }
760}
761#[doc = "Possible values of the field `TXE`"]
762#[derive(Clone, Copy, Debug, PartialEq)]
763pub enum TXER {
764    #[doc = "TXDR register not empty"]
765    NOTEMPTY,
766    #[doc = "TXDR register empty"]
767    EMPTY,
768}
769impl TXER {
770    #[doc = r" Returns `true` if the bit is clear (0)"]
771    #[inline]
772    pub fn bit_is_clear(&self) -> bool {
773        !self.bit()
774    }
775    #[doc = r" Returns `true` if the bit is set (1)"]
776    #[inline]
777    pub fn bit_is_set(&self) -> bool {
778        self.bit()
779    }
780    #[doc = r" Value of the field as raw bits"]
781    #[inline]
782    pub fn bit(&self) -> bool {
783        match *self {
784            TXER::NOTEMPTY => false,
785            TXER::EMPTY => true,
786        }
787    }
788    #[allow(missing_docs)]
789    #[doc(hidden)]
790    #[inline]
791    pub fn _from(value: bool) -> TXER {
792        match value {
793            false => TXER::NOTEMPTY,
794            true => TXER::EMPTY,
795        }
796    }
797    #[doc = "Checks if the value of the field is `NOTEMPTY`"]
798    #[inline]
799    pub fn is_not_empty(&self) -> bool {
800        *self == TXER::NOTEMPTY
801    }
802    #[doc = "Checks if the value of the field is `EMPTY`"]
803    #[inline]
804    pub fn is_empty(&self) -> bool {
805        *self == TXER::EMPTY
806    }
807}
808#[doc = "Values that can be written to the field `TXIS`"]
809pub enum TXISW {
810    #[doc = "The TXDR register is not empty"]
811    NOTEMPTY,
812    #[doc = "The TXDR register is empty and the data to be transmitted must be written in the TXDR register"]
813    EMPTY,
814}
815impl TXISW {
816    #[allow(missing_docs)]
817    #[doc(hidden)]
818    #[inline]
819    pub fn _bits(&self) -> bool {
820        match *self {
821            TXISW::NOTEMPTY => false,
822            TXISW::EMPTY => true,
823        }
824    }
825}
826#[doc = r" Proxy"]
827pub struct _TXISW<'a> {
828    w: &'a mut W,
829}
830impl<'a> _TXISW<'a> {
831    #[doc = r" Writes `variant` to the field"]
832    #[inline]
833    pub fn variant(self, variant: TXISW) -> &'a mut W {
834        {
835            self.bit(variant._bits())
836        }
837    }
838    #[doc = "The TXDR register is not empty"]
839    #[inline]
840    pub fn not_empty(self) -> &'a mut W {
841        self.variant(TXISW::NOTEMPTY)
842    }
843    #[doc = "The TXDR register is empty and the data to be transmitted must be written in the TXDR register"]
844    #[inline]
845    pub fn empty(self) -> &'a mut W {
846        self.variant(TXISW::EMPTY)
847    }
848    #[doc = r" Sets the field bit"]
849    pub fn set_bit(self) -> &'a mut W {
850        self.bit(true)
851    }
852    #[doc = r" Clears the field bit"]
853    pub fn clear_bit(self) -> &'a mut W {
854        self.bit(false)
855    }
856    #[doc = r" Writes raw bits to the field"]
857    #[inline]
858    pub fn bit(self, value: bool) -> &'a mut W {
859        const MASK: bool = true;
860        const OFFSET: u8 = 1;
861        self.w.bits &= !((MASK as u32) << OFFSET);
862        self.w.bits |= ((value & MASK) as u32) << OFFSET;
863        self.w
864    }
865}
866#[doc = "Values that can be written to the field `TXE`"]
867pub enum TXEW {
868    #[doc = "TXDR register not empty"]
869    NOTEMPTY,
870    #[doc = "TXDR register empty"]
871    EMPTY,
872}
873impl TXEW {
874    #[allow(missing_docs)]
875    #[doc(hidden)]
876    #[inline]
877    pub fn _bits(&self) -> bool {
878        match *self {
879            TXEW::NOTEMPTY => false,
880            TXEW::EMPTY => true,
881        }
882    }
883}
884#[doc = r" Proxy"]
885pub struct _TXEW<'a> {
886    w: &'a mut W,
887}
888impl<'a> _TXEW<'a> {
889    #[doc = r" Writes `variant` to the field"]
890    #[inline]
891    pub fn variant(self, variant: TXEW) -> &'a mut W {
892        {
893            self.bit(variant._bits())
894        }
895    }
896    #[doc = "TXDR register not empty"]
897    #[inline]
898    pub fn not_empty(self) -> &'a mut W {
899        self.variant(TXEW::NOTEMPTY)
900    }
901    #[doc = "TXDR register empty"]
902    #[inline]
903    pub fn empty(self) -> &'a mut W {
904        self.variant(TXEW::EMPTY)
905    }
906    #[doc = r" Sets the field bit"]
907    pub fn set_bit(self) -> &'a mut W {
908        self.bit(true)
909    }
910    #[doc = r" Clears the field bit"]
911    pub fn clear_bit(self) -> &'a mut W {
912        self.bit(false)
913    }
914    #[doc = r" Writes raw bits to the field"]
915    #[inline]
916    pub fn bit(self, value: bool) -> &'a mut W {
917        const MASK: bool = true;
918        const OFFSET: u8 = 0;
919        self.w.bits &= !((MASK as u32) << OFFSET);
920        self.w.bits |= ((value & MASK) as u32) << OFFSET;
921        self.w
922    }
923}
924impl R {
925    #[doc = r" Value of the register as raw bits"]
926    #[inline]
927    pub fn bits(&self) -> u32 {
928        self.bits
929    }
930    #[doc = "Bits 17:23 - Address match code (Slave mode)"]
931    #[inline]
932    pub fn addcode(&self) -> ADDCODER {
933        let bits = {
934            const MASK: u8 = 127;
935            const OFFSET: u8 = 17;
936            ((self.bits >> OFFSET) & MASK as u32) as u8
937        };
938        ADDCODER { bits }
939    }
940    #[doc = "Bit 16 - Transfer direction (Slave mode)"]
941    #[inline]
942    pub fn dir(&self) -> DIRR {
943        DIRR::_from({
944            const MASK: bool = true;
945            const OFFSET: u8 = 16;
946            ((self.bits >> OFFSET) & MASK as u32) != 0
947        })
948    }
949    #[doc = "Bit 15 - Bus busy"]
950    #[inline]
951    pub fn busy(&self) -> BUSYR {
952        BUSYR::_from({
953            const MASK: bool = true;
954            const OFFSET: u8 = 15;
955            ((self.bits >> OFFSET) & MASK as u32) != 0
956        })
957    }
958    #[doc = "Bit 13 - SMBus alert"]
959    #[inline]
960    pub fn alert(&self) -> ALERTR {
961        ALERTR::_from({
962            const MASK: bool = true;
963            const OFFSET: u8 = 13;
964            ((self.bits >> OFFSET) & MASK as u32) != 0
965        })
966    }
967    #[doc = "Bit 12 - Timeout or t_low detection flag"]
968    #[inline]
969    pub fn timeout(&self) -> TIMEOUTR {
970        TIMEOUTR::_from({
971            const MASK: bool = true;
972            const OFFSET: u8 = 12;
973            ((self.bits >> OFFSET) & MASK as u32) != 0
974        })
975    }
976    #[doc = "Bit 11 - PEC Error in reception"]
977    #[inline]
978    pub fn pecerr(&self) -> PECERRR {
979        PECERRR::_from({
980            const MASK: bool = true;
981            const OFFSET: u8 = 11;
982            ((self.bits >> OFFSET) & MASK as u32) != 0
983        })
984    }
985    #[doc = "Bit 10 - Overrun/Underrun (slave mode)"]
986    #[inline]
987    pub fn ovr(&self) -> OVRR {
988        OVRR::_from({
989            const MASK: bool = true;
990            const OFFSET: u8 = 10;
991            ((self.bits >> OFFSET) & MASK as u32) != 0
992        })
993    }
994    #[doc = "Bit 9 - Arbitration lost"]
995    #[inline]
996    pub fn arlo(&self) -> ARLOR {
997        ARLOR::_from({
998            const MASK: bool = true;
999            const OFFSET: u8 = 9;
1000            ((self.bits >> OFFSET) & MASK as u32) != 0
1001        })
1002    }
1003    #[doc = "Bit 8 - Bus error"]
1004    #[inline]
1005    pub fn berr(&self) -> BERRR {
1006        BERRR::_from({
1007            const MASK: bool = true;
1008            const OFFSET: u8 = 8;
1009            ((self.bits >> OFFSET) & MASK as u32) != 0
1010        })
1011    }
1012    #[doc = "Bit 7 - Transfer Complete Reload"]
1013    #[inline]
1014    pub fn tcr(&self) -> TCRR {
1015        TCRR::_from({
1016            const MASK: bool = true;
1017            const OFFSET: u8 = 7;
1018            ((self.bits >> OFFSET) & MASK as u32) != 0
1019        })
1020    }
1021    #[doc = "Bit 6 - Transfer Complete (master mode)"]
1022    #[inline]
1023    pub fn tc(&self) -> TCR {
1024        TCR::_from({
1025            const MASK: bool = true;
1026            const OFFSET: u8 = 6;
1027            ((self.bits >> OFFSET) & MASK as u32) != 0
1028        })
1029    }
1030    #[doc = "Bit 5 - Stop detection flag"]
1031    #[inline]
1032    pub fn stopf(&self) -> STOPFR {
1033        STOPFR::_from({
1034            const MASK: bool = true;
1035            const OFFSET: u8 = 5;
1036            ((self.bits >> OFFSET) & MASK as u32) != 0
1037        })
1038    }
1039    #[doc = "Bit 4 - Not acknowledge received flag"]
1040    #[inline]
1041    pub fn nackf(&self) -> NACKFR {
1042        NACKFR::_from({
1043            const MASK: bool = true;
1044            const OFFSET: u8 = 4;
1045            ((self.bits >> OFFSET) & MASK as u32) != 0
1046        })
1047    }
1048    #[doc = "Bit 3 - Address matched (slave mode)"]
1049    #[inline]
1050    pub fn addr(&self) -> ADDRR {
1051        ADDRR::_from({
1052            const MASK: bool = true;
1053            const OFFSET: u8 = 3;
1054            ((self.bits >> OFFSET) & MASK as u32) != 0
1055        })
1056    }
1057    #[doc = "Bit 2 - Receive data register not empty (receivers)"]
1058    #[inline]
1059    pub fn rxne(&self) -> RXNER {
1060        RXNER::_from({
1061            const MASK: bool = true;
1062            const OFFSET: u8 = 2;
1063            ((self.bits >> OFFSET) & MASK as u32) != 0
1064        })
1065    }
1066    #[doc = "Bit 1 - Transmit interrupt status (transmitters)"]
1067    #[inline]
1068    pub fn txis(&self) -> TXISR {
1069        TXISR::_from({
1070            const MASK: bool = true;
1071            const OFFSET: u8 = 1;
1072            ((self.bits >> OFFSET) & MASK as u32) != 0
1073        })
1074    }
1075    #[doc = "Bit 0 - Transmit data register empty (transmitters)"]
1076    #[inline]
1077    pub fn txe(&self) -> TXER {
1078        TXER::_from({
1079            const MASK: bool = true;
1080            const OFFSET: u8 = 0;
1081            ((self.bits >> OFFSET) & MASK as u32) != 0
1082        })
1083    }
1084}
1085impl W {
1086    #[doc = r" Reset value of the register"]
1087    #[inline]
1088    pub fn reset_value() -> W {
1089        W { bits: 1 }
1090    }
1091    #[doc = r" Writes raw bits to the register"]
1092    #[inline]
1093    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
1094        self.bits = bits;
1095        self
1096    }
1097    #[doc = "Bit 1 - Transmit interrupt status (transmitters)"]
1098    #[inline]
1099    pub fn txis(&mut self) -> _TXISW {
1100        _TXISW { w: self }
1101    }
1102    #[doc = "Bit 0 - Transmit data register empty (transmitters)"]
1103    #[inline]
1104    pub fn txe(&mut self) -> _TXEW {
1105        _TXEW { w: self }
1106    }
1107}