efm32pg22_pac/efm32pg22c200/i2c0_s/
ctrl.rs

1#[doc = "Register `CTRL` reader"]
2pub struct R(crate::R<CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CTRL` writer"]
17pub struct W(crate::W<CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CTRL_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<CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CORERST` reader - Soft Reset the internal state registers"]
38pub type CORERST_R = crate::BitReader<CORERST_A>;
39#[doc = "Soft Reset the internal state registers\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum CORERST_A {
42    #[doc = "0: No change to internal state registers"]
43    DISABLE = 0,
44    #[doc = "1: Reset the internal state registers"]
45    ENABLE = 1,
46}
47impl From<CORERST_A> for bool {
48    #[inline(always)]
49    fn from(variant: CORERST_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl CORERST_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> CORERST_A {
57        match self.bits {
58            false => CORERST_A::DISABLE,
59            true => CORERST_A::ENABLE,
60        }
61    }
62    #[doc = "Checks if the value of the field is `DISABLE`"]
63    #[inline(always)]
64    pub fn is_disable(&self) -> bool {
65        *self == CORERST_A::DISABLE
66    }
67    #[doc = "Checks if the value of the field is `ENABLE`"]
68    #[inline(always)]
69    pub fn is_enable(&self) -> bool {
70        *self == CORERST_A::ENABLE
71    }
72}
73#[doc = "Field `CORERST` writer - Soft Reset the internal state registers"]
74pub type CORERST_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, CORERST_A, O>;
75impl<'a, const O: u8> CORERST_W<'a, O> {
76    #[doc = "No change to internal state registers"]
77    #[inline(always)]
78    pub fn disable(self) -> &'a mut W {
79        self.variant(CORERST_A::DISABLE)
80    }
81    #[doc = "Reset the internal state registers"]
82    #[inline(always)]
83    pub fn enable(self) -> &'a mut W {
84        self.variant(CORERST_A::ENABLE)
85    }
86}
87#[doc = "Field `SLAVE` reader - Addressable as Follower"]
88pub type SLAVE_R = crate::BitReader<SLAVE_A>;
89#[doc = "Addressable as Follower\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum SLAVE_A {
92    #[doc = "0: All addresses will be responded to with a NACK"]
93    DISABLE = 0,
94    #[doc = "1: Addresses matching the programmed follower address or the general call address (if enabled) require a response from software. Other addresses are automatically responded to with a NACK."]
95    ENABLE = 1,
96}
97impl From<SLAVE_A> for bool {
98    #[inline(always)]
99    fn from(variant: SLAVE_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl SLAVE_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> SLAVE_A {
107        match self.bits {
108            false => SLAVE_A::DISABLE,
109            true => SLAVE_A::ENABLE,
110        }
111    }
112    #[doc = "Checks if the value of the field is `DISABLE`"]
113    #[inline(always)]
114    pub fn is_disable(&self) -> bool {
115        *self == SLAVE_A::DISABLE
116    }
117    #[doc = "Checks if the value of the field is `ENABLE`"]
118    #[inline(always)]
119    pub fn is_enable(&self) -> bool {
120        *self == SLAVE_A::ENABLE
121    }
122}
123#[doc = "Field `SLAVE` writer - Addressable as Follower"]
124pub type SLAVE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, SLAVE_A, O>;
125impl<'a, const O: u8> SLAVE_W<'a, O> {
126    #[doc = "All addresses will be responded to with a NACK"]
127    #[inline(always)]
128    pub fn disable(self) -> &'a mut W {
129        self.variant(SLAVE_A::DISABLE)
130    }
131    #[doc = "Addresses matching the programmed follower address or the general call address (if enabled) require a response from software. Other addresses are automatically responded to with a NACK."]
132    #[inline(always)]
133    pub fn enable(self) -> &'a mut W {
134        self.variant(SLAVE_A::ENABLE)
135    }
136}
137#[doc = "Field `AUTOACK` reader - Automatic Acknowledge"]
138pub type AUTOACK_R = crate::BitReader<AUTOACK_A>;
139#[doc = "Automatic Acknowledge\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum AUTOACK_A {
142    #[doc = "0: Software must give one ACK command for each ACK transmitted on the I2C bus."]
143    DISABLE = 0,
144    #[doc = "1: Addresses that are not automatically NACK'ed, and all data is automatically acknowledged."]
145    ENABLE = 1,
146}
147impl From<AUTOACK_A> for bool {
148    #[inline(always)]
149    fn from(variant: AUTOACK_A) -> Self {
150        variant as u8 != 0
151    }
152}
153impl AUTOACK_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> AUTOACK_A {
157        match self.bits {
158            false => AUTOACK_A::DISABLE,
159            true => AUTOACK_A::ENABLE,
160        }
161    }
162    #[doc = "Checks if the value of the field is `DISABLE`"]
163    #[inline(always)]
164    pub fn is_disable(&self) -> bool {
165        *self == AUTOACK_A::DISABLE
166    }
167    #[doc = "Checks if the value of the field is `ENABLE`"]
168    #[inline(always)]
169    pub fn is_enable(&self) -> bool {
170        *self == AUTOACK_A::ENABLE
171    }
172}
173#[doc = "Field `AUTOACK` writer - Automatic Acknowledge"]
174pub type AUTOACK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, AUTOACK_A, O>;
175impl<'a, const O: u8> AUTOACK_W<'a, O> {
176    #[doc = "Software must give one ACK command for each ACK transmitted on the I2C bus."]
177    #[inline(always)]
178    pub fn disable(self) -> &'a mut W {
179        self.variant(AUTOACK_A::DISABLE)
180    }
181    #[doc = "Addresses that are not automatically NACK'ed, and all data is automatically acknowledged."]
182    #[inline(always)]
183    pub fn enable(self) -> &'a mut W {
184        self.variant(AUTOACK_A::ENABLE)
185    }
186}
187#[doc = "Field `AUTOSE` reader - Automatic STOP when Empty"]
188pub type AUTOSE_R = crate::BitReader<AUTOSE_A>;
189#[doc = "Automatic STOP when Empty\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191pub enum AUTOSE_A {
192    #[doc = "0: A stop must be sent manually when no more data is to be transmitted."]
193    DISABLE = 0,
194    #[doc = "1: The leader automatically sends a STOP when no more data is available for transmission."]
195    ENABLE = 1,
196}
197impl From<AUTOSE_A> for bool {
198    #[inline(always)]
199    fn from(variant: AUTOSE_A) -> Self {
200        variant as u8 != 0
201    }
202}
203impl AUTOSE_R {
204    #[doc = "Get enumerated values variant"]
205    #[inline(always)]
206    pub fn variant(&self) -> AUTOSE_A {
207        match self.bits {
208            false => AUTOSE_A::DISABLE,
209            true => AUTOSE_A::ENABLE,
210        }
211    }
212    #[doc = "Checks if the value of the field is `DISABLE`"]
213    #[inline(always)]
214    pub fn is_disable(&self) -> bool {
215        *self == AUTOSE_A::DISABLE
216    }
217    #[doc = "Checks if the value of the field is `ENABLE`"]
218    #[inline(always)]
219    pub fn is_enable(&self) -> bool {
220        *self == AUTOSE_A::ENABLE
221    }
222}
223#[doc = "Field `AUTOSE` writer - Automatic STOP when Empty"]
224pub type AUTOSE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, AUTOSE_A, O>;
225impl<'a, const O: u8> AUTOSE_W<'a, O> {
226    #[doc = "A stop must be sent manually when no more data is to be transmitted."]
227    #[inline(always)]
228    pub fn disable(self) -> &'a mut W {
229        self.variant(AUTOSE_A::DISABLE)
230    }
231    #[doc = "The leader automatically sends a STOP when no more data is available for transmission."]
232    #[inline(always)]
233    pub fn enable(self) -> &'a mut W {
234        self.variant(AUTOSE_A::ENABLE)
235    }
236}
237#[doc = "Field `AUTOSN` reader - Automatic STOP on NACK"]
238pub type AUTOSN_R = crate::BitReader<AUTOSN_A>;
239#[doc = "Automatic STOP on NACK\n\nValue on reset: 0"]
240#[derive(Clone, Copy, Debug, PartialEq, Eq)]
241pub enum AUTOSN_A {
242    #[doc = "0: Stop is not automatically sent if a NACK is received from a follower."]
243    DISABLE = 0,
244    #[doc = "1: The leader automatically sends a STOP if a NACK is received from a follower."]
245    ENABLE = 1,
246}
247impl From<AUTOSN_A> for bool {
248    #[inline(always)]
249    fn from(variant: AUTOSN_A) -> Self {
250        variant as u8 != 0
251    }
252}
253impl AUTOSN_R {
254    #[doc = "Get enumerated values variant"]
255    #[inline(always)]
256    pub fn variant(&self) -> AUTOSN_A {
257        match self.bits {
258            false => AUTOSN_A::DISABLE,
259            true => AUTOSN_A::ENABLE,
260        }
261    }
262    #[doc = "Checks if the value of the field is `DISABLE`"]
263    #[inline(always)]
264    pub fn is_disable(&self) -> bool {
265        *self == AUTOSN_A::DISABLE
266    }
267    #[doc = "Checks if the value of the field is `ENABLE`"]
268    #[inline(always)]
269    pub fn is_enable(&self) -> bool {
270        *self == AUTOSN_A::ENABLE
271    }
272}
273#[doc = "Field `AUTOSN` writer - Automatic STOP on NACK"]
274pub type AUTOSN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, AUTOSN_A, O>;
275impl<'a, const O: u8> AUTOSN_W<'a, O> {
276    #[doc = "Stop is not automatically sent if a NACK is received from a follower."]
277    #[inline(always)]
278    pub fn disable(self) -> &'a mut W {
279        self.variant(AUTOSN_A::DISABLE)
280    }
281    #[doc = "The leader automatically sends a STOP if a NACK is received from a follower."]
282    #[inline(always)]
283    pub fn enable(self) -> &'a mut W {
284        self.variant(AUTOSN_A::ENABLE)
285    }
286}
287#[doc = "Field `ARBDIS` reader - Arbitration Disable"]
288pub type ARBDIS_R = crate::BitReader<ARBDIS_A>;
289#[doc = "Arbitration Disable\n\nValue on reset: 0"]
290#[derive(Clone, Copy, Debug, PartialEq, Eq)]
291pub enum ARBDIS_A {
292    #[doc = "0: When a device loses arbitration, the ARBIF interrupt flag is set and the bus is released."]
293    DISABLE = 0,
294    #[doc = "1: When a device loses arbitration, the ARBIF interrupt flag is set, but communication proceeds."]
295    ENABLE = 1,
296}
297impl From<ARBDIS_A> for bool {
298    #[inline(always)]
299    fn from(variant: ARBDIS_A) -> Self {
300        variant as u8 != 0
301    }
302}
303impl ARBDIS_R {
304    #[doc = "Get enumerated values variant"]
305    #[inline(always)]
306    pub fn variant(&self) -> ARBDIS_A {
307        match self.bits {
308            false => ARBDIS_A::DISABLE,
309            true => ARBDIS_A::ENABLE,
310        }
311    }
312    #[doc = "Checks if the value of the field is `DISABLE`"]
313    #[inline(always)]
314    pub fn is_disable(&self) -> bool {
315        *self == ARBDIS_A::DISABLE
316    }
317    #[doc = "Checks if the value of the field is `ENABLE`"]
318    #[inline(always)]
319    pub fn is_enable(&self) -> bool {
320        *self == ARBDIS_A::ENABLE
321    }
322}
323#[doc = "Field `ARBDIS` writer - Arbitration Disable"]
324pub type ARBDIS_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, ARBDIS_A, O>;
325impl<'a, const O: u8> ARBDIS_W<'a, O> {
326    #[doc = "When a device loses arbitration, the ARBIF interrupt flag is set and the bus is released."]
327    #[inline(always)]
328    pub fn disable(self) -> &'a mut W {
329        self.variant(ARBDIS_A::DISABLE)
330    }
331    #[doc = "When a device loses arbitration, the ARBIF interrupt flag is set, but communication proceeds."]
332    #[inline(always)]
333    pub fn enable(self) -> &'a mut W {
334        self.variant(ARBDIS_A::ENABLE)
335    }
336}
337#[doc = "Field `GCAMEN` reader - General Call Address Match Enable"]
338pub type GCAMEN_R = crate::BitReader<GCAMEN_A>;
339#[doc = "General Call Address Match Enable\n\nValue on reset: 0"]
340#[derive(Clone, Copy, Debug, PartialEq, Eq)]
341pub enum GCAMEN_A {
342    #[doc = "0: General call address will be NACK'ed if it is not included by the follower address and address mask."]
343    DISABLE = 0,
344    #[doc = "1: When a general call address is received, a software response is required"]
345    ENABLE = 1,
346}
347impl From<GCAMEN_A> for bool {
348    #[inline(always)]
349    fn from(variant: GCAMEN_A) -> Self {
350        variant as u8 != 0
351    }
352}
353impl GCAMEN_R {
354    #[doc = "Get enumerated values variant"]
355    #[inline(always)]
356    pub fn variant(&self) -> GCAMEN_A {
357        match self.bits {
358            false => GCAMEN_A::DISABLE,
359            true => GCAMEN_A::ENABLE,
360        }
361    }
362    #[doc = "Checks if the value of the field is `DISABLE`"]
363    #[inline(always)]
364    pub fn is_disable(&self) -> bool {
365        *self == GCAMEN_A::DISABLE
366    }
367    #[doc = "Checks if the value of the field is `ENABLE`"]
368    #[inline(always)]
369    pub fn is_enable(&self) -> bool {
370        *self == GCAMEN_A::ENABLE
371    }
372}
373#[doc = "Field `GCAMEN` writer - General Call Address Match Enable"]
374pub type GCAMEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, GCAMEN_A, O>;
375impl<'a, const O: u8> GCAMEN_W<'a, O> {
376    #[doc = "General call address will be NACK'ed if it is not included by the follower address and address mask."]
377    #[inline(always)]
378    pub fn disable(self) -> &'a mut W {
379        self.variant(GCAMEN_A::DISABLE)
380    }
381    #[doc = "When a general call address is received, a software response is required"]
382    #[inline(always)]
383    pub fn enable(self) -> &'a mut W {
384        self.variant(GCAMEN_A::ENABLE)
385    }
386}
387#[doc = "Field `TXBIL` reader - TX Buffer Interrupt Level"]
388pub type TXBIL_R = crate::BitReader<TXBIL_A>;
389#[doc = "TX Buffer Interrupt Level\n\nValue on reset: 0"]
390#[derive(Clone, Copy, Debug, PartialEq, Eq)]
391pub enum TXBIL_A {
392    #[doc = "0: TXBL status and the TXBL interrupt flag are set when the transmit buffer becomes empty. TXBL is cleared when the buffer becomes nonempty."]
393    EMPTY = 0,
394    #[doc = "1: TXBL status and the TXBL interrupt flag are set when the transmit buffer goes from full to half-full or empty. TXBL is cleared when the buffer becomes full"]
395    HALF_FULL = 1,
396}
397impl From<TXBIL_A> for bool {
398    #[inline(always)]
399    fn from(variant: TXBIL_A) -> Self {
400        variant as u8 != 0
401    }
402}
403impl TXBIL_R {
404    #[doc = "Get enumerated values variant"]
405    #[inline(always)]
406    pub fn variant(&self) -> TXBIL_A {
407        match self.bits {
408            false => TXBIL_A::EMPTY,
409            true => TXBIL_A::HALF_FULL,
410        }
411    }
412    #[doc = "Checks if the value of the field is `EMPTY`"]
413    #[inline(always)]
414    pub fn is_empty(&self) -> bool {
415        *self == TXBIL_A::EMPTY
416    }
417    #[doc = "Checks if the value of the field is `HALF_FULL`"]
418    #[inline(always)]
419    pub fn is_half_full(&self) -> bool {
420        *self == TXBIL_A::HALF_FULL
421    }
422}
423#[doc = "Field `TXBIL` writer - TX Buffer Interrupt Level"]
424pub type TXBIL_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, TXBIL_A, O>;
425impl<'a, const O: u8> TXBIL_W<'a, O> {
426    #[doc = "TXBL status and the TXBL interrupt flag are set when the transmit buffer becomes empty. TXBL is cleared when the buffer becomes nonempty."]
427    #[inline(always)]
428    pub fn empty(self) -> &'a mut W {
429        self.variant(TXBIL_A::EMPTY)
430    }
431    #[doc = "TXBL status and the TXBL interrupt flag are set when the transmit buffer goes from full to half-full or empty. TXBL is cleared when the buffer becomes full"]
432    #[inline(always)]
433    pub fn half_full(self) -> &'a mut W {
434        self.variant(TXBIL_A::HALF_FULL)
435    }
436}
437#[doc = "Field `CLHR` reader - Clock Low High Ratio"]
438pub type CLHR_R = crate::FieldReader<u8, CLHR_A>;
439#[doc = "Clock Low High Ratio\n\nValue on reset: 0"]
440#[derive(Clone, Copy, Debug, PartialEq, Eq)]
441#[repr(u8)]
442pub enum CLHR_A {
443    #[doc = "0: Nlow=4 and Nhigh=4, and the Nlow:Nhigh ratio is 4:4"]
444    STANDARD = 0,
445    #[doc = "1: Nlow=6 and Nhigh=3, and the Nlow:Nhigh ratio is 6:3"]
446    ASYMMETRIC = 1,
447    #[doc = "2: Nlow=11 and Nhigh=6, and the Nlow:Nhigh ratio is 11:6"]
448    FAST = 2,
449}
450impl From<CLHR_A> for u8 {
451    #[inline(always)]
452    fn from(variant: CLHR_A) -> Self {
453        variant as _
454    }
455}
456impl CLHR_R {
457    #[doc = "Get enumerated values variant"]
458    #[inline(always)]
459    pub fn variant(&self) -> Option<CLHR_A> {
460        match self.bits {
461            0 => Some(CLHR_A::STANDARD),
462            1 => Some(CLHR_A::ASYMMETRIC),
463            2 => Some(CLHR_A::FAST),
464            _ => None,
465        }
466    }
467    #[doc = "Checks if the value of the field is `STANDARD`"]
468    #[inline(always)]
469    pub fn is_standard(&self) -> bool {
470        *self == CLHR_A::STANDARD
471    }
472    #[doc = "Checks if the value of the field is `ASYMMETRIC`"]
473    #[inline(always)]
474    pub fn is_asymmetric(&self) -> bool {
475        *self == CLHR_A::ASYMMETRIC
476    }
477    #[doc = "Checks if the value of the field is `FAST`"]
478    #[inline(always)]
479    pub fn is_fast(&self) -> bool {
480        *self == CLHR_A::FAST
481    }
482}
483#[doc = "Field `CLHR` writer - Clock Low High Ratio"]
484pub type CLHR_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, CLHR_A, 2, O>;
485impl<'a, const O: u8> CLHR_W<'a, O> {
486    #[doc = "Nlow=4 and Nhigh=4, and the Nlow:Nhigh ratio is 4:4"]
487    #[inline(always)]
488    pub fn standard(self) -> &'a mut W {
489        self.variant(CLHR_A::STANDARD)
490    }
491    #[doc = "Nlow=6 and Nhigh=3, and the Nlow:Nhigh ratio is 6:3"]
492    #[inline(always)]
493    pub fn asymmetric(self) -> &'a mut W {
494        self.variant(CLHR_A::ASYMMETRIC)
495    }
496    #[doc = "Nlow=11 and Nhigh=6, and the Nlow:Nhigh ratio is 11:6"]
497    #[inline(always)]
498    pub fn fast(self) -> &'a mut W {
499        self.variant(CLHR_A::FAST)
500    }
501}
502#[doc = "Field `BITO` reader - Bus Idle Timeout"]
503pub type BITO_R = crate::FieldReader<u8, BITO_A>;
504#[doc = "Bus Idle Timeout\n\nValue on reset: 0"]
505#[derive(Clone, Copy, Debug, PartialEq, Eq)]
506#[repr(u8)]
507pub enum BITO_A {
508    #[doc = "0: Timeout disabled"]
509    OFF = 0,
510    #[doc = "1: Timeout after 40 prescaled clock cycles. In standard mode at 100 kHz, this results in a 50us timeout."]
511    I2C40PCC = 1,
512    #[doc = "2: Timeout after 80 prescaled clock cycles. In standard mode at 100 kHz, this results in a 100us timeout."]
513    I2C80PCC = 2,
514    #[doc = "3: Timeout after 160 prescaled clock cycles. In standard mode at 100 kHz, this results in a 200us timeout."]
515    I2C160PCC = 3,
516}
517impl From<BITO_A> for u8 {
518    #[inline(always)]
519    fn from(variant: BITO_A) -> Self {
520        variant as _
521    }
522}
523impl BITO_R {
524    #[doc = "Get enumerated values variant"]
525    #[inline(always)]
526    pub fn variant(&self) -> BITO_A {
527        match self.bits {
528            0 => BITO_A::OFF,
529            1 => BITO_A::I2C40PCC,
530            2 => BITO_A::I2C80PCC,
531            3 => BITO_A::I2C160PCC,
532            _ => unreachable!(),
533        }
534    }
535    #[doc = "Checks if the value of the field is `OFF`"]
536    #[inline(always)]
537    pub fn is_off(&self) -> bool {
538        *self == BITO_A::OFF
539    }
540    #[doc = "Checks if the value of the field is `I2C40PCC`"]
541    #[inline(always)]
542    pub fn is_i2c40pcc(&self) -> bool {
543        *self == BITO_A::I2C40PCC
544    }
545    #[doc = "Checks if the value of the field is `I2C80PCC`"]
546    #[inline(always)]
547    pub fn is_i2c80pcc(&self) -> bool {
548        *self == BITO_A::I2C80PCC
549    }
550    #[doc = "Checks if the value of the field is `I2C160PCC`"]
551    #[inline(always)]
552    pub fn is_i2c160pcc(&self) -> bool {
553        *self == BITO_A::I2C160PCC
554    }
555}
556#[doc = "Field `BITO` writer - Bus Idle Timeout"]
557pub type BITO_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, CTRL_SPEC, u8, BITO_A, 2, O>;
558impl<'a, const O: u8> BITO_W<'a, O> {
559    #[doc = "Timeout disabled"]
560    #[inline(always)]
561    pub fn off(self) -> &'a mut W {
562        self.variant(BITO_A::OFF)
563    }
564    #[doc = "Timeout after 40 prescaled clock cycles. In standard mode at 100 kHz, this results in a 50us timeout."]
565    #[inline(always)]
566    pub fn i2c40pcc(self) -> &'a mut W {
567        self.variant(BITO_A::I2C40PCC)
568    }
569    #[doc = "Timeout after 80 prescaled clock cycles. In standard mode at 100 kHz, this results in a 100us timeout."]
570    #[inline(always)]
571    pub fn i2c80pcc(self) -> &'a mut W {
572        self.variant(BITO_A::I2C80PCC)
573    }
574    #[doc = "Timeout after 160 prescaled clock cycles. In standard mode at 100 kHz, this results in a 200us timeout."]
575    #[inline(always)]
576    pub fn i2c160pcc(self) -> &'a mut W {
577        self.variant(BITO_A::I2C160PCC)
578    }
579}
580#[doc = "Field `GIBITO` reader - Go Idle on Bus Idle Timeout"]
581pub type GIBITO_R = crate::BitReader<GIBITO_A>;
582#[doc = "Go Idle on Bus Idle Timeout\n\nValue on reset: 0"]
583#[derive(Clone, Copy, Debug, PartialEq, Eq)]
584pub enum GIBITO_A {
585    #[doc = "0: A bus idle timeout has no effect on the bus state."]
586    DISABLE = 0,
587    #[doc = "1: A bus idle timeout tells the I2C module that the bus is idle, allowing new transfers to be initiated."]
588    ENABLE = 1,
589}
590impl From<GIBITO_A> for bool {
591    #[inline(always)]
592    fn from(variant: GIBITO_A) -> Self {
593        variant as u8 != 0
594    }
595}
596impl GIBITO_R {
597    #[doc = "Get enumerated values variant"]
598    #[inline(always)]
599    pub fn variant(&self) -> GIBITO_A {
600        match self.bits {
601            false => GIBITO_A::DISABLE,
602            true => GIBITO_A::ENABLE,
603        }
604    }
605    #[doc = "Checks if the value of the field is `DISABLE`"]
606    #[inline(always)]
607    pub fn is_disable(&self) -> bool {
608        *self == GIBITO_A::DISABLE
609    }
610    #[doc = "Checks if the value of the field is `ENABLE`"]
611    #[inline(always)]
612    pub fn is_enable(&self) -> bool {
613        *self == GIBITO_A::ENABLE
614    }
615}
616#[doc = "Field `GIBITO` writer - Go Idle on Bus Idle Timeout"]
617pub type GIBITO_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, GIBITO_A, O>;
618impl<'a, const O: u8> GIBITO_W<'a, O> {
619    #[doc = "A bus idle timeout has no effect on the bus state."]
620    #[inline(always)]
621    pub fn disable(self) -> &'a mut W {
622        self.variant(GIBITO_A::DISABLE)
623    }
624    #[doc = "A bus idle timeout tells the I2C module that the bus is idle, allowing new transfers to be initiated."]
625    #[inline(always)]
626    pub fn enable(self) -> &'a mut W {
627        self.variant(GIBITO_A::ENABLE)
628    }
629}
630#[doc = "Field `CLTO` reader - Clock Low Timeout"]
631pub type CLTO_R = crate::FieldReader<u8, CLTO_A>;
632#[doc = "Clock Low Timeout\n\nValue on reset: 0"]
633#[derive(Clone, Copy, Debug, PartialEq, Eq)]
634#[repr(u8)]
635pub enum CLTO_A {
636    #[doc = "0: Timeout disabled"]
637    OFF = 0,
638    #[doc = "1: Timeout after 40 prescaled clock cycles. In standard mode at 100 kHz, this results in a 50us timeout."]
639    I2C40PCC = 1,
640    #[doc = "2: Timeout after 80 prescaled clock cycles. In standard mode at 100 kHz, this results in a 100us timeout."]
641    I2C80PCC = 2,
642    #[doc = "3: Timeout after 160 prescaled clock cycles. In standard mode at 100 kHz, this results in a 200us timeout."]
643    I2C160PCC = 3,
644    #[doc = "4: Timeout after 320 prescaled clock cycles. In standard mode at 100 kHz, this results in a 400us timeout."]
645    I2C320PCC = 4,
646    #[doc = "5: Timeout after 1024 prescaled clock cycles. In standard mode at 100 kHz, this results in a 1280us timeout."]
647    I2C1024PCC = 5,
648}
649impl From<CLTO_A> for u8 {
650    #[inline(always)]
651    fn from(variant: CLTO_A) -> Self {
652        variant as _
653    }
654}
655impl CLTO_R {
656    #[doc = "Get enumerated values variant"]
657    #[inline(always)]
658    pub fn variant(&self) -> Option<CLTO_A> {
659        match self.bits {
660            0 => Some(CLTO_A::OFF),
661            1 => Some(CLTO_A::I2C40PCC),
662            2 => Some(CLTO_A::I2C80PCC),
663            3 => Some(CLTO_A::I2C160PCC),
664            4 => Some(CLTO_A::I2C320PCC),
665            5 => Some(CLTO_A::I2C1024PCC),
666            _ => None,
667        }
668    }
669    #[doc = "Checks if the value of the field is `OFF`"]
670    #[inline(always)]
671    pub fn is_off(&self) -> bool {
672        *self == CLTO_A::OFF
673    }
674    #[doc = "Checks if the value of the field is `I2C40PCC`"]
675    #[inline(always)]
676    pub fn is_i2c40pcc(&self) -> bool {
677        *self == CLTO_A::I2C40PCC
678    }
679    #[doc = "Checks if the value of the field is `I2C80PCC`"]
680    #[inline(always)]
681    pub fn is_i2c80pcc(&self) -> bool {
682        *self == CLTO_A::I2C80PCC
683    }
684    #[doc = "Checks if the value of the field is `I2C160PCC`"]
685    #[inline(always)]
686    pub fn is_i2c160pcc(&self) -> bool {
687        *self == CLTO_A::I2C160PCC
688    }
689    #[doc = "Checks if the value of the field is `I2C320PCC`"]
690    #[inline(always)]
691    pub fn is_i2c320pcc(&self) -> bool {
692        *self == CLTO_A::I2C320PCC
693    }
694    #[doc = "Checks if the value of the field is `I2C1024PCC`"]
695    #[inline(always)]
696    pub fn is_i2c1024pcc(&self) -> bool {
697        *self == CLTO_A::I2C1024PCC
698    }
699}
700#[doc = "Field `CLTO` writer - Clock Low Timeout"]
701pub type CLTO_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, CLTO_A, 3, O>;
702impl<'a, const O: u8> CLTO_W<'a, O> {
703    #[doc = "Timeout disabled"]
704    #[inline(always)]
705    pub fn off(self) -> &'a mut W {
706        self.variant(CLTO_A::OFF)
707    }
708    #[doc = "Timeout after 40 prescaled clock cycles. In standard mode at 100 kHz, this results in a 50us timeout."]
709    #[inline(always)]
710    pub fn i2c40pcc(self) -> &'a mut W {
711        self.variant(CLTO_A::I2C40PCC)
712    }
713    #[doc = "Timeout after 80 prescaled clock cycles. In standard mode at 100 kHz, this results in a 100us timeout."]
714    #[inline(always)]
715    pub fn i2c80pcc(self) -> &'a mut W {
716        self.variant(CLTO_A::I2C80PCC)
717    }
718    #[doc = "Timeout after 160 prescaled clock cycles. In standard mode at 100 kHz, this results in a 200us timeout."]
719    #[inline(always)]
720    pub fn i2c160pcc(self) -> &'a mut W {
721        self.variant(CLTO_A::I2C160PCC)
722    }
723    #[doc = "Timeout after 320 prescaled clock cycles. In standard mode at 100 kHz, this results in a 400us timeout."]
724    #[inline(always)]
725    pub fn i2c320pcc(self) -> &'a mut W {
726        self.variant(CLTO_A::I2C320PCC)
727    }
728    #[doc = "Timeout after 1024 prescaled clock cycles. In standard mode at 100 kHz, this results in a 1280us timeout."]
729    #[inline(always)]
730    pub fn i2c1024pcc(self) -> &'a mut W {
731        self.variant(CLTO_A::I2C1024PCC)
732    }
733}
734#[doc = "Field `SCLMONEN` reader - SCL Monitor Enable"]
735pub type SCLMONEN_R = crate::BitReader<SCLMONEN_A>;
736#[doc = "SCL Monitor Enable\n\nValue on reset: 0"]
737#[derive(Clone, Copy, Debug, PartialEq, Eq)]
738pub enum SCLMONEN_A {
739    #[doc = "0: Disable SCL monitor"]
740    DISABLE = 0,
741    #[doc = "1: Enable SCL monitor"]
742    ENABLE = 1,
743}
744impl From<SCLMONEN_A> for bool {
745    #[inline(always)]
746    fn from(variant: SCLMONEN_A) -> Self {
747        variant as u8 != 0
748    }
749}
750impl SCLMONEN_R {
751    #[doc = "Get enumerated values variant"]
752    #[inline(always)]
753    pub fn variant(&self) -> SCLMONEN_A {
754        match self.bits {
755            false => SCLMONEN_A::DISABLE,
756            true => SCLMONEN_A::ENABLE,
757        }
758    }
759    #[doc = "Checks if the value of the field is `DISABLE`"]
760    #[inline(always)]
761    pub fn is_disable(&self) -> bool {
762        *self == SCLMONEN_A::DISABLE
763    }
764    #[doc = "Checks if the value of the field is `ENABLE`"]
765    #[inline(always)]
766    pub fn is_enable(&self) -> bool {
767        *self == SCLMONEN_A::ENABLE
768    }
769}
770#[doc = "Field `SCLMONEN` writer - SCL Monitor Enable"]
771pub type SCLMONEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, SCLMONEN_A, O>;
772impl<'a, const O: u8> SCLMONEN_W<'a, O> {
773    #[doc = "Disable SCL monitor"]
774    #[inline(always)]
775    pub fn disable(self) -> &'a mut W {
776        self.variant(SCLMONEN_A::DISABLE)
777    }
778    #[doc = "Enable SCL monitor"]
779    #[inline(always)]
780    pub fn enable(self) -> &'a mut W {
781        self.variant(SCLMONEN_A::ENABLE)
782    }
783}
784#[doc = "Field `SDAMONEN` reader - SDA Monitor Enable"]
785pub type SDAMONEN_R = crate::BitReader<SDAMONEN_A>;
786#[doc = "SDA Monitor Enable\n\nValue on reset: 0"]
787#[derive(Clone, Copy, Debug, PartialEq, Eq)]
788pub enum SDAMONEN_A {
789    #[doc = "0: Disable SDA Monitor"]
790    DISABLE = 0,
791    #[doc = "1: Enable SDA Monitor"]
792    ENABLE = 1,
793}
794impl From<SDAMONEN_A> for bool {
795    #[inline(always)]
796    fn from(variant: SDAMONEN_A) -> Self {
797        variant as u8 != 0
798    }
799}
800impl SDAMONEN_R {
801    #[doc = "Get enumerated values variant"]
802    #[inline(always)]
803    pub fn variant(&self) -> SDAMONEN_A {
804        match self.bits {
805            false => SDAMONEN_A::DISABLE,
806            true => SDAMONEN_A::ENABLE,
807        }
808    }
809    #[doc = "Checks if the value of the field is `DISABLE`"]
810    #[inline(always)]
811    pub fn is_disable(&self) -> bool {
812        *self == SDAMONEN_A::DISABLE
813    }
814    #[doc = "Checks if the value of the field is `ENABLE`"]
815    #[inline(always)]
816    pub fn is_enable(&self) -> bool {
817        *self == SDAMONEN_A::ENABLE
818    }
819}
820#[doc = "Field `SDAMONEN` writer - SDA Monitor Enable"]
821pub type SDAMONEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CTRL_SPEC, SDAMONEN_A, O>;
822impl<'a, const O: u8> SDAMONEN_W<'a, O> {
823    #[doc = "Disable SDA Monitor"]
824    #[inline(always)]
825    pub fn disable(self) -> &'a mut W {
826        self.variant(SDAMONEN_A::DISABLE)
827    }
828    #[doc = "Enable SDA Monitor"]
829    #[inline(always)]
830    pub fn enable(self) -> &'a mut W {
831        self.variant(SDAMONEN_A::ENABLE)
832    }
833}
834impl R {
835    #[doc = "Bit 0 - Soft Reset the internal state registers"]
836    #[inline(always)]
837    pub fn corerst(&self) -> CORERST_R {
838        CORERST_R::new((self.bits & 1) != 0)
839    }
840    #[doc = "Bit 1 - Addressable as Follower"]
841    #[inline(always)]
842    pub fn slave(&self) -> SLAVE_R {
843        SLAVE_R::new(((self.bits >> 1) & 1) != 0)
844    }
845    #[doc = "Bit 2 - Automatic Acknowledge"]
846    #[inline(always)]
847    pub fn autoack(&self) -> AUTOACK_R {
848        AUTOACK_R::new(((self.bits >> 2) & 1) != 0)
849    }
850    #[doc = "Bit 3 - Automatic STOP when Empty"]
851    #[inline(always)]
852    pub fn autose(&self) -> AUTOSE_R {
853        AUTOSE_R::new(((self.bits >> 3) & 1) != 0)
854    }
855    #[doc = "Bit 4 - Automatic STOP on NACK"]
856    #[inline(always)]
857    pub fn autosn(&self) -> AUTOSN_R {
858        AUTOSN_R::new(((self.bits >> 4) & 1) != 0)
859    }
860    #[doc = "Bit 5 - Arbitration Disable"]
861    #[inline(always)]
862    pub fn arbdis(&self) -> ARBDIS_R {
863        ARBDIS_R::new(((self.bits >> 5) & 1) != 0)
864    }
865    #[doc = "Bit 6 - General Call Address Match Enable"]
866    #[inline(always)]
867    pub fn gcamen(&self) -> GCAMEN_R {
868        GCAMEN_R::new(((self.bits >> 6) & 1) != 0)
869    }
870    #[doc = "Bit 7 - TX Buffer Interrupt Level"]
871    #[inline(always)]
872    pub fn txbil(&self) -> TXBIL_R {
873        TXBIL_R::new(((self.bits >> 7) & 1) != 0)
874    }
875    #[doc = "Bits 8:9 - Clock Low High Ratio"]
876    #[inline(always)]
877    pub fn clhr(&self) -> CLHR_R {
878        CLHR_R::new(((self.bits >> 8) & 3) as u8)
879    }
880    #[doc = "Bits 12:13 - Bus Idle Timeout"]
881    #[inline(always)]
882    pub fn bito(&self) -> BITO_R {
883        BITO_R::new(((self.bits >> 12) & 3) as u8)
884    }
885    #[doc = "Bit 15 - Go Idle on Bus Idle Timeout"]
886    #[inline(always)]
887    pub fn gibito(&self) -> GIBITO_R {
888        GIBITO_R::new(((self.bits >> 15) & 1) != 0)
889    }
890    #[doc = "Bits 16:18 - Clock Low Timeout"]
891    #[inline(always)]
892    pub fn clto(&self) -> CLTO_R {
893        CLTO_R::new(((self.bits >> 16) & 7) as u8)
894    }
895    #[doc = "Bit 20 - SCL Monitor Enable"]
896    #[inline(always)]
897    pub fn sclmonen(&self) -> SCLMONEN_R {
898        SCLMONEN_R::new(((self.bits >> 20) & 1) != 0)
899    }
900    #[doc = "Bit 21 - SDA Monitor Enable"]
901    #[inline(always)]
902    pub fn sdamonen(&self) -> SDAMONEN_R {
903        SDAMONEN_R::new(((self.bits >> 21) & 1) != 0)
904    }
905}
906impl W {
907    #[doc = "Bit 0 - Soft Reset the internal state registers"]
908    #[inline(always)]
909    #[must_use]
910    pub fn corerst(&mut self) -> CORERST_W<0> {
911        CORERST_W::new(self)
912    }
913    #[doc = "Bit 1 - Addressable as Follower"]
914    #[inline(always)]
915    #[must_use]
916    pub fn slave(&mut self) -> SLAVE_W<1> {
917        SLAVE_W::new(self)
918    }
919    #[doc = "Bit 2 - Automatic Acknowledge"]
920    #[inline(always)]
921    #[must_use]
922    pub fn autoack(&mut self) -> AUTOACK_W<2> {
923        AUTOACK_W::new(self)
924    }
925    #[doc = "Bit 3 - Automatic STOP when Empty"]
926    #[inline(always)]
927    #[must_use]
928    pub fn autose(&mut self) -> AUTOSE_W<3> {
929        AUTOSE_W::new(self)
930    }
931    #[doc = "Bit 4 - Automatic STOP on NACK"]
932    #[inline(always)]
933    #[must_use]
934    pub fn autosn(&mut self) -> AUTOSN_W<4> {
935        AUTOSN_W::new(self)
936    }
937    #[doc = "Bit 5 - Arbitration Disable"]
938    #[inline(always)]
939    #[must_use]
940    pub fn arbdis(&mut self) -> ARBDIS_W<5> {
941        ARBDIS_W::new(self)
942    }
943    #[doc = "Bit 6 - General Call Address Match Enable"]
944    #[inline(always)]
945    #[must_use]
946    pub fn gcamen(&mut self) -> GCAMEN_W<6> {
947        GCAMEN_W::new(self)
948    }
949    #[doc = "Bit 7 - TX Buffer Interrupt Level"]
950    #[inline(always)]
951    #[must_use]
952    pub fn txbil(&mut self) -> TXBIL_W<7> {
953        TXBIL_W::new(self)
954    }
955    #[doc = "Bits 8:9 - Clock Low High Ratio"]
956    #[inline(always)]
957    #[must_use]
958    pub fn clhr(&mut self) -> CLHR_W<8> {
959        CLHR_W::new(self)
960    }
961    #[doc = "Bits 12:13 - Bus Idle Timeout"]
962    #[inline(always)]
963    #[must_use]
964    pub fn bito(&mut self) -> BITO_W<12> {
965        BITO_W::new(self)
966    }
967    #[doc = "Bit 15 - Go Idle on Bus Idle Timeout"]
968    #[inline(always)]
969    #[must_use]
970    pub fn gibito(&mut self) -> GIBITO_W<15> {
971        GIBITO_W::new(self)
972    }
973    #[doc = "Bits 16:18 - Clock Low Timeout"]
974    #[inline(always)]
975    #[must_use]
976    pub fn clto(&mut self) -> CLTO_W<16> {
977        CLTO_W::new(self)
978    }
979    #[doc = "Bit 20 - SCL Monitor Enable"]
980    #[inline(always)]
981    #[must_use]
982    pub fn sclmonen(&mut self) -> SCLMONEN_W<20> {
983        SCLMONEN_W::new(self)
984    }
985    #[doc = "Bit 21 - SDA Monitor Enable"]
986    #[inline(always)]
987    #[must_use]
988    pub fn sdamonen(&mut self) -> SDAMONEN_W<21> {
989        SDAMONEN_W::new(self)
990    }
991    #[doc = "Writes raw bits to the register."]
992    #[inline(always)]
993    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
994        self.0.bits(bits);
995        self
996    }
997}
998#[doc = "No Description\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 [ctrl](index.html) module"]
999pub struct CTRL_SPEC;
1000impl crate::RegisterSpec for CTRL_SPEC {
1001    type Ux = u32;
1002}
1003#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
1004impl crate::Readable for CTRL_SPEC {
1005    type Reader = R;
1006}
1007#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
1008impl crate::Writable for CTRL_SPEC {
1009    type Writer = W;
1010    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
1011    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
1012}
1013#[doc = "`reset()` method sets CTRL to value 0"]
1014impl crate::Resettable for CTRL_SPEC {
1015    const RESET_VALUE: Self::Ux = 0;
1016}