s32k142_pac/ftm3/
pair2deadtime.rs1#[doc = "Register `PAIR2DEADTIME` reader"]
2pub struct R(crate::R<PAIR2DEADTIME_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<PAIR2DEADTIME_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<PAIR2DEADTIME_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<PAIR2DEADTIME_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `PAIR2DEADTIME` writer"]
17pub struct W(crate::W<PAIR2DEADTIME_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<PAIR2DEADTIME_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<PAIR2DEADTIME_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<PAIR2DEADTIME_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `DTVAL` reader - Deadtime Value"]
38pub struct DTVAL_R(crate::FieldReader<u8, u8>);
39impl DTVAL_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: u8) -> Self {
42 DTVAL_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for DTVAL_R {
46 type Target = crate::FieldReader<u8, u8>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `DTVAL` writer - Deadtime Value"]
53pub struct DTVAL_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> DTVAL_W<'a> {
57 #[doc = r"Writes raw bits to the field"]
58 #[inline(always)]
59 pub unsafe fn bits(self, value: u8) -> &'a mut W {
60 self.w.bits = (self.w.bits & !0x3f) | (value as u32 & 0x3f);
61 self.w
62 }
63}
64#[doc = "Deadtime Prescaler Value\n\nValue on reset: 0"]
65#[derive(Clone, Copy, Debug, PartialEq)]
66#[repr(u8)]
67pub enum DTPS_A {
68 #[doc = "0: Divide the FTM input clock by 1."]
69 _0X = 0,
70 #[doc = "2: Divide the FTM input clock by 4."]
71 _10 = 2,
72 #[doc = "3: Divide the FTM input clock by 16."]
73 _11 = 3,
74}
75impl From<DTPS_A> for u8 {
76 #[inline(always)]
77 fn from(variant: DTPS_A) -> Self {
78 variant as _
79 }
80}
81#[doc = "Field `DTPS` reader - Deadtime Prescaler Value"]
82pub struct DTPS_R(crate::FieldReader<u8, DTPS_A>);
83impl DTPS_R {
84 #[inline(always)]
85 pub(crate) fn new(bits: u8) -> Self {
86 DTPS_R(crate::FieldReader::new(bits))
87 }
88 #[doc = r"Get enumerated values variant"]
89 #[inline(always)]
90 pub fn variant(&self) -> Option<DTPS_A> {
91 match self.bits {
92 0 => Some(DTPS_A::_0X),
93 2 => Some(DTPS_A::_10),
94 3 => Some(DTPS_A::_11),
95 _ => None,
96 }
97 }
98 #[doc = "Checks if the value of the field is `_0X`"]
99 #[inline(always)]
100 pub fn is_0x(&self) -> bool {
101 **self == DTPS_A::_0X
102 }
103 #[doc = "Checks if the value of the field is `_10`"]
104 #[inline(always)]
105 pub fn is_10(&self) -> bool {
106 **self == DTPS_A::_10
107 }
108 #[doc = "Checks if the value of the field is `_11`"]
109 #[inline(always)]
110 pub fn is_11(&self) -> bool {
111 **self == DTPS_A::_11
112 }
113}
114impl core::ops::Deref for DTPS_R {
115 type Target = crate::FieldReader<u8, DTPS_A>;
116 #[inline(always)]
117 fn deref(&self) -> &Self::Target {
118 &self.0
119 }
120}
121#[doc = "Field `DTPS` writer - Deadtime Prescaler Value"]
122pub struct DTPS_W<'a> {
123 w: &'a mut W,
124}
125impl<'a> DTPS_W<'a> {
126 #[doc = r"Writes `variant` to the field"]
127 #[inline(always)]
128 pub fn variant(self, variant: DTPS_A) -> &'a mut W {
129 unsafe { self.bits(variant.into()) }
130 }
131 #[doc = "Divide the FTM input clock by 1."]
132 #[inline(always)]
133 pub fn _0x(self) -> &'a mut W {
134 self.variant(DTPS_A::_0X)
135 }
136 #[doc = "Divide the FTM input clock by 4."]
137 #[inline(always)]
138 pub fn _10(self) -> &'a mut W {
139 self.variant(DTPS_A::_10)
140 }
141 #[doc = "Divide the FTM input clock by 16."]
142 #[inline(always)]
143 pub fn _11(self) -> &'a mut W {
144 self.variant(DTPS_A::_11)
145 }
146 #[doc = r"Writes raw bits to the field"]
147 #[inline(always)]
148 pub unsafe fn bits(self, value: u8) -> &'a mut W {
149 self.w.bits = (self.w.bits & !(0x03 << 6)) | ((value as u32 & 0x03) << 6);
150 self.w
151 }
152}
153#[doc = "Field `DTVALEX` reader - Extended Deadtime Value"]
154pub struct DTVALEX_R(crate::FieldReader<u8, u8>);
155impl DTVALEX_R {
156 #[inline(always)]
157 pub(crate) fn new(bits: u8) -> Self {
158 DTVALEX_R(crate::FieldReader::new(bits))
159 }
160}
161impl core::ops::Deref for DTVALEX_R {
162 type Target = crate::FieldReader<u8, u8>;
163 #[inline(always)]
164 fn deref(&self) -> &Self::Target {
165 &self.0
166 }
167}
168#[doc = "Field `DTVALEX` writer - Extended Deadtime Value"]
169pub struct DTVALEX_W<'a> {
170 w: &'a mut W,
171}
172impl<'a> DTVALEX_W<'a> {
173 #[doc = r"Writes raw bits to the field"]
174 #[inline(always)]
175 pub unsafe fn bits(self, value: u8) -> &'a mut W {
176 self.w.bits = (self.w.bits & !(0x0f << 16)) | ((value as u32 & 0x0f) << 16);
177 self.w
178 }
179}
180impl R {
181 #[doc = "Bits 0:5 - Deadtime Value"]
182 #[inline(always)]
183 pub fn dtval(&self) -> DTVAL_R {
184 DTVAL_R::new((self.bits & 0x3f) as u8)
185 }
186 #[doc = "Bits 6:7 - Deadtime Prescaler Value"]
187 #[inline(always)]
188 pub fn dtps(&self) -> DTPS_R {
189 DTPS_R::new(((self.bits >> 6) & 0x03) as u8)
190 }
191 #[doc = "Bits 16:19 - Extended Deadtime Value"]
192 #[inline(always)]
193 pub fn dtvalex(&self) -> DTVALEX_R {
194 DTVALEX_R::new(((self.bits >> 16) & 0x0f) as u8)
195 }
196}
197impl W {
198 #[doc = "Bits 0:5 - Deadtime Value"]
199 #[inline(always)]
200 pub fn dtval(&mut self) -> DTVAL_W {
201 DTVAL_W { w: self }
202 }
203 #[doc = "Bits 6:7 - Deadtime Prescaler Value"]
204 #[inline(always)]
205 pub fn dtps(&mut self) -> DTPS_W {
206 DTPS_W { w: self }
207 }
208 #[doc = "Bits 16:19 - Extended Deadtime Value"]
209 #[inline(always)]
210 pub fn dtvalex(&mut self) -> DTVALEX_W {
211 DTVALEX_W { w: self }
212 }
213 #[doc = "Writes raw bits to the register."]
214 #[inline(always)]
215 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
216 self.0.bits(bits);
217 self
218 }
219}
220#[doc = "Pair 2 Deadtime Configuration\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 [pair2deadtime](index.html) module"]
221pub struct PAIR2DEADTIME_SPEC;
222impl crate::RegisterSpec for PAIR2DEADTIME_SPEC {
223 type Ux = u32;
224}
225#[doc = "`read()` method returns [pair2deadtime::R](R) reader structure"]
226impl crate::Readable for PAIR2DEADTIME_SPEC {
227 type Reader = R;
228}
229#[doc = "`write(|w| ..)` method takes [pair2deadtime::W](W) writer structure"]
230impl crate::Writable for PAIR2DEADTIME_SPEC {
231 type Writer = W;
232}
233#[doc = "`reset()` method sets PAIR2DEADTIME to value 0"]
234impl crate::Resettable for PAIR2DEADTIME_SPEC {
235 #[inline(always)]
236 fn reset_value() -> Self::Ux {
237 0
238 }
239}