mcxa_pac/eqdc0/
tst.rs

1#[doc = "Register `TST` reader"]
2pub type R = crate::R<TstSpec>;
3#[doc = "Register `TST` writer"]
4pub type W = crate::W<TstSpec>;
5#[doc = "Field `TEST_COUNT` reader - TEST_COUNT"]
6pub type TestCountR = crate::FieldReader;
7#[doc = "Field `TEST_COUNT` writer - TEST_COUNT"]
8pub type TestCountW<'a, REG> = crate::FieldWriter<'a, REG, 8>;
9#[doc = "Field `TEST_PERIOD` reader - TEST_PERIOD"]
10pub type TestPeriodR = crate::FieldReader;
11#[doc = "Field `TEST_PERIOD` writer - TEST_PERIOD"]
12pub type TestPeriodW<'a, REG> = crate::FieldWriter<'a, REG, 5>;
13#[doc = "Quadrature Decoder Negative Signal\n\nValue on reset: 0"]
14#[cfg_attr(feature = "defmt", derive(defmt::Format))]
15#[derive(Clone, Copy, Debug, PartialEq, Eq)]
16pub enum Qdn {
17    #[doc = "0: Generates a positive quadrature decoder signal"]
18    Qdn0 = 0,
19    #[doc = "1: Generates a negative quadrature decoder signal"]
20    Qdn1 = 1,
21}
22impl From<Qdn> for bool {
23    #[inline(always)]
24    fn from(variant: Qdn) -> Self {
25        variant as u8 != 0
26    }
27}
28#[doc = "Field `QDN` reader - Quadrature Decoder Negative Signal"]
29pub type QdnR = crate::BitReader<Qdn>;
30impl QdnR {
31    #[doc = "Get enumerated values variant"]
32    #[inline(always)]
33    pub const fn variant(&self) -> Qdn {
34        match self.bits {
35            false => Qdn::Qdn0,
36            true => Qdn::Qdn1,
37        }
38    }
39    #[doc = "Generates a positive quadrature decoder signal"]
40    #[inline(always)]
41    pub fn is_qdn0(&self) -> bool {
42        *self == Qdn::Qdn0
43    }
44    #[doc = "Generates a negative quadrature decoder signal"]
45    #[inline(always)]
46    pub fn is_qdn1(&self) -> bool {
47        *self == Qdn::Qdn1
48    }
49}
50#[doc = "Field `QDN` writer - Quadrature Decoder Negative Signal"]
51pub type QdnW<'a, REG> = crate::BitWriter<'a, REG, Qdn>;
52impl<'a, REG> QdnW<'a, REG>
53where
54    REG: crate::Writable + crate::RegisterSpec,
55{
56    #[doc = "Generates a positive quadrature decoder signal"]
57    #[inline(always)]
58    pub fn qdn0(self) -> &'a mut crate::W<REG> {
59        self.variant(Qdn::Qdn0)
60    }
61    #[doc = "Generates a negative quadrature decoder signal"]
62    #[inline(always)]
63    pub fn qdn1(self) -> &'a mut crate::W<REG> {
64        self.variant(Qdn::Qdn1)
65    }
66}
67#[doc = "Test Counter Enable\n\nValue on reset: 0"]
68#[cfg_attr(feature = "defmt", derive(defmt::Format))]
69#[derive(Clone, Copy, Debug, PartialEq, Eq)]
70pub enum Tce {
71    #[doc = "0: Disabled"]
72    Tce0 = 0,
73    #[doc = "1: Enabled"]
74    Tce1 = 1,
75}
76impl From<Tce> for bool {
77    #[inline(always)]
78    fn from(variant: Tce) -> Self {
79        variant as u8 != 0
80    }
81}
82#[doc = "Field `TCE` reader - Test Counter Enable"]
83pub type TceR = crate::BitReader<Tce>;
84impl TceR {
85    #[doc = "Get enumerated values variant"]
86    #[inline(always)]
87    pub const fn variant(&self) -> Tce {
88        match self.bits {
89            false => Tce::Tce0,
90            true => Tce::Tce1,
91        }
92    }
93    #[doc = "Disabled"]
94    #[inline(always)]
95    pub fn is_tce0(&self) -> bool {
96        *self == Tce::Tce0
97    }
98    #[doc = "Enabled"]
99    #[inline(always)]
100    pub fn is_tce1(&self) -> bool {
101        *self == Tce::Tce1
102    }
103}
104#[doc = "Field `TCE` writer - Test Counter Enable"]
105pub type TceW<'a, REG> = crate::BitWriter<'a, REG, Tce>;
106impl<'a, REG> TceW<'a, REG>
107where
108    REG: crate::Writable + crate::RegisterSpec,
109{
110    #[doc = "Disabled"]
111    #[inline(always)]
112    pub fn tce0(self) -> &'a mut crate::W<REG> {
113        self.variant(Tce::Tce0)
114    }
115    #[doc = "Enabled"]
116    #[inline(always)]
117    pub fn tce1(self) -> &'a mut crate::W<REG> {
118        self.variant(Tce::Tce1)
119    }
120}
121#[doc = "Test Mode Enable\n\nValue on reset: 0"]
122#[cfg_attr(feature = "defmt", derive(defmt::Format))]
123#[derive(Clone, Copy, Debug, PartialEq, Eq)]
124pub enum Ten {
125    #[doc = "0: Disabled"]
126    Ten0 = 0,
127    #[doc = "1: Enabled"]
128    Ten1 = 1,
129}
130impl From<Ten> for bool {
131    #[inline(always)]
132    fn from(variant: Ten) -> Self {
133        variant as u8 != 0
134    }
135}
136#[doc = "Field `TEN` reader - Test Mode Enable"]
137pub type TenR = crate::BitReader<Ten>;
138impl TenR {
139    #[doc = "Get enumerated values variant"]
140    #[inline(always)]
141    pub const fn variant(&self) -> Ten {
142        match self.bits {
143            false => Ten::Ten0,
144            true => Ten::Ten1,
145        }
146    }
147    #[doc = "Disabled"]
148    #[inline(always)]
149    pub fn is_ten0(&self) -> bool {
150        *self == Ten::Ten0
151    }
152    #[doc = "Enabled"]
153    #[inline(always)]
154    pub fn is_ten1(&self) -> bool {
155        *self == Ten::Ten1
156    }
157}
158#[doc = "Field `TEN` writer - Test Mode Enable"]
159pub type TenW<'a, REG> = crate::BitWriter<'a, REG, Ten>;
160impl<'a, REG> TenW<'a, REG>
161where
162    REG: crate::Writable + crate::RegisterSpec,
163{
164    #[doc = "Disabled"]
165    #[inline(always)]
166    pub fn ten0(self) -> &'a mut crate::W<REG> {
167        self.variant(Ten::Ten0)
168    }
169    #[doc = "Enabled"]
170    #[inline(always)]
171    pub fn ten1(self) -> &'a mut crate::W<REG> {
172        self.variant(Ten::Ten1)
173    }
174}
175impl R {
176    #[doc = "Bits 0:7 - TEST_COUNT"]
177    #[inline(always)]
178    pub fn test_count(&self) -> TestCountR {
179        TestCountR::new((self.bits & 0xff) as u8)
180    }
181    #[doc = "Bits 8:12 - TEST_PERIOD"]
182    #[inline(always)]
183    pub fn test_period(&self) -> TestPeriodR {
184        TestPeriodR::new(((self.bits >> 8) & 0x1f) as u8)
185    }
186    #[doc = "Bit 13 - Quadrature Decoder Negative Signal"]
187    #[inline(always)]
188    pub fn qdn(&self) -> QdnR {
189        QdnR::new(((self.bits >> 13) & 1) != 0)
190    }
191    #[doc = "Bit 14 - Test Counter Enable"]
192    #[inline(always)]
193    pub fn tce(&self) -> TceR {
194        TceR::new(((self.bits >> 14) & 1) != 0)
195    }
196    #[doc = "Bit 15 - Test Mode Enable"]
197    #[inline(always)]
198    pub fn ten(&self) -> TenR {
199        TenR::new(((self.bits >> 15) & 1) != 0)
200    }
201}
202#[cfg(feature = "debug")]
203impl core::fmt::Debug for R {
204    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
205        f.debug_struct("TST")
206            .field("test_count", &self.test_count())
207            .field("test_period", &self.test_period())
208            .field("qdn", &self.qdn())
209            .field("tce", &self.tce())
210            .field("ten", &self.ten())
211            .finish()
212    }
213}
214impl W {
215    #[doc = "Bits 0:7 - TEST_COUNT"]
216    #[inline(always)]
217    pub fn test_count(&mut self) -> TestCountW<'_, TstSpec> {
218        TestCountW::new(self, 0)
219    }
220    #[doc = "Bits 8:12 - TEST_PERIOD"]
221    #[inline(always)]
222    pub fn test_period(&mut self) -> TestPeriodW<'_, TstSpec> {
223        TestPeriodW::new(self, 8)
224    }
225    #[doc = "Bit 13 - Quadrature Decoder Negative Signal"]
226    #[inline(always)]
227    pub fn qdn(&mut self) -> QdnW<'_, TstSpec> {
228        QdnW::new(self, 13)
229    }
230    #[doc = "Bit 14 - Test Counter Enable"]
231    #[inline(always)]
232    pub fn tce(&mut self) -> TceW<'_, TstSpec> {
233        TceW::new(self, 14)
234    }
235    #[doc = "Bit 15 - Test Mode Enable"]
236    #[inline(always)]
237    pub fn ten(&mut self) -> TenW<'_, TstSpec> {
238        TenW::new(self, 15)
239    }
240}
241#[doc = "Test Register\n\nYou can [`read`](crate::Reg::read) this register and get [`tst::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`tst::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
242pub struct TstSpec;
243impl crate::RegisterSpec for TstSpec {
244    type Ux = u16;
245}
246#[doc = "`read()` method returns [`tst::R`](R) reader structure"]
247impl crate::Readable for TstSpec {}
248#[doc = "`write(|w| ..)` method takes [`tst::W`](W) writer structure"]
249impl crate::Writable for TstSpec {
250    type Safety = crate::Unsafe;
251}
252#[doc = "`reset()` method sets TST to value 0"]
253impl crate::Resettable for TstSpec {}