megatiny_hal/attiny412pac/evsys/
asyncuser6.rs1#[doc = "Register `ASYNCUSER6` reader"]
2pub struct R(crate::attiny412pac::R<ASYNCUSER6_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::attiny412pac::R<ASYNCUSER6_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::attiny412pac::R<ASYNCUSER6_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::attiny412pac::R<ASYNCUSER6_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `ASYNCUSER6` writer"]
17pub struct W(crate::attiny412pac::W<ASYNCUSER6_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::attiny412pac::W<ASYNCUSER6_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::attiny412pac::W<ASYNCUSER6_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::attiny412pac::W<ASYNCUSER6_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Asynchronous User Ch 6 Input Selection - TCD0 Event 0\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum ASYNCUSER6_A {
41 #[doc = "0: Off"]
42 OFF = 0,
43 #[doc = "1: Synchronous Event Channel 0"]
44 SYNCCH0 = 1,
45 #[doc = "2: Synchronous Event Channel 1"]
46 SYNCCH1 = 2,
47 #[doc = "3: Asynchronous Event Channel 0"]
48 ASYNCCH0 = 3,
49 #[doc = "4: Asynchronous Event Channel 1"]
50 ASYNCCH1 = 4,
51 #[doc = "5: Asynchronous Event Channel 2"]
52 ASYNCCH2 = 5,
53 #[doc = "6: Asynchronous Event Channel 3"]
54 ASYNCCH3 = 6,
55}
56impl From<ASYNCUSER6_A> for u8 {
57 #[inline(always)]
58 fn from(variant: ASYNCUSER6_A) -> Self {
59 variant as _
60 }
61}
62#[doc = "Field `ASYNCUSER6` reader - Asynchronous User Ch 6 Input Selection - TCD0 Event 0"]
63pub type ASYNCUSER6_R = crate::attiny412pac::FieldReader<u8, ASYNCUSER6_A>;
64impl ASYNCUSER6_R {
65 #[doc = "Get enumerated values variant"]
66 #[inline(always)]
67 pub fn variant(&self) -> Option<ASYNCUSER6_A> {
68 match self.bits {
69 0 => Some(ASYNCUSER6_A::OFF),
70 1 => Some(ASYNCUSER6_A::SYNCCH0),
71 2 => Some(ASYNCUSER6_A::SYNCCH1),
72 3 => Some(ASYNCUSER6_A::ASYNCCH0),
73 4 => Some(ASYNCUSER6_A::ASYNCCH1),
74 5 => Some(ASYNCUSER6_A::ASYNCCH2),
75 6 => Some(ASYNCUSER6_A::ASYNCCH3),
76 _ => None,
77 }
78 }
79 #[doc = "Checks if the value of the field is `OFF`"]
80 #[inline(always)]
81 pub fn is_off(&self) -> bool {
82 *self == ASYNCUSER6_A::OFF
83 }
84 #[doc = "Checks if the value of the field is `SYNCCH0`"]
85 #[inline(always)]
86 pub fn is_syncch0(&self) -> bool {
87 *self == ASYNCUSER6_A::SYNCCH0
88 }
89 #[doc = "Checks if the value of the field is `SYNCCH1`"]
90 #[inline(always)]
91 pub fn is_syncch1(&self) -> bool {
92 *self == ASYNCUSER6_A::SYNCCH1
93 }
94 #[doc = "Checks if the value of the field is `ASYNCCH0`"]
95 #[inline(always)]
96 pub fn is_asyncch0(&self) -> bool {
97 *self == ASYNCUSER6_A::ASYNCCH0
98 }
99 #[doc = "Checks if the value of the field is `ASYNCCH1`"]
100 #[inline(always)]
101 pub fn is_asyncch1(&self) -> bool {
102 *self == ASYNCUSER6_A::ASYNCCH1
103 }
104 #[doc = "Checks if the value of the field is `ASYNCCH2`"]
105 #[inline(always)]
106 pub fn is_asyncch2(&self) -> bool {
107 *self == ASYNCUSER6_A::ASYNCCH2
108 }
109 #[doc = "Checks if the value of the field is `ASYNCCH3`"]
110 #[inline(always)]
111 pub fn is_asyncch3(&self) -> bool {
112 *self == ASYNCUSER6_A::ASYNCCH3
113 }
114}
115#[doc = "Field `ASYNCUSER6` writer - Asynchronous User Ch 6 Input Selection - TCD0 Event 0"]
116pub type ASYNCUSER6_W<'a, const O: u8> =
117 crate::attiny412pac::FieldWriter<'a, u8, ASYNCUSER6_SPEC, u8, ASYNCUSER6_A, 8, O>;
118impl<'a, const O: u8> ASYNCUSER6_W<'a, O> {
119 #[doc = "Off"]
120 #[inline(always)]
121 pub fn off(self) -> &'a mut W {
122 self.variant(ASYNCUSER6_A::OFF)
123 }
124 #[doc = "Synchronous Event Channel 0"]
125 #[inline(always)]
126 pub fn syncch0(self) -> &'a mut W {
127 self.variant(ASYNCUSER6_A::SYNCCH0)
128 }
129 #[doc = "Synchronous Event Channel 1"]
130 #[inline(always)]
131 pub fn syncch1(self) -> &'a mut W {
132 self.variant(ASYNCUSER6_A::SYNCCH1)
133 }
134 #[doc = "Asynchronous Event Channel 0"]
135 #[inline(always)]
136 pub fn asyncch0(self) -> &'a mut W {
137 self.variant(ASYNCUSER6_A::ASYNCCH0)
138 }
139 #[doc = "Asynchronous Event Channel 1"]
140 #[inline(always)]
141 pub fn asyncch1(self) -> &'a mut W {
142 self.variant(ASYNCUSER6_A::ASYNCCH1)
143 }
144 #[doc = "Asynchronous Event Channel 2"]
145 #[inline(always)]
146 pub fn asyncch2(self) -> &'a mut W {
147 self.variant(ASYNCUSER6_A::ASYNCCH2)
148 }
149 #[doc = "Asynchronous Event Channel 3"]
150 #[inline(always)]
151 pub fn asyncch3(self) -> &'a mut W {
152 self.variant(ASYNCUSER6_A::ASYNCCH3)
153 }
154}
155impl R {
156 #[doc = "Bits 0:7 - Asynchronous User Ch 6 Input Selection - TCD0 Event 0"]
157 #[inline(always)]
158 pub fn asyncuser6(&self) -> ASYNCUSER6_R {
159 ASYNCUSER6_R::new(self.bits)
160 }
161}
162impl W {
163 #[doc = "Bits 0:7 - Asynchronous User Ch 6 Input Selection - TCD0 Event 0"]
164 #[inline(always)]
165 pub fn asyncuser6(&mut self) -> ASYNCUSER6_W<0> {
166 ASYNCUSER6_W::new(self)
167 }
168 #[doc = "Writes raw bits to the register."]
169 #[inline(always)]
170 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
171 self.0.bits(bits);
172 self
173 }
174}
175#[doc = "Asynchronous User Ch 6 Input Selection - TCD0 Event 0\n\nThis register you can [`read`](crate::attiny412pac::generic::Reg::read), [`write_with_zero`](crate::attiny412pac::generic::Reg::write_with_zero), [`reset`](crate::attiny412pac::generic::Reg::reset), [`write`](crate::attiny412pac::generic::Reg::write), [`modify`](crate::attiny412pac::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [asyncuser6](index.html) module"]
176pub struct ASYNCUSER6_SPEC;
177impl crate::attiny412pac::RegisterSpec for ASYNCUSER6_SPEC {
178 type Ux = u8;
179}
180#[doc = "`read()` method returns [asyncuser6::R](R) reader structure"]
181impl crate::attiny412pac::Readable for ASYNCUSER6_SPEC {
182 type Reader = R;
183}
184#[doc = "`write(|w| ..)` method takes [asyncuser6::W](W) writer structure"]
185impl crate::attiny412pac::Writable for ASYNCUSER6_SPEC {
186 type Writer = W;
187}
188#[doc = "`reset()` method sets ASYNCUSER6 to value 0"]
189impl crate::attiny412pac::Resettable for ASYNCUSER6_SPEC {
190 #[inline(always)]
191 fn reset_value() -> Self::Ux {
192 0
193 }
194}