avr_device/devices/atmega4809/evsys/
userevouta.rs1#[doc = "Register `USEREVOUTA` reader"]
2pub struct R(crate::R<USEREVOUTA_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<USEREVOUTA_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<USEREVOUTA_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<USEREVOUTA_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `USEREVOUTA` writer"]
17pub struct W(crate::W<USEREVOUTA_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<USEREVOUTA_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<USEREVOUTA_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<USEREVOUTA_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `CHANNEL` reader - Channel selector"]
38pub type CHANNEL_R = crate::FieldReader<u8, CHANNEL_A>;
39#[doc = "Channel selector\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum CHANNEL_A {
43 #[doc = "0: Off"]
44 OFF = 0,
45 #[doc = "1: Connect user to event channel 0"]
46 CHANNEL0 = 1,
47 #[doc = "2: Connect user to event channel 1"]
48 CHANNEL1 = 2,
49 #[doc = "3: Connect user to event channel 2"]
50 CHANNEL2 = 3,
51 #[doc = "4: Connect user to event channel 3"]
52 CHANNEL3 = 4,
53 #[doc = "5: Connect user to event channel 4"]
54 CHANNEL4 = 5,
55 #[doc = "6: Connect user to event channel 5"]
56 CHANNEL5 = 6,
57 #[doc = "7: Connect user to event channel 6"]
58 CHANNEL6 = 7,
59 #[doc = "8: Connect user to event channel 7"]
60 CHANNEL7 = 8,
61}
62impl From<CHANNEL_A> for u8 {
63 #[inline(always)]
64 fn from(variant: CHANNEL_A) -> Self {
65 variant as _
66 }
67}
68impl CHANNEL_R {
69 #[doc = "Get enumerated values variant"]
70 #[inline(always)]
71 pub fn variant(&self) -> Option<CHANNEL_A> {
72 match self.bits {
73 0 => Some(CHANNEL_A::OFF),
74 1 => Some(CHANNEL_A::CHANNEL0),
75 2 => Some(CHANNEL_A::CHANNEL1),
76 3 => Some(CHANNEL_A::CHANNEL2),
77 4 => Some(CHANNEL_A::CHANNEL3),
78 5 => Some(CHANNEL_A::CHANNEL4),
79 6 => Some(CHANNEL_A::CHANNEL5),
80 7 => Some(CHANNEL_A::CHANNEL6),
81 8 => Some(CHANNEL_A::CHANNEL7),
82 _ => None,
83 }
84 }
85 #[doc = "Checks if the value of the field is `OFF`"]
86 #[inline(always)]
87 pub fn is_off(&self) -> bool {
88 *self == CHANNEL_A::OFF
89 }
90 #[doc = "Checks if the value of the field is `CHANNEL0`"]
91 #[inline(always)]
92 pub fn is_channel0(&self) -> bool {
93 *self == CHANNEL_A::CHANNEL0
94 }
95 #[doc = "Checks if the value of the field is `CHANNEL1`"]
96 #[inline(always)]
97 pub fn is_channel1(&self) -> bool {
98 *self == CHANNEL_A::CHANNEL1
99 }
100 #[doc = "Checks if the value of the field is `CHANNEL2`"]
101 #[inline(always)]
102 pub fn is_channel2(&self) -> bool {
103 *self == CHANNEL_A::CHANNEL2
104 }
105 #[doc = "Checks if the value of the field is `CHANNEL3`"]
106 #[inline(always)]
107 pub fn is_channel3(&self) -> bool {
108 *self == CHANNEL_A::CHANNEL3
109 }
110 #[doc = "Checks if the value of the field is `CHANNEL4`"]
111 #[inline(always)]
112 pub fn is_channel4(&self) -> bool {
113 *self == CHANNEL_A::CHANNEL4
114 }
115 #[doc = "Checks if the value of the field is `CHANNEL5`"]
116 #[inline(always)]
117 pub fn is_channel5(&self) -> bool {
118 *self == CHANNEL_A::CHANNEL5
119 }
120 #[doc = "Checks if the value of the field is `CHANNEL6`"]
121 #[inline(always)]
122 pub fn is_channel6(&self) -> bool {
123 *self == CHANNEL_A::CHANNEL6
124 }
125 #[doc = "Checks if the value of the field is `CHANNEL7`"]
126 #[inline(always)]
127 pub fn is_channel7(&self) -> bool {
128 *self == CHANNEL_A::CHANNEL7
129 }
130}
131#[doc = "Field `CHANNEL` writer - Channel selector"]
132pub type CHANNEL_W<'a, const O: u8> =
133 crate::FieldWriter<'a, u8, USEREVOUTA_SPEC, u8, CHANNEL_A, 8, O>;
134impl<'a, const O: u8> CHANNEL_W<'a, O> {
135 #[doc = "Off"]
136 #[inline(always)]
137 pub fn off(self) -> &'a mut W {
138 self.variant(CHANNEL_A::OFF)
139 }
140 #[doc = "Connect user to event channel 0"]
141 #[inline(always)]
142 pub fn channel0(self) -> &'a mut W {
143 self.variant(CHANNEL_A::CHANNEL0)
144 }
145 #[doc = "Connect user to event channel 1"]
146 #[inline(always)]
147 pub fn channel1(self) -> &'a mut W {
148 self.variant(CHANNEL_A::CHANNEL1)
149 }
150 #[doc = "Connect user to event channel 2"]
151 #[inline(always)]
152 pub fn channel2(self) -> &'a mut W {
153 self.variant(CHANNEL_A::CHANNEL2)
154 }
155 #[doc = "Connect user to event channel 3"]
156 #[inline(always)]
157 pub fn channel3(self) -> &'a mut W {
158 self.variant(CHANNEL_A::CHANNEL3)
159 }
160 #[doc = "Connect user to event channel 4"]
161 #[inline(always)]
162 pub fn channel4(self) -> &'a mut W {
163 self.variant(CHANNEL_A::CHANNEL4)
164 }
165 #[doc = "Connect user to event channel 5"]
166 #[inline(always)]
167 pub fn channel5(self) -> &'a mut W {
168 self.variant(CHANNEL_A::CHANNEL5)
169 }
170 #[doc = "Connect user to event channel 6"]
171 #[inline(always)]
172 pub fn channel6(self) -> &'a mut W {
173 self.variant(CHANNEL_A::CHANNEL6)
174 }
175 #[doc = "Connect user to event channel 7"]
176 #[inline(always)]
177 pub fn channel7(self) -> &'a mut W {
178 self.variant(CHANNEL_A::CHANNEL7)
179 }
180}
181impl R {
182 #[doc = "Bits 0:7 - Channel selector"]
183 #[inline(always)]
184 pub fn channel(&self) -> CHANNEL_R {
185 CHANNEL_R::new(self.bits)
186 }
187}
188impl W {
189 #[doc = "Bits 0:7 - Channel selector"]
190 #[inline(always)]
191 #[must_use]
192 pub fn channel(&mut self) -> CHANNEL_W<0> {
193 CHANNEL_W::new(self)
194 }
195 #[doc = "Writes raw bits to the register."]
196 #[inline(always)]
197 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
198 self.0.bits(bits);
199 self
200 }
201}
202#[doc = "User EVOUT Port A\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 [userevouta](index.html) module"]
203pub struct USEREVOUTA_SPEC;
204impl crate::RegisterSpec for USEREVOUTA_SPEC {
205 type Ux = u8;
206}
207#[doc = "`read()` method returns [userevouta::R](R) reader structure"]
208impl crate::Readable for USEREVOUTA_SPEC {
209 type Reader = R;
210}
211#[doc = "`write(|w| ..)` method takes [userevouta::W](W) writer structure"]
212impl crate::Writable for USEREVOUTA_SPEC {
213 type Writer = W;
214 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
215 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
216}
217#[doc = "`reset()` method sets USEREVOUTA to value 0"]
218impl crate::Resettable for USEREVOUTA_SPEC {
219 const RESET_VALUE: Self::Ux = 0;
220}