stm32l4x2_pac/i2c1/
cr2.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::CR2 {
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 = "Possible values of the field `PECBYTE`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum PECBYTER {
48    #[doc = "No PEC transfer"]
49    NOPEC,
50    #[doc = "PEC transmission/reception is requested"]
51    PEC,
52}
53impl PECBYTER {
54    #[doc = r" Returns `true` if the bit is clear (0)"]
55    #[inline]
56    pub fn bit_is_clear(&self) -> bool {
57        !self.bit()
58    }
59    #[doc = r" Returns `true` if the bit is set (1)"]
60    #[inline]
61    pub fn bit_is_set(&self) -> bool {
62        self.bit()
63    }
64    #[doc = r" Value of the field as raw bits"]
65    #[inline]
66    pub fn bit(&self) -> bool {
67        match *self {
68            PECBYTER::NOPEC => false,
69            PECBYTER::PEC => true,
70        }
71    }
72    #[allow(missing_docs)]
73    #[doc(hidden)]
74    #[inline]
75    pub fn _from(value: bool) -> PECBYTER {
76        match value {
77            false => PECBYTER::NOPEC,
78            true => PECBYTER::PEC,
79        }
80    }
81    #[doc = "Checks if the value of the field is `NOPEC`"]
82    #[inline]
83    pub fn is_no_pec(&self) -> bool {
84        *self == PECBYTER::NOPEC
85    }
86    #[doc = "Checks if the value of the field is `PEC`"]
87    #[inline]
88    pub fn is_pec(&self) -> bool {
89        *self == PECBYTER::PEC
90    }
91}
92#[doc = "Possible values of the field `AUTOEND`"]
93#[derive(Clone, Copy, Debug, PartialEq)]
94pub enum AUTOENDR {
95    #[doc = "Software end mode: TC flag is set when NBYTES data are transferred, stretching SCL low"]
96    SOFTWARE,
97    #[doc = "Automatic end mode: a STOP condition is automatically sent when NBYTES data are transferred"]
98    AUTOMATIC,
99}
100impl AUTOENDR {
101    #[doc = r" Returns `true` if the bit is clear (0)"]
102    #[inline]
103    pub fn bit_is_clear(&self) -> bool {
104        !self.bit()
105    }
106    #[doc = r" Returns `true` if the bit is set (1)"]
107    #[inline]
108    pub fn bit_is_set(&self) -> bool {
109        self.bit()
110    }
111    #[doc = r" Value of the field as raw bits"]
112    #[inline]
113    pub fn bit(&self) -> bool {
114        match *self {
115            AUTOENDR::SOFTWARE => false,
116            AUTOENDR::AUTOMATIC => true,
117        }
118    }
119    #[allow(missing_docs)]
120    #[doc(hidden)]
121    #[inline]
122    pub fn _from(value: bool) -> AUTOENDR {
123        match value {
124            false => AUTOENDR::SOFTWARE,
125            true => AUTOENDR::AUTOMATIC,
126        }
127    }
128    #[doc = "Checks if the value of the field is `SOFTWARE`"]
129    #[inline]
130    pub fn is_software(&self) -> bool {
131        *self == AUTOENDR::SOFTWARE
132    }
133    #[doc = "Checks if the value of the field is `AUTOMATIC`"]
134    #[inline]
135    pub fn is_automatic(&self) -> bool {
136        *self == AUTOENDR::AUTOMATIC
137    }
138}
139#[doc = "Possible values of the field `RELOAD`"]
140#[derive(Clone, Copy, Debug, PartialEq)]
141pub enum RELOADR {
142    #[doc = "The transfer is completed after the NBYTES data transfer (STOP or RESTART will follow)"]
143    COMPLETED,
144    #[doc = "The transfer is not completed after the NBYTES data transfer (NBYTES will be reloaded)"]
145    NOTCOMPETED,
146}
147impl RELOADR {
148    #[doc = r" Returns `true` if the bit is clear (0)"]
149    #[inline]
150    pub fn bit_is_clear(&self) -> bool {
151        !self.bit()
152    }
153    #[doc = r" Returns `true` if the bit is set (1)"]
154    #[inline]
155    pub fn bit_is_set(&self) -> bool {
156        self.bit()
157    }
158    #[doc = r" Value of the field as raw bits"]
159    #[inline]
160    pub fn bit(&self) -> bool {
161        match *self {
162            RELOADR::COMPLETED => false,
163            RELOADR::NOTCOMPETED => true,
164        }
165    }
166    #[allow(missing_docs)]
167    #[doc(hidden)]
168    #[inline]
169    pub fn _from(value: bool) -> RELOADR {
170        match value {
171            false => RELOADR::COMPLETED,
172            true => RELOADR::NOTCOMPETED,
173        }
174    }
175    #[doc = "Checks if the value of the field is `COMPLETED`"]
176    #[inline]
177    pub fn is_completed(&self) -> bool {
178        *self == RELOADR::COMPLETED
179    }
180    #[doc = "Checks if the value of the field is `NOTCOMPETED`"]
181    #[inline]
182    pub fn is_not_competed(&self) -> bool {
183        *self == RELOADR::NOTCOMPETED
184    }
185}
186#[doc = r" Value of the field"]
187pub struct NBYTESR {
188    bits: u8,
189}
190impl NBYTESR {
191    #[doc = r" Value of the field as raw bits"]
192    #[inline]
193    pub fn bits(&self) -> u8 {
194        self.bits
195    }
196}
197#[doc = "Possible values of the field `NACK`"]
198#[derive(Clone, Copy, Debug, PartialEq)]
199pub enum NACKR {
200    #[doc = "an ACK is sent after current received byte"]
201    ACK,
202    #[doc = "a NACK is sent after current received byte"]
203    NACK,
204}
205impl NACKR {
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            NACKR::ACK => false,
221            NACKR::NACK => true,
222        }
223    }
224    #[allow(missing_docs)]
225    #[doc(hidden)]
226    #[inline]
227    pub fn _from(value: bool) -> NACKR {
228        match value {
229            false => NACKR::ACK,
230            true => NACKR::NACK,
231        }
232    }
233    #[doc = "Checks if the value of the field is `ACK`"]
234    #[inline]
235    pub fn is_ack(&self) -> bool {
236        *self == NACKR::ACK
237    }
238    #[doc = "Checks if the value of the field is `NACK`"]
239    #[inline]
240    pub fn is_nack(&self) -> bool {
241        *self == NACKR::NACK
242    }
243}
244#[doc = "Possible values of the field `STOP`"]
245#[derive(Clone, Copy, Debug, PartialEq)]
246pub enum STOPR {
247    #[doc = "No Stop generation"]
248    NOSTOP,
249    #[doc = "Stop generation after current byte transfer"]
250    STOP,
251}
252impl STOPR {
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            STOPR::NOSTOP => false,
268            STOPR::STOP => true,
269        }
270    }
271    #[allow(missing_docs)]
272    #[doc(hidden)]
273    #[inline]
274    pub fn _from(value: bool) -> STOPR {
275        match value {
276            false => STOPR::NOSTOP,
277            true => STOPR::STOP,
278        }
279    }
280    #[doc = "Checks if the value of the field is `NOSTOP`"]
281    #[inline]
282    pub fn is_no_stop(&self) -> bool {
283        *self == STOPR::NOSTOP
284    }
285    #[doc = "Checks if the value of the field is `STOP`"]
286    #[inline]
287    pub fn is_stop(&self) -> bool {
288        *self == STOPR::STOP
289    }
290}
291#[doc = "Possible values of the field `START`"]
292#[derive(Clone, Copy, Debug, PartialEq)]
293pub enum STARTR {
294    #[doc = "No Start generation"]
295    NOSTART,
296    #[doc = "Restart/Start generation"]
297    START,
298}
299impl STARTR {
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            STARTR::NOSTART => false,
315            STARTR::START => true,
316        }
317    }
318    #[allow(missing_docs)]
319    #[doc(hidden)]
320    #[inline]
321    pub fn _from(value: bool) -> STARTR {
322        match value {
323            false => STARTR::NOSTART,
324            true => STARTR::START,
325        }
326    }
327    #[doc = "Checks if the value of the field is `NOSTART`"]
328    #[inline]
329    pub fn is_no_start(&self) -> bool {
330        *self == STARTR::NOSTART
331    }
332    #[doc = "Checks if the value of the field is `START`"]
333    #[inline]
334    pub fn is_start(&self) -> bool {
335        *self == STARTR::START
336    }
337}
338#[doc = "Possible values of the field `HEAD10R`"]
339#[derive(Clone, Copy, Debug, PartialEq)]
340pub enum HEAD10RR {
341    #[doc = "The master sends the complete 10 bit slave address read sequence"]
342    COMPLETE,
343    #[doc = "The master only sends the 1st 7 bits of the 10 bit address, followed by Read direction"]
344    PARTIAL,
345}
346impl HEAD10RR {
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            HEAD10RR::COMPLETE => false,
362            HEAD10RR::PARTIAL => true,
363        }
364    }
365    #[allow(missing_docs)]
366    #[doc(hidden)]
367    #[inline]
368    pub fn _from(value: bool) -> HEAD10RR {
369        match value {
370            false => HEAD10RR::COMPLETE,
371            true => HEAD10RR::PARTIAL,
372        }
373    }
374    #[doc = "Checks if the value of the field is `COMPLETE`"]
375    #[inline]
376    pub fn is_complete(&self) -> bool {
377        *self == HEAD10RR::COMPLETE
378    }
379    #[doc = "Checks if the value of the field is `PARTIAL`"]
380    #[inline]
381    pub fn is_partial(&self) -> bool {
382        *self == HEAD10RR::PARTIAL
383    }
384}
385#[doc = "Possible values of the field `ADD10`"]
386#[derive(Clone, Copy, Debug, PartialEq)]
387pub enum ADD10R {
388    #[doc = "The master operates in 7-bit addressing mode"]
389    BIT7,
390    #[doc = "The master operates in 10-bit addressing mode"]
391    BIT10,
392}
393impl ADD10R {
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            ADD10R::BIT7 => false,
409            ADD10R::BIT10 => true,
410        }
411    }
412    #[allow(missing_docs)]
413    #[doc(hidden)]
414    #[inline]
415    pub fn _from(value: bool) -> ADD10R {
416        match value {
417            false => ADD10R::BIT7,
418            true => ADD10R::BIT10,
419        }
420    }
421    #[doc = "Checks if the value of the field is `BIT7`"]
422    #[inline]
423    pub fn is_bit7(&self) -> bool {
424        *self == ADD10R::BIT7
425    }
426    #[doc = "Checks if the value of the field is `BIT10`"]
427    #[inline]
428    pub fn is_bit10(&self) -> bool {
429        *self == ADD10R::BIT10
430    }
431}
432#[doc = "Possible values of the field `RD_WRN`"]
433#[derive(Clone, Copy, Debug, PartialEq)]
434pub enum RD_WRNR {
435    #[doc = "Master requests a write transfer"]
436    WRITE,
437    #[doc = "Master requests a read transfer"]
438    READ,
439}
440impl RD_WRNR {
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            RD_WRNR::WRITE => false,
456            RD_WRNR::READ => true,
457        }
458    }
459    #[allow(missing_docs)]
460    #[doc(hidden)]
461    #[inline]
462    pub fn _from(value: bool) -> RD_WRNR {
463        match value {
464            false => RD_WRNR::WRITE,
465            true => RD_WRNR::READ,
466        }
467    }
468    #[doc = "Checks if the value of the field is `WRITE`"]
469    #[inline]
470    pub fn is_write(&self) -> bool {
471        *self == RD_WRNR::WRITE
472    }
473    #[doc = "Checks if the value of the field is `READ`"]
474    #[inline]
475    pub fn is_read(&self) -> bool {
476        *self == RD_WRNR::READ
477    }
478}
479#[doc = r" Value of the field"]
480pub struct SADDR {
481    bits: u16,
482}
483impl SADDR {
484    #[doc = r" Value of the field as raw bits"]
485    #[inline]
486    pub fn bits(&self) -> u16 {
487        self.bits
488    }
489}
490#[doc = "Values that can be written to the field `PECBYTE`"]
491pub enum PECBYTEW {
492    #[doc = "No PEC transfer"]
493    NOPEC,
494    #[doc = "PEC transmission/reception is requested"]
495    PEC,
496}
497impl PECBYTEW {
498    #[allow(missing_docs)]
499    #[doc(hidden)]
500    #[inline]
501    pub fn _bits(&self) -> bool {
502        match *self {
503            PECBYTEW::NOPEC => false,
504            PECBYTEW::PEC => true,
505        }
506    }
507}
508#[doc = r" Proxy"]
509pub struct _PECBYTEW<'a> {
510    w: &'a mut W,
511}
512impl<'a> _PECBYTEW<'a> {
513    #[doc = r" Writes `variant` to the field"]
514    #[inline]
515    pub fn variant(self, variant: PECBYTEW) -> &'a mut W {
516        {
517            self.bit(variant._bits())
518        }
519    }
520    #[doc = "No PEC transfer"]
521    #[inline]
522    pub fn no_pec(self) -> &'a mut W {
523        self.variant(PECBYTEW::NOPEC)
524    }
525    #[doc = "PEC transmission/reception is requested"]
526    #[inline]
527    pub fn pec(self) -> &'a mut W {
528        self.variant(PECBYTEW::PEC)
529    }
530    #[doc = r" Sets the field bit"]
531    pub fn set_bit(self) -> &'a mut W {
532        self.bit(true)
533    }
534    #[doc = r" Clears the field bit"]
535    pub fn clear_bit(self) -> &'a mut W {
536        self.bit(false)
537    }
538    #[doc = r" Writes raw bits to the field"]
539    #[inline]
540    pub fn bit(self, value: bool) -> &'a mut W {
541        const MASK: bool = true;
542        const OFFSET: u8 = 26;
543        self.w.bits &= !((MASK as u32) << OFFSET);
544        self.w.bits |= ((value & MASK) as u32) << OFFSET;
545        self.w
546    }
547}
548#[doc = "Values that can be written to the field `AUTOEND`"]
549pub enum AUTOENDW {
550    #[doc = "Software end mode: TC flag is set when NBYTES data are transferred, stretching SCL low"]
551    SOFTWARE,
552    #[doc = "Automatic end mode: a STOP condition is automatically sent when NBYTES data are transferred"]
553    AUTOMATIC,
554}
555impl AUTOENDW {
556    #[allow(missing_docs)]
557    #[doc(hidden)]
558    #[inline]
559    pub fn _bits(&self) -> bool {
560        match *self {
561            AUTOENDW::SOFTWARE => false,
562            AUTOENDW::AUTOMATIC => true,
563        }
564    }
565}
566#[doc = r" Proxy"]
567pub struct _AUTOENDW<'a> {
568    w: &'a mut W,
569}
570impl<'a> _AUTOENDW<'a> {
571    #[doc = r" Writes `variant` to the field"]
572    #[inline]
573    pub fn variant(self, variant: AUTOENDW) -> &'a mut W {
574        {
575            self.bit(variant._bits())
576        }
577    }
578    #[doc = "Software end mode: TC flag is set when NBYTES data are transferred, stretching SCL low"]
579    #[inline]
580    pub fn software(self) -> &'a mut W {
581        self.variant(AUTOENDW::SOFTWARE)
582    }
583    #[doc = "Automatic end mode: a STOP condition is automatically sent when NBYTES data are transferred"]
584    #[inline]
585    pub fn automatic(self) -> &'a mut W {
586        self.variant(AUTOENDW::AUTOMATIC)
587    }
588    #[doc = r" Sets the field bit"]
589    pub fn set_bit(self) -> &'a mut W {
590        self.bit(true)
591    }
592    #[doc = r" Clears the field bit"]
593    pub fn clear_bit(self) -> &'a mut W {
594        self.bit(false)
595    }
596    #[doc = r" Writes raw bits to the field"]
597    #[inline]
598    pub fn bit(self, value: bool) -> &'a mut W {
599        const MASK: bool = true;
600        const OFFSET: u8 = 25;
601        self.w.bits &= !((MASK as u32) << OFFSET);
602        self.w.bits |= ((value & MASK) as u32) << OFFSET;
603        self.w
604    }
605}
606#[doc = "Values that can be written to the field `RELOAD`"]
607pub enum RELOADW {
608    #[doc = "The transfer is completed after the NBYTES data transfer (STOP or RESTART will follow)"]
609    COMPLETED,
610    #[doc = "The transfer is not completed after the NBYTES data transfer (NBYTES will be reloaded)"]
611    NOTCOMPETED,
612}
613impl RELOADW {
614    #[allow(missing_docs)]
615    #[doc(hidden)]
616    #[inline]
617    pub fn _bits(&self) -> bool {
618        match *self {
619            RELOADW::COMPLETED => false,
620            RELOADW::NOTCOMPETED => true,
621        }
622    }
623}
624#[doc = r" Proxy"]
625pub struct _RELOADW<'a> {
626    w: &'a mut W,
627}
628impl<'a> _RELOADW<'a> {
629    #[doc = r" Writes `variant` to the field"]
630    #[inline]
631    pub fn variant(self, variant: RELOADW) -> &'a mut W {
632        {
633            self.bit(variant._bits())
634        }
635    }
636    #[doc = "The transfer is completed after the NBYTES data transfer (STOP or RESTART will follow)"]
637    #[inline]
638    pub fn completed(self) -> &'a mut W {
639        self.variant(RELOADW::COMPLETED)
640    }
641    #[doc = "The transfer is not completed after the NBYTES data transfer (NBYTES will be reloaded)"]
642    #[inline]
643    pub fn not_competed(self) -> &'a mut W {
644        self.variant(RELOADW::NOTCOMPETED)
645    }
646    #[doc = r" Sets the field bit"]
647    pub fn set_bit(self) -> &'a mut W {
648        self.bit(true)
649    }
650    #[doc = r" Clears the field bit"]
651    pub fn clear_bit(self) -> &'a mut W {
652        self.bit(false)
653    }
654    #[doc = r" Writes raw bits to the field"]
655    #[inline]
656    pub fn bit(self, value: bool) -> &'a mut W {
657        const MASK: bool = true;
658        const OFFSET: u8 = 24;
659        self.w.bits &= !((MASK as u32) << OFFSET);
660        self.w.bits |= ((value & MASK) as u32) << OFFSET;
661        self.w
662    }
663}
664#[doc = r" Proxy"]
665pub struct _NBYTESW<'a> {
666    w: &'a mut W,
667}
668impl<'a> _NBYTESW<'a> {
669    #[doc = r" Writes raw bits to the field"]
670    #[inline]
671    pub fn bits(self, value: u8) -> &'a mut W {
672        const MASK: u8 = 255;
673        const OFFSET: u8 = 16;
674        self.w.bits &= !((MASK as u32) << OFFSET);
675        self.w.bits |= ((value & MASK) as u32) << OFFSET;
676        self.w
677    }
678}
679#[doc = "Values that can be written to the field `NACK`"]
680pub enum NACKW {
681    #[doc = "an ACK is sent after current received byte"]
682    ACK,
683    #[doc = "a NACK is sent after current received byte"]
684    NACK,
685}
686impl NACKW {
687    #[allow(missing_docs)]
688    #[doc(hidden)]
689    #[inline]
690    pub fn _bits(&self) -> bool {
691        match *self {
692            NACKW::ACK => false,
693            NACKW::NACK => true,
694        }
695    }
696}
697#[doc = r" Proxy"]
698pub struct _NACKW<'a> {
699    w: &'a mut W,
700}
701impl<'a> _NACKW<'a> {
702    #[doc = r" Writes `variant` to the field"]
703    #[inline]
704    pub fn variant(self, variant: NACKW) -> &'a mut W {
705        {
706            self.bit(variant._bits())
707        }
708    }
709    #[doc = "an ACK is sent after current received byte"]
710    #[inline]
711    pub fn ack(self) -> &'a mut W {
712        self.variant(NACKW::ACK)
713    }
714    #[doc = "a NACK is sent after current received byte"]
715    #[inline]
716    pub fn nack(self) -> &'a mut W {
717        self.variant(NACKW::NACK)
718    }
719    #[doc = r" Sets the field bit"]
720    pub fn set_bit(self) -> &'a mut W {
721        self.bit(true)
722    }
723    #[doc = r" Clears the field bit"]
724    pub fn clear_bit(self) -> &'a mut W {
725        self.bit(false)
726    }
727    #[doc = r" Writes raw bits to the field"]
728    #[inline]
729    pub fn bit(self, value: bool) -> &'a mut W {
730        const MASK: bool = true;
731        const OFFSET: u8 = 15;
732        self.w.bits &= !((MASK as u32) << OFFSET);
733        self.w.bits |= ((value & MASK) as u32) << OFFSET;
734        self.w
735    }
736}
737#[doc = "Values that can be written to the field `STOP`"]
738pub enum STOPW {
739    #[doc = "No Stop generation"]
740    NOSTOP,
741    #[doc = "Stop generation after current byte transfer"]
742    STOP,
743}
744impl STOPW {
745    #[allow(missing_docs)]
746    #[doc(hidden)]
747    #[inline]
748    pub fn _bits(&self) -> bool {
749        match *self {
750            STOPW::NOSTOP => false,
751            STOPW::STOP => true,
752        }
753    }
754}
755#[doc = r" Proxy"]
756pub struct _STOPW<'a> {
757    w: &'a mut W,
758}
759impl<'a> _STOPW<'a> {
760    #[doc = r" Writes `variant` to the field"]
761    #[inline]
762    pub fn variant(self, variant: STOPW) -> &'a mut W {
763        {
764            self.bit(variant._bits())
765        }
766    }
767    #[doc = "No Stop generation"]
768    #[inline]
769    pub fn no_stop(self) -> &'a mut W {
770        self.variant(STOPW::NOSTOP)
771    }
772    #[doc = "Stop generation after current byte transfer"]
773    #[inline]
774    pub fn stop(self) -> &'a mut W {
775        self.variant(STOPW::STOP)
776    }
777    #[doc = r" Sets the field bit"]
778    pub fn set_bit(self) -> &'a mut W {
779        self.bit(true)
780    }
781    #[doc = r" Clears the field bit"]
782    pub fn clear_bit(self) -> &'a mut W {
783        self.bit(false)
784    }
785    #[doc = r" Writes raw bits to the field"]
786    #[inline]
787    pub fn bit(self, value: bool) -> &'a mut W {
788        const MASK: bool = true;
789        const OFFSET: u8 = 14;
790        self.w.bits &= !((MASK as u32) << OFFSET);
791        self.w.bits |= ((value & MASK) as u32) << OFFSET;
792        self.w
793    }
794}
795#[doc = "Values that can be written to the field `START`"]
796pub enum STARTW {
797    #[doc = "No Start generation"]
798    NOSTART,
799    #[doc = "Restart/Start generation"]
800    START,
801}
802impl STARTW {
803    #[allow(missing_docs)]
804    #[doc(hidden)]
805    #[inline]
806    pub fn _bits(&self) -> bool {
807        match *self {
808            STARTW::NOSTART => false,
809            STARTW::START => true,
810        }
811    }
812}
813#[doc = r" Proxy"]
814pub struct _STARTW<'a> {
815    w: &'a mut W,
816}
817impl<'a> _STARTW<'a> {
818    #[doc = r" Writes `variant` to the field"]
819    #[inline]
820    pub fn variant(self, variant: STARTW) -> &'a mut W {
821        {
822            self.bit(variant._bits())
823        }
824    }
825    #[doc = "No Start generation"]
826    #[inline]
827    pub fn no_start(self) -> &'a mut W {
828        self.variant(STARTW::NOSTART)
829    }
830    #[doc = "Restart/Start generation"]
831    #[inline]
832    pub fn start(self) -> &'a mut W {
833        self.variant(STARTW::START)
834    }
835    #[doc = r" Sets the field bit"]
836    pub fn set_bit(self) -> &'a mut W {
837        self.bit(true)
838    }
839    #[doc = r" Clears the field bit"]
840    pub fn clear_bit(self) -> &'a mut W {
841        self.bit(false)
842    }
843    #[doc = r" Writes raw bits to the field"]
844    #[inline]
845    pub fn bit(self, value: bool) -> &'a mut W {
846        const MASK: bool = true;
847        const OFFSET: u8 = 13;
848        self.w.bits &= !((MASK as u32) << OFFSET);
849        self.w.bits |= ((value & MASK) as u32) << OFFSET;
850        self.w
851    }
852}
853#[doc = "Values that can be written to the field `HEAD10R`"]
854pub enum HEAD10RW {
855    #[doc = "The master sends the complete 10 bit slave address read sequence"]
856    COMPLETE,
857    #[doc = "The master only sends the 1st 7 bits of the 10 bit address, followed by Read direction"]
858    PARTIAL,
859}
860impl HEAD10RW {
861    #[allow(missing_docs)]
862    #[doc(hidden)]
863    #[inline]
864    pub fn _bits(&self) -> bool {
865        match *self {
866            HEAD10RW::COMPLETE => false,
867            HEAD10RW::PARTIAL => true,
868        }
869    }
870}
871#[doc = r" Proxy"]
872pub struct _HEAD10RW<'a> {
873    w: &'a mut W,
874}
875impl<'a> _HEAD10RW<'a> {
876    #[doc = r" Writes `variant` to the field"]
877    #[inline]
878    pub fn variant(self, variant: HEAD10RW) -> &'a mut W {
879        {
880            self.bit(variant._bits())
881        }
882    }
883    #[doc = "The master sends the complete 10 bit slave address read sequence"]
884    #[inline]
885    pub fn complete(self) -> &'a mut W {
886        self.variant(HEAD10RW::COMPLETE)
887    }
888    #[doc = "The master only sends the 1st 7 bits of the 10 bit address, followed by Read direction"]
889    #[inline]
890    pub fn partial(self) -> &'a mut W {
891        self.variant(HEAD10RW::PARTIAL)
892    }
893    #[doc = r" Sets the field bit"]
894    pub fn set_bit(self) -> &'a mut W {
895        self.bit(true)
896    }
897    #[doc = r" Clears the field bit"]
898    pub fn clear_bit(self) -> &'a mut W {
899        self.bit(false)
900    }
901    #[doc = r" Writes raw bits to the field"]
902    #[inline]
903    pub fn bit(self, value: bool) -> &'a mut W {
904        const MASK: bool = true;
905        const OFFSET: u8 = 12;
906        self.w.bits &= !((MASK as u32) << OFFSET);
907        self.w.bits |= ((value & MASK) as u32) << OFFSET;
908        self.w
909    }
910}
911#[doc = "Values that can be written to the field `ADD10`"]
912pub enum ADD10W {
913    #[doc = "The master operates in 7-bit addressing mode"]
914    BIT7,
915    #[doc = "The master operates in 10-bit addressing mode"]
916    BIT10,
917}
918impl ADD10W {
919    #[allow(missing_docs)]
920    #[doc(hidden)]
921    #[inline]
922    pub fn _bits(&self) -> bool {
923        match *self {
924            ADD10W::BIT7 => false,
925            ADD10W::BIT10 => true,
926        }
927    }
928}
929#[doc = r" Proxy"]
930pub struct _ADD10W<'a> {
931    w: &'a mut W,
932}
933impl<'a> _ADD10W<'a> {
934    #[doc = r" Writes `variant` to the field"]
935    #[inline]
936    pub fn variant(self, variant: ADD10W) -> &'a mut W {
937        {
938            self.bit(variant._bits())
939        }
940    }
941    #[doc = "The master operates in 7-bit addressing mode"]
942    #[inline]
943    pub fn bit7(self) -> &'a mut W {
944        self.variant(ADD10W::BIT7)
945    }
946    #[doc = "The master operates in 10-bit addressing mode"]
947    #[inline]
948    pub fn bit10(self) -> &'a mut W {
949        self.variant(ADD10W::BIT10)
950    }
951    #[doc = r" Sets the field bit"]
952    pub fn set_bit(self) -> &'a mut W {
953        self.bit(true)
954    }
955    #[doc = r" Clears the field bit"]
956    pub fn clear_bit(self) -> &'a mut W {
957        self.bit(false)
958    }
959    #[doc = r" Writes raw bits to the field"]
960    #[inline]
961    pub fn bit(self, value: bool) -> &'a mut W {
962        const MASK: bool = true;
963        const OFFSET: u8 = 11;
964        self.w.bits &= !((MASK as u32) << OFFSET);
965        self.w.bits |= ((value & MASK) as u32) << OFFSET;
966        self.w
967    }
968}
969#[doc = "Values that can be written to the field `RD_WRN`"]
970pub enum RD_WRNW {
971    #[doc = "Master requests a write transfer"]
972    WRITE,
973    #[doc = "Master requests a read transfer"]
974    READ,
975}
976impl RD_WRNW {
977    #[allow(missing_docs)]
978    #[doc(hidden)]
979    #[inline]
980    pub fn _bits(&self) -> bool {
981        match *self {
982            RD_WRNW::WRITE => false,
983            RD_WRNW::READ => true,
984        }
985    }
986}
987#[doc = r" Proxy"]
988pub struct _RD_WRNW<'a> {
989    w: &'a mut W,
990}
991impl<'a> _RD_WRNW<'a> {
992    #[doc = r" Writes `variant` to the field"]
993    #[inline]
994    pub fn variant(self, variant: RD_WRNW) -> &'a mut W {
995        {
996            self.bit(variant._bits())
997        }
998    }
999    #[doc = "Master requests a write transfer"]
1000    #[inline]
1001    pub fn write(self) -> &'a mut W {
1002        self.variant(RD_WRNW::WRITE)
1003    }
1004    #[doc = "Master requests a read transfer"]
1005    #[inline]
1006    pub fn read(self) -> &'a mut W {
1007        self.variant(RD_WRNW::READ)
1008    }
1009    #[doc = r" Sets the field bit"]
1010    pub fn set_bit(self) -> &'a mut W {
1011        self.bit(true)
1012    }
1013    #[doc = r" Clears the field bit"]
1014    pub fn clear_bit(self) -> &'a mut W {
1015        self.bit(false)
1016    }
1017    #[doc = r" Writes raw bits to the field"]
1018    #[inline]
1019    pub fn bit(self, value: bool) -> &'a mut W {
1020        const MASK: bool = true;
1021        const OFFSET: u8 = 10;
1022        self.w.bits &= !((MASK as u32) << OFFSET);
1023        self.w.bits |= ((value & MASK) as u32) << OFFSET;
1024        self.w
1025    }
1026}
1027#[doc = r" Proxy"]
1028pub struct _SADDW<'a> {
1029    w: &'a mut W,
1030}
1031impl<'a> _SADDW<'a> {
1032    #[doc = r" Writes raw bits to the field"]
1033    #[inline]
1034    pub fn bits(self, value: u16) -> &'a mut W {
1035        const MASK: u16 = 1023;
1036        const OFFSET: u8 = 0;
1037        self.w.bits &= !((MASK as u32) << OFFSET);
1038        self.w.bits |= ((value & MASK) as u32) << OFFSET;
1039        self.w
1040    }
1041}
1042impl R {
1043    #[doc = r" Value of the register as raw bits"]
1044    #[inline]
1045    pub fn bits(&self) -> u32 {
1046        self.bits
1047    }
1048    #[doc = "Bit 26 - Packet error checking byte"]
1049    #[inline]
1050    pub fn pecbyte(&self) -> PECBYTER {
1051        PECBYTER::_from({
1052            const MASK: bool = true;
1053            const OFFSET: u8 = 26;
1054            ((self.bits >> OFFSET) & MASK as u32) != 0
1055        })
1056    }
1057    #[doc = "Bit 25 - Automatic end mode (master mode)"]
1058    #[inline]
1059    pub fn autoend(&self) -> AUTOENDR {
1060        AUTOENDR::_from({
1061            const MASK: bool = true;
1062            const OFFSET: u8 = 25;
1063            ((self.bits >> OFFSET) & MASK as u32) != 0
1064        })
1065    }
1066    #[doc = "Bit 24 - NBYTES reload mode"]
1067    #[inline]
1068    pub fn reload(&self) -> RELOADR {
1069        RELOADR::_from({
1070            const MASK: bool = true;
1071            const OFFSET: u8 = 24;
1072            ((self.bits >> OFFSET) & MASK as u32) != 0
1073        })
1074    }
1075    #[doc = "Bits 16:23 - Number of bytes"]
1076    #[inline]
1077    pub fn nbytes(&self) -> NBYTESR {
1078        let bits = {
1079            const MASK: u8 = 255;
1080            const OFFSET: u8 = 16;
1081            ((self.bits >> OFFSET) & MASK as u32) as u8
1082        };
1083        NBYTESR { bits }
1084    }
1085    #[doc = "Bit 15 - NACK generation (slave mode)"]
1086    #[inline]
1087    pub fn nack(&self) -> NACKR {
1088        NACKR::_from({
1089            const MASK: bool = true;
1090            const OFFSET: u8 = 15;
1091            ((self.bits >> OFFSET) & MASK as u32) != 0
1092        })
1093    }
1094    #[doc = "Bit 14 - Stop generation (master mode)"]
1095    #[inline]
1096    pub fn stop(&self) -> STOPR {
1097        STOPR::_from({
1098            const MASK: bool = true;
1099            const OFFSET: u8 = 14;
1100            ((self.bits >> OFFSET) & MASK as u32) != 0
1101        })
1102    }
1103    #[doc = "Bit 13 - Start generation"]
1104    #[inline]
1105    pub fn start(&self) -> STARTR {
1106        STARTR::_from({
1107            const MASK: bool = true;
1108            const OFFSET: u8 = 13;
1109            ((self.bits >> OFFSET) & MASK as u32) != 0
1110        })
1111    }
1112    #[doc = "Bit 12 - 10-bit address header only read direction (master receiver mode)"]
1113    #[inline]
1114    pub fn head10r(&self) -> HEAD10RR {
1115        HEAD10RR::_from({
1116            const MASK: bool = true;
1117            const OFFSET: u8 = 12;
1118            ((self.bits >> OFFSET) & MASK as u32) != 0
1119        })
1120    }
1121    #[doc = "Bit 11 - 10-bit addressing mode (master mode)"]
1122    #[inline]
1123    pub fn add10(&self) -> ADD10R {
1124        ADD10R::_from({
1125            const MASK: bool = true;
1126            const OFFSET: u8 = 11;
1127            ((self.bits >> OFFSET) & MASK as u32) != 0
1128        })
1129    }
1130    #[doc = "Bit 10 - Transfer direction (master mode)"]
1131    #[inline]
1132    pub fn rd_wrn(&self) -> RD_WRNR {
1133        RD_WRNR::_from({
1134            const MASK: bool = true;
1135            const OFFSET: u8 = 10;
1136            ((self.bits >> OFFSET) & MASK as u32) != 0
1137        })
1138    }
1139    #[doc = "Bits 0:9 - Slave address bit (master mode)"]
1140    #[inline]
1141    pub fn sadd(&self) -> SADDR {
1142        let bits = {
1143            const MASK: u16 = 1023;
1144            const OFFSET: u8 = 0;
1145            ((self.bits >> OFFSET) & MASK as u32) as u16
1146        };
1147        SADDR { bits }
1148    }
1149}
1150impl W {
1151    #[doc = r" Reset value of the register"]
1152    #[inline]
1153    pub fn reset_value() -> W {
1154        W { bits: 0 }
1155    }
1156    #[doc = r" Writes raw bits to the register"]
1157    #[inline]
1158    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
1159        self.bits = bits;
1160        self
1161    }
1162    #[doc = "Bit 26 - Packet error checking byte"]
1163    #[inline]
1164    pub fn pecbyte(&mut self) -> _PECBYTEW {
1165        _PECBYTEW { w: self }
1166    }
1167    #[doc = "Bit 25 - Automatic end mode (master mode)"]
1168    #[inline]
1169    pub fn autoend(&mut self) -> _AUTOENDW {
1170        _AUTOENDW { w: self }
1171    }
1172    #[doc = "Bit 24 - NBYTES reload mode"]
1173    #[inline]
1174    pub fn reload(&mut self) -> _RELOADW {
1175        _RELOADW { w: self }
1176    }
1177    #[doc = "Bits 16:23 - Number of bytes"]
1178    #[inline]
1179    pub fn nbytes(&mut self) -> _NBYTESW {
1180        _NBYTESW { w: self }
1181    }
1182    #[doc = "Bit 15 - NACK generation (slave mode)"]
1183    #[inline]
1184    pub fn nack(&mut self) -> _NACKW {
1185        _NACKW { w: self }
1186    }
1187    #[doc = "Bit 14 - Stop generation (master mode)"]
1188    #[inline]
1189    pub fn stop(&mut self) -> _STOPW {
1190        _STOPW { w: self }
1191    }
1192    #[doc = "Bit 13 - Start generation"]
1193    #[inline]
1194    pub fn start(&mut self) -> _STARTW {
1195        _STARTW { w: self }
1196    }
1197    #[doc = "Bit 12 - 10-bit address header only read direction (master receiver mode)"]
1198    #[inline]
1199    pub fn head10r(&mut self) -> _HEAD10RW {
1200        _HEAD10RW { w: self }
1201    }
1202    #[doc = "Bit 11 - 10-bit addressing mode (master mode)"]
1203    #[inline]
1204    pub fn add10(&mut self) -> _ADD10W {
1205        _ADD10W { w: self }
1206    }
1207    #[doc = "Bit 10 - Transfer direction (master mode)"]
1208    #[inline]
1209    pub fn rd_wrn(&mut self) -> _RD_WRNW {
1210        _RD_WRNW { w: self }
1211    }
1212    #[doc = "Bits 0:9 - Slave address bit (master mode)"]
1213    #[inline]
1214    pub fn sadd(&mut self) -> _SADDW {
1215        _SADDW { w: self }
1216    }
1217}