1#[doc = "Register `DCPMAXP` reader"]
2pub struct R(crate::R<DCPMAXP_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<DCPMAXP_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<DCPMAXP_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<DCPMAXP_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `DCPMAXP` writer"]
17pub struct W(crate::W<DCPMAXP_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<DCPMAXP_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<DCPMAXP_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<DCPMAXP_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `MXPS` reader - Maximum Packet SizeThese bits set the maximum amount of data (maximum packet size) in payloads for the DCP."]
38pub type MXPS_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `MXPS` writer - Maximum Packet SizeThese bits set the maximum amount of data (maximum packet size) in payloads for the DCP."]
40pub type MXPS_W<'a, const O: u8> = crate::FieldWriter<'a, u16, DCPMAXP_SPEC, u8, u8, 7, O>;
41#[doc = "Field `DEVSEL` reader - Device Select"]
42pub type DEVSEL_R = crate::FieldReader<u8, DEVSEL_A>;
43#[doc = "Device Select\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45#[repr(u8)]
46pub enum DEVSEL_A {
47 #[doc = "0: Address 0000"]
48 _0000 = 0,
49 #[doc = "1: Address 0001"]
50 _0001 = 1,
51 #[doc = "2: Address 0010"]
52 _0010 = 2,
53 #[doc = "3: Address 0011"]
54 _0011 = 3,
55 #[doc = "4: Address 0100"]
56 _0100 = 4,
57 #[doc = "5: Address 0101"]
58 _0101 = 5,
59}
60impl From<DEVSEL_A> for u8 {
61 #[inline(always)]
62 fn from(variant: DEVSEL_A) -> Self {
63 variant as _
64 }
65}
66impl DEVSEL_R {
67 #[doc = "Get enumerated values variant"]
68 #[inline(always)]
69 pub fn variant(&self) -> Option<DEVSEL_A> {
70 match self.bits {
71 0 => Some(DEVSEL_A::_0000),
72 1 => Some(DEVSEL_A::_0001),
73 2 => Some(DEVSEL_A::_0010),
74 3 => Some(DEVSEL_A::_0011),
75 4 => Some(DEVSEL_A::_0100),
76 5 => Some(DEVSEL_A::_0101),
77 _ => None,
78 }
79 }
80 #[doc = "Checks if the value of the field is `_0000`"]
81 #[inline(always)]
82 pub fn is_0000(&self) -> bool {
83 *self == DEVSEL_A::_0000
84 }
85 #[doc = "Checks if the value of the field is `_0001`"]
86 #[inline(always)]
87 pub fn is_0001(&self) -> bool {
88 *self == DEVSEL_A::_0001
89 }
90 #[doc = "Checks if the value of the field is `_0010`"]
91 #[inline(always)]
92 pub fn is_0010(&self) -> bool {
93 *self == DEVSEL_A::_0010
94 }
95 #[doc = "Checks if the value of the field is `_0011`"]
96 #[inline(always)]
97 pub fn is_0011(&self) -> bool {
98 *self == DEVSEL_A::_0011
99 }
100 #[doc = "Checks if the value of the field is `_0100`"]
101 #[inline(always)]
102 pub fn is_0100(&self) -> bool {
103 *self == DEVSEL_A::_0100
104 }
105 #[doc = "Checks if the value of the field is `_0101`"]
106 #[inline(always)]
107 pub fn is_0101(&self) -> bool {
108 *self == DEVSEL_A::_0101
109 }
110}
111#[doc = "Field `DEVSEL` writer - Device Select"]
112pub type DEVSEL_W<'a, const O: u8> = crate::FieldWriter<'a, u16, DCPMAXP_SPEC, u8, DEVSEL_A, 4, O>;
113impl<'a, const O: u8> DEVSEL_W<'a, O> {
114 #[doc = "Address 0000"]
115 #[inline(always)]
116 pub fn _0000(self) -> &'a mut W {
117 self.variant(DEVSEL_A::_0000)
118 }
119 #[doc = "Address 0001"]
120 #[inline(always)]
121 pub fn _0001(self) -> &'a mut W {
122 self.variant(DEVSEL_A::_0001)
123 }
124 #[doc = "Address 0010"]
125 #[inline(always)]
126 pub fn _0010(self) -> &'a mut W {
127 self.variant(DEVSEL_A::_0010)
128 }
129 #[doc = "Address 0011"]
130 #[inline(always)]
131 pub fn _0011(self) -> &'a mut W {
132 self.variant(DEVSEL_A::_0011)
133 }
134 #[doc = "Address 0100"]
135 #[inline(always)]
136 pub fn _0100(self) -> &'a mut W {
137 self.variant(DEVSEL_A::_0100)
138 }
139 #[doc = "Address 0101"]
140 #[inline(always)]
141 pub fn _0101(self) -> &'a mut W {
142 self.variant(DEVSEL_A::_0101)
143 }
144}
145impl R {
146 #[doc = "Bits 0:6 - Maximum Packet SizeThese bits set the maximum amount of data (maximum packet size) in payloads for the DCP."]
147 #[inline(always)]
148 pub fn mxps(&self) -> MXPS_R {
149 MXPS_R::new((self.bits & 0x7f) as u8)
150 }
151 #[doc = "Bits 12:15 - Device Select"]
152 #[inline(always)]
153 pub fn devsel(&self) -> DEVSEL_R {
154 DEVSEL_R::new(((self.bits >> 12) & 0x0f) as u8)
155 }
156}
157impl W {
158 #[doc = "Bits 0:6 - Maximum Packet SizeThese bits set the maximum amount of data (maximum packet size) in payloads for the DCP."]
159 #[inline(always)]
160 #[must_use]
161 pub fn mxps(&mut self) -> MXPS_W<0> {
162 MXPS_W::new(self)
163 }
164 #[doc = "Bits 12:15 - Device Select"]
165 #[inline(always)]
166 #[must_use]
167 pub fn devsel(&mut self) -> DEVSEL_W<12> {
168 DEVSEL_W::new(self)
169 }
170 #[doc = "Writes raw bits to the register."]
171 #[inline(always)]
172 pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
173 self.0.bits(bits);
174 self
175 }
176}
177#[doc = "DCP Maximum Packet Size Register\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 [dcpmaxp](index.html) module"]
178pub struct DCPMAXP_SPEC;
179impl crate::RegisterSpec for DCPMAXP_SPEC {
180 type Ux = u16;
181}
182#[doc = "`read()` method returns [dcpmaxp::R](R) reader structure"]
183impl crate::Readable for DCPMAXP_SPEC {
184 type Reader = R;
185}
186#[doc = "`write(|w| ..)` method takes [dcpmaxp::W](W) writer structure"]
187impl crate::Writable for DCPMAXP_SPEC {
188 type Writer = W;
189 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
190 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
191}
192#[doc = "`reset()` method sets DCPMAXP to value 0x40"]
193impl crate::Resettable for DCPMAXP_SPEC {
194 const RESET_VALUE: Self::Ux = 0x40;
195}