1#[doc = "Register `twi_efr` reader"]
2pub type R = crate::R<TWI_EFR_SPEC>;
3#[doc = "Register `twi_efr` writer"]
4pub type W = crate::W<TWI_EFR_SPEC>;
5#[doc = "Field `dbn` reader - Data Byte Number Follow Read Command Control"]
6pub type DBN_R = crate::FieldReader<DBN_A>;
7#[doc = "Data Byte Number Follow Read Command Control\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum DBN_A {
11 #[doc = "0: No data byte can be written after the read command"]
12 B0 = 0,
13 #[doc = "1: 1-byte data can be written after the read command"]
14 B1 = 1,
15 #[doc = "2: 2-byte data can be written after the read command"]
16 B2 = 2,
17 #[doc = "3: 3-byte data can be written after the read command"]
18 B3 = 3,
19}
20impl From<DBN_A> for u8 {
21 #[inline(always)]
22 fn from(variant: DBN_A) -> Self {
23 variant as _
24 }
25}
26impl crate::FieldSpec for DBN_A {
27 type Ux = u8;
28}
29impl DBN_R {
30 #[doc = "Get enumerated values variant"]
31 #[inline(always)]
32 pub const fn variant(&self) -> DBN_A {
33 match self.bits {
34 0 => DBN_A::B0,
35 1 => DBN_A::B1,
36 2 => DBN_A::B2,
37 3 => DBN_A::B3,
38 _ => unreachable!(),
39 }
40 }
41 #[doc = "No data byte can be written after the read command"]
42 #[inline(always)]
43 pub fn is_b0(&self) -> bool {
44 *self == DBN_A::B0
45 }
46 #[doc = "1-byte data can be written after the read command"]
47 #[inline(always)]
48 pub fn is_b1(&self) -> bool {
49 *self == DBN_A::B1
50 }
51 #[doc = "2-byte data can be written after the read command"]
52 #[inline(always)]
53 pub fn is_b2(&self) -> bool {
54 *self == DBN_A::B2
55 }
56 #[doc = "3-byte data can be written after the read command"]
57 #[inline(always)]
58 pub fn is_b3(&self) -> bool {
59 *self == DBN_A::B3
60 }
61}
62#[doc = "Field `dbn` writer - Data Byte Number Follow Read Command Control"]
63pub type DBN_W<'a, REG> = crate::FieldWriterSafe<'a, REG, 2, DBN_A>;
64impl<'a, REG> DBN_W<'a, REG>
65where
66 REG: crate::Writable + crate::RegisterSpec,
67 REG::Ux: From<u8>,
68{
69 #[doc = "No data byte can be written after the read command"]
70 #[inline(always)]
71 pub fn b0(self) -> &'a mut crate::W<REG> {
72 self.variant(DBN_A::B0)
73 }
74 #[doc = "1-byte data can be written after the read command"]
75 #[inline(always)]
76 pub fn b1(self) -> &'a mut crate::W<REG> {
77 self.variant(DBN_A::B1)
78 }
79 #[doc = "2-byte data can be written after the read command"]
80 #[inline(always)]
81 pub fn b2(self) -> &'a mut crate::W<REG> {
82 self.variant(DBN_A::B2)
83 }
84 #[doc = "3-byte data can be written after the read command"]
85 #[inline(always)]
86 pub fn b3(self) -> &'a mut crate::W<REG> {
87 self.variant(DBN_A::B3)
88 }
89}
90impl R {
91 #[doc = "Bits 0:1 - Data Byte Number Follow Read Command Control"]
92 #[inline(always)]
93 pub fn dbn(&self) -> DBN_R {
94 DBN_R::new((self.bits & 3) as u8)
95 }
96}
97impl W {
98 #[doc = "Bits 0:1 - Data Byte Number Follow Read Command Control"]
99 #[inline(always)]
100 #[must_use]
101 pub fn dbn(&mut self) -> DBN_W<TWI_EFR_SPEC> {
102 DBN_W::new(self, 0)
103 }
104 #[doc = r" Writes raw bits to the register."]
105 #[doc = r""]
106 #[doc = r" # Safety"]
107 #[doc = r""]
108 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
109 #[inline(always)]
110 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
111 self.bits = bits;
112 self
113 }
114}
115#[doc = "TWI Enhance Feature Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`twi_efr::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`twi_efr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
116pub struct TWI_EFR_SPEC;
117impl crate::RegisterSpec for TWI_EFR_SPEC {
118 type Ux = u32;
119}
120#[doc = "`read()` method returns [`twi_efr::R`](R) reader structure"]
121impl crate::Readable for TWI_EFR_SPEC {}
122#[doc = "`write(|w| ..)` method takes [`twi_efr::W`](W) writer structure"]
123impl crate::Writable for TWI_EFR_SPEC {
124 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
125 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
126}
127#[doc = "`reset()` method sets twi_efr to value 0"]
128impl crate::Resettable for TWI_EFR_SPEC {
129 const RESET_VALUE: Self::Ux = 0;
130}