avr_device/devices/atmega328p/exint/
eicra.rs1#[doc = "Register `EICRA` reader"]
2pub struct R(crate::R<EICRA_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<EICRA_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<EICRA_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<EICRA_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `EICRA` writer"]
17pub struct W(crate::W<EICRA_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<EICRA_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<EICRA_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<EICRA_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `ISC0` reader - External Interrupt Sense Control 0 Bits"]
38pub type ISC0_R = crate::FieldReader<u8, ISC0_A>;
39#[doc = "External Interrupt Sense Control 0 Bits\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum ISC0_A {
43 #[doc = "0: Low Level of INTX"]
44 VAL_0X00 = 0,
45 #[doc = "1: Any Logical Change of INTX"]
46 VAL_0X01 = 1,
47 #[doc = "2: Falling Edge of INTX"]
48 VAL_0X02 = 2,
49 #[doc = "3: Rising Edge of INTX"]
50 VAL_0X03 = 3,
51}
52impl From<ISC0_A> for u8 {
53 #[inline(always)]
54 fn from(variant: ISC0_A) -> Self {
55 variant as _
56 }
57}
58impl ISC0_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> ISC0_A {
62 match self.bits {
63 0 => ISC0_A::VAL_0X00,
64 1 => ISC0_A::VAL_0X01,
65 2 => ISC0_A::VAL_0X02,
66 3 => ISC0_A::VAL_0X03,
67 _ => unreachable!(),
68 }
69 }
70 #[doc = "Checks if the value of the field is `VAL_0X00`"]
71 #[inline(always)]
72 pub fn is_val_0x00(&self) -> bool {
73 *self == ISC0_A::VAL_0X00
74 }
75 #[doc = "Checks if the value of the field is `VAL_0X01`"]
76 #[inline(always)]
77 pub fn is_val_0x01(&self) -> bool {
78 *self == ISC0_A::VAL_0X01
79 }
80 #[doc = "Checks if the value of the field is `VAL_0X02`"]
81 #[inline(always)]
82 pub fn is_val_0x02(&self) -> bool {
83 *self == ISC0_A::VAL_0X02
84 }
85 #[doc = "Checks if the value of the field is `VAL_0X03`"]
86 #[inline(always)]
87 pub fn is_val_0x03(&self) -> bool {
88 *self == ISC0_A::VAL_0X03
89 }
90}
91#[doc = "Field `ISC0` writer - External Interrupt Sense Control 0 Bits"]
92pub type ISC0_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, EICRA_SPEC, u8, ISC0_A, 2, O>;
93impl<'a, const O: u8> ISC0_W<'a, O> {
94 #[doc = "Low Level of INTX"]
95 #[inline(always)]
96 pub fn val_0x00(self) -> &'a mut W {
97 self.variant(ISC0_A::VAL_0X00)
98 }
99 #[doc = "Any Logical Change of INTX"]
100 #[inline(always)]
101 pub fn val_0x01(self) -> &'a mut W {
102 self.variant(ISC0_A::VAL_0X01)
103 }
104 #[doc = "Falling Edge of INTX"]
105 #[inline(always)]
106 pub fn val_0x02(self) -> &'a mut W {
107 self.variant(ISC0_A::VAL_0X02)
108 }
109 #[doc = "Rising Edge of INTX"]
110 #[inline(always)]
111 pub fn val_0x03(self) -> &'a mut W {
112 self.variant(ISC0_A::VAL_0X03)
113 }
114}
115#[doc = "Field `ISC1` reader - External Interrupt Sense Control 1 Bits"]
116pub type ISC1_R = crate::FieldReader<u8, ISC1_A>;
117#[doc = "External Interrupt Sense Control 1 Bits\n\nValue on reset: 0"]
118#[derive(Clone, Copy, Debug, PartialEq, Eq)]
119#[repr(u8)]
120pub enum ISC1_A {
121 #[doc = "0: Low Level of INTX"]
122 VAL_0X00 = 0,
123 #[doc = "1: Any Logical Change of INTX"]
124 VAL_0X01 = 1,
125 #[doc = "2: Falling Edge of INTX"]
126 VAL_0X02 = 2,
127 #[doc = "3: Rising Edge of INTX"]
128 VAL_0X03 = 3,
129}
130impl From<ISC1_A> for u8 {
131 #[inline(always)]
132 fn from(variant: ISC1_A) -> Self {
133 variant as _
134 }
135}
136impl ISC1_R {
137 #[doc = "Get enumerated values variant"]
138 #[inline(always)]
139 pub fn variant(&self) -> ISC1_A {
140 match self.bits {
141 0 => ISC1_A::VAL_0X00,
142 1 => ISC1_A::VAL_0X01,
143 2 => ISC1_A::VAL_0X02,
144 3 => ISC1_A::VAL_0X03,
145 _ => unreachable!(),
146 }
147 }
148 #[doc = "Checks if the value of the field is `VAL_0X00`"]
149 #[inline(always)]
150 pub fn is_val_0x00(&self) -> bool {
151 *self == ISC1_A::VAL_0X00
152 }
153 #[doc = "Checks if the value of the field is `VAL_0X01`"]
154 #[inline(always)]
155 pub fn is_val_0x01(&self) -> bool {
156 *self == ISC1_A::VAL_0X01
157 }
158 #[doc = "Checks if the value of the field is `VAL_0X02`"]
159 #[inline(always)]
160 pub fn is_val_0x02(&self) -> bool {
161 *self == ISC1_A::VAL_0X02
162 }
163 #[doc = "Checks if the value of the field is `VAL_0X03`"]
164 #[inline(always)]
165 pub fn is_val_0x03(&self) -> bool {
166 *self == ISC1_A::VAL_0X03
167 }
168}
169#[doc = "Field `ISC1` writer - External Interrupt Sense Control 1 Bits"]
170pub type ISC1_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, EICRA_SPEC, u8, ISC1_A, 2, O>;
171impl<'a, const O: u8> ISC1_W<'a, O> {
172 #[doc = "Low Level of INTX"]
173 #[inline(always)]
174 pub fn val_0x00(self) -> &'a mut W {
175 self.variant(ISC1_A::VAL_0X00)
176 }
177 #[doc = "Any Logical Change of INTX"]
178 #[inline(always)]
179 pub fn val_0x01(self) -> &'a mut W {
180 self.variant(ISC1_A::VAL_0X01)
181 }
182 #[doc = "Falling Edge of INTX"]
183 #[inline(always)]
184 pub fn val_0x02(self) -> &'a mut W {
185 self.variant(ISC1_A::VAL_0X02)
186 }
187 #[doc = "Rising Edge of INTX"]
188 #[inline(always)]
189 pub fn val_0x03(self) -> &'a mut W {
190 self.variant(ISC1_A::VAL_0X03)
191 }
192}
193impl R {
194 #[doc = "Bits 0:1 - External Interrupt Sense Control 0 Bits"]
195 #[inline(always)]
196 pub fn isc0(&self) -> ISC0_R {
197 ISC0_R::new(self.bits & 3)
198 }
199 #[doc = "Bits 2:3 - External Interrupt Sense Control 1 Bits"]
200 #[inline(always)]
201 pub fn isc1(&self) -> ISC1_R {
202 ISC1_R::new((self.bits >> 2) & 3)
203 }
204}
205impl W {
206 #[doc = "Bits 0:1 - External Interrupt Sense Control 0 Bits"]
207 #[inline(always)]
208 #[must_use]
209 pub fn isc0(&mut self) -> ISC0_W<0> {
210 ISC0_W::new(self)
211 }
212 #[doc = "Bits 2:3 - External Interrupt Sense Control 1 Bits"]
213 #[inline(always)]
214 #[must_use]
215 pub fn isc1(&mut self) -> ISC1_W<2> {
216 ISC1_W::new(self)
217 }
218 #[doc = "Writes raw bits to the register."]
219 #[inline(always)]
220 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
221 self.0.bits(bits);
222 self
223 }
224}
225#[doc = "External Interrupt Control 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 [eicra](index.html) module"]
226pub struct EICRA_SPEC;
227impl crate::RegisterSpec for EICRA_SPEC {
228 type Ux = u8;
229}
230#[doc = "`read()` method returns [eicra::R](R) reader structure"]
231impl crate::Readable for EICRA_SPEC {
232 type Reader = R;
233}
234#[doc = "`write(|w| ..)` method takes [eicra::W](W) writer structure"]
235impl crate::Writable for EICRA_SPEC {
236 type Writer = W;
237 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
238 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
239}
240#[doc = "`reset()` method sets EICRA to value 0"]
241impl crate::Resettable for EICRA_SPEC {
242 const RESET_VALUE: Self::Ux = 0;
243}