xmc4800/ecat0_sm0/
sm_control.rs1#[doc = "Register `SM_CONTROL` reader"]
2pub type R = crate::R<SM_CONTROL_SPEC>;
3#[doc = "Operation Mode\n\nValue on reset: 0"]
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5#[repr(u8)]
6pub enum OP_MODE_A {
7 #[doc = "0: Buffered (3 buffer mode)"]
8 VALUE1 = 0,
9 #[doc = "2: Mailbox (Single buffer mode)"]
10 VALUE3 = 2,
11}
12impl From<OP_MODE_A> for u8 {
13 #[inline(always)]
14 fn from(variant: OP_MODE_A) -> Self {
15 variant as _
16 }
17}
18impl crate::FieldSpec for OP_MODE_A {
19 type Ux = u8;
20}
21impl crate::IsEnum for OP_MODE_A {}
22#[doc = "Field `OP_MODE` reader - Operation Mode"]
23pub type OP_MODE_R = crate::FieldReader<OP_MODE_A>;
24impl OP_MODE_R {
25 #[doc = "Get enumerated values variant"]
26 #[inline(always)]
27 pub const fn variant(&self) -> Option<OP_MODE_A> {
28 match self.bits {
29 0 => Some(OP_MODE_A::VALUE1),
30 2 => Some(OP_MODE_A::VALUE3),
31 _ => None,
32 }
33 }
34 #[doc = "Buffered (3 buffer mode)"]
35 #[inline(always)]
36 pub fn is_value1(&self) -> bool {
37 *self == OP_MODE_A::VALUE1
38 }
39 #[doc = "Mailbox (Single buffer mode)"]
40 #[inline(always)]
41 pub fn is_value3(&self) -> bool {
42 *self == OP_MODE_A::VALUE3
43 }
44}
45#[doc = "Direction\n\nValue on reset: 0"]
46#[derive(Clone, Copy, Debug, PartialEq, Eq)]
47#[repr(u8)]
48pub enum DIR_A {
49 #[doc = "0: Read: ECAT read access, PDI write access"]
50 VALUE1 = 0,
51 #[doc = "1: Write: ECAT write access, PDI read access"]
52 VALUE2 = 1,
53}
54impl From<DIR_A> for u8 {
55 #[inline(always)]
56 fn from(variant: DIR_A) -> Self {
57 variant as _
58 }
59}
60impl crate::FieldSpec for DIR_A {
61 type Ux = u8;
62}
63impl crate::IsEnum for DIR_A {}
64#[doc = "Field `DIR` reader - Direction"]
65pub type DIR_R = crate::FieldReader<DIR_A>;
66impl DIR_R {
67 #[doc = "Get enumerated values variant"]
68 #[inline(always)]
69 pub const fn variant(&self) -> Option<DIR_A> {
70 match self.bits {
71 0 => Some(DIR_A::VALUE1),
72 1 => Some(DIR_A::VALUE2),
73 _ => None,
74 }
75 }
76 #[doc = "Read: ECAT read access, PDI write access"]
77 #[inline(always)]
78 pub fn is_value1(&self) -> bool {
79 *self == DIR_A::VALUE1
80 }
81 #[doc = "Write: ECAT write access, PDI read access"]
82 #[inline(always)]
83 pub fn is_value2(&self) -> bool {
84 *self == DIR_A::VALUE2
85 }
86}
87#[doc = "Interrupt in ECAT Event Request Register\n\nValue on reset: 0"]
88#[derive(Clone, Copy, Debug, PartialEq, Eq)]
89pub enum INT_ECAT_A {
90 #[doc = "0: Disabled"]
91 VALUE1 = 0,
92 #[doc = "1: Enabled"]
93 VALUE2 = 1,
94}
95impl From<INT_ECAT_A> for bool {
96 #[inline(always)]
97 fn from(variant: INT_ECAT_A) -> Self {
98 variant as u8 != 0
99 }
100}
101#[doc = "Field `INT_ECAT` reader - Interrupt in ECAT Event Request Register"]
102pub type INT_ECAT_R = crate::BitReader<INT_ECAT_A>;
103impl INT_ECAT_R {
104 #[doc = "Get enumerated values variant"]
105 #[inline(always)]
106 pub const fn variant(&self) -> INT_ECAT_A {
107 match self.bits {
108 false => INT_ECAT_A::VALUE1,
109 true => INT_ECAT_A::VALUE2,
110 }
111 }
112 #[doc = "Disabled"]
113 #[inline(always)]
114 pub fn is_value1(&self) -> bool {
115 *self == INT_ECAT_A::VALUE1
116 }
117 #[doc = "Enabled"]
118 #[inline(always)]
119 pub fn is_value2(&self) -> bool {
120 *self == INT_ECAT_A::VALUE2
121 }
122}
123#[doc = "Interrupt in PDI Event Request Register\n\nValue on reset: 0"]
124#[derive(Clone, Copy, Debug, PartialEq, Eq)]
125pub enum INT_PDI_A {
126 #[doc = "0: Disabled"]
127 VALUE1 = 0,
128 #[doc = "1: Enabled"]
129 VALUE2 = 1,
130}
131impl From<INT_PDI_A> for bool {
132 #[inline(always)]
133 fn from(variant: INT_PDI_A) -> Self {
134 variant as u8 != 0
135 }
136}
137#[doc = "Field `INT_PDI` reader - Interrupt in PDI Event Request Register"]
138pub type INT_PDI_R = crate::BitReader<INT_PDI_A>;
139impl INT_PDI_R {
140 #[doc = "Get enumerated values variant"]
141 #[inline(always)]
142 pub const fn variant(&self) -> INT_PDI_A {
143 match self.bits {
144 false => INT_PDI_A::VALUE1,
145 true => INT_PDI_A::VALUE2,
146 }
147 }
148 #[doc = "Disabled"]
149 #[inline(always)]
150 pub fn is_value1(&self) -> bool {
151 *self == INT_PDI_A::VALUE1
152 }
153 #[doc = "Enabled"]
154 #[inline(always)]
155 pub fn is_value2(&self) -> bool {
156 *self == INT_PDI_A::VALUE2
157 }
158}
159#[doc = "Watchdog Trigger Enable\n\nValue on reset: 0"]
160#[derive(Clone, Copy, Debug, PartialEq, Eq)]
161pub enum WD_TRG_A {
162 #[doc = "0: Disabled"]
163 VALUE1 = 0,
164 #[doc = "1: Enabled"]
165 VALUE2 = 1,
166}
167impl From<WD_TRG_A> for bool {
168 #[inline(always)]
169 fn from(variant: WD_TRG_A) -> Self {
170 variant as u8 != 0
171 }
172}
173#[doc = "Field `WD_TRG` reader - Watchdog Trigger Enable"]
174pub type WD_TRG_R = crate::BitReader<WD_TRG_A>;
175impl WD_TRG_R {
176 #[doc = "Get enumerated values variant"]
177 #[inline(always)]
178 pub const fn variant(&self) -> WD_TRG_A {
179 match self.bits {
180 false => WD_TRG_A::VALUE1,
181 true => WD_TRG_A::VALUE2,
182 }
183 }
184 #[doc = "Disabled"]
185 #[inline(always)]
186 pub fn is_value1(&self) -> bool {
187 *self == WD_TRG_A::VALUE1
188 }
189 #[doc = "Enabled"]
190 #[inline(always)]
191 pub fn is_value2(&self) -> bool {
192 *self == WD_TRG_A::VALUE2
193 }
194}
195impl R {
196 #[doc = "Bits 0:1 - Operation Mode"]
197 #[inline(always)]
198 pub fn op_mode(&self) -> OP_MODE_R {
199 OP_MODE_R::new(self.bits & 3)
200 }
201 #[doc = "Bits 2:3 - Direction"]
202 #[inline(always)]
203 pub fn dir(&self) -> DIR_R {
204 DIR_R::new((self.bits >> 2) & 3)
205 }
206 #[doc = "Bit 4 - Interrupt in ECAT Event Request Register"]
207 #[inline(always)]
208 pub fn int_ecat(&self) -> INT_ECAT_R {
209 INT_ECAT_R::new(((self.bits >> 4) & 1) != 0)
210 }
211 #[doc = "Bit 5 - Interrupt in PDI Event Request Register"]
212 #[inline(always)]
213 pub fn int_pdi(&self) -> INT_PDI_R {
214 INT_PDI_R::new(((self.bits >> 5) & 1) != 0)
215 }
216 #[doc = "Bit 6 - Watchdog Trigger Enable"]
217 #[inline(always)]
218 pub fn wd_trg(&self) -> WD_TRG_R {
219 WD_TRG_R::new(((self.bits >> 6) & 1) != 0)
220 }
221}
222#[doc = "Control Register SyncManager 0\n\nYou can [`read`](crate::Reg::read) this register and get [`sm_control::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
223pub struct SM_CONTROL_SPEC;
224impl crate::RegisterSpec for SM_CONTROL_SPEC {
225 type Ux = u8;
226}
227#[doc = "`read()` method returns [`sm_control::R`](R) reader structure"]
228impl crate::Readable for SM_CONTROL_SPEC {}
229#[doc = "`reset()` method sets SM_CONTROL to value 0"]
230impl crate::Resettable for SM_CONTROL_SPEC {
231 const RESET_VALUE: u8 = 0;
232}