Skip to main content

mcxa_pac/utick0/
capclr.rs

1#[doc = "Register `CAPCLR` writer"]
2pub type W = crate::W<CapclrSpec>;
3#[doc = "Clear Capture 0\n\nValue on reset: 0"]
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6pub enum Capclr0 {
7    #[doc = "0: Does nothing"]
8    Capclr0nothing = 0,
9    #[doc = "1: Clears the CAP0 register value"]
10    Capclr0cleared = 1,
11}
12impl From<Capclr0> for bool {
13    #[inline(always)]
14    fn from(variant: Capclr0) -> Self {
15        variant as u8 != 0
16    }
17}
18#[doc = "Field `CAPCLR0` writer - Clear Capture 0"]
19pub type Capclr0W<'a, REG> = crate::BitWriter<'a, REG, Capclr0>;
20impl<'a, REG> Capclr0W<'a, REG>
21where
22    REG: crate::Writable + crate::RegisterSpec,
23{
24    #[doc = "Does nothing"]
25    #[inline(always)]
26    pub fn capclr0nothing(self) -> &'a mut crate::W<REG> {
27        self.variant(Capclr0::Capclr0nothing)
28    }
29    #[doc = "Clears the CAP0 register value"]
30    #[inline(always)]
31    pub fn capclr0cleared(self) -> &'a mut crate::W<REG> {
32        self.variant(Capclr0::Capclr0cleared)
33    }
34}
35#[doc = "Clear Capture 1\n\nValue on reset: 0"]
36#[cfg_attr(feature = "defmt", derive(defmt::Format))]
37#[derive(Clone, Copy, Debug, PartialEq, Eq)]
38pub enum Capclr1 {
39    #[doc = "0: Does nothing"]
40    Capclr1nothing = 0,
41    #[doc = "1: Clears the CAP1 register value"]
42    Capclr1cleared = 1,
43}
44impl From<Capclr1> for bool {
45    #[inline(always)]
46    fn from(variant: Capclr1) -> Self {
47        variant as u8 != 0
48    }
49}
50#[doc = "Field `CAPCLR1` writer - Clear Capture 1"]
51pub type Capclr1W<'a, REG> = crate::BitWriter<'a, REG, Capclr1>;
52impl<'a, REG> Capclr1W<'a, REG>
53where
54    REG: crate::Writable + crate::RegisterSpec,
55{
56    #[doc = "Does nothing"]
57    #[inline(always)]
58    pub fn capclr1nothing(self) -> &'a mut crate::W<REG> {
59        self.variant(Capclr1::Capclr1nothing)
60    }
61    #[doc = "Clears the CAP1 register value"]
62    #[inline(always)]
63    pub fn capclr1cleared(self) -> &'a mut crate::W<REG> {
64        self.variant(Capclr1::Capclr1cleared)
65    }
66}
67#[doc = "Clear Capture 2\n\nValue on reset: 0"]
68#[cfg_attr(feature = "defmt", derive(defmt::Format))]
69#[derive(Clone, Copy, Debug, PartialEq, Eq)]
70pub enum Capclr2 {
71    #[doc = "0: Does nothing"]
72    Capclr2nothing = 0,
73    #[doc = "1: Clears the CAP2 register value"]
74    Capclr2cleared = 1,
75}
76impl From<Capclr2> for bool {
77    #[inline(always)]
78    fn from(variant: Capclr2) -> Self {
79        variant as u8 != 0
80    }
81}
82#[doc = "Field `CAPCLR2` writer - Clear Capture 2"]
83pub type Capclr2W<'a, REG> = crate::BitWriter<'a, REG, Capclr2>;
84impl<'a, REG> Capclr2W<'a, REG>
85where
86    REG: crate::Writable + crate::RegisterSpec,
87{
88    #[doc = "Does nothing"]
89    #[inline(always)]
90    pub fn capclr2nothing(self) -> &'a mut crate::W<REG> {
91        self.variant(Capclr2::Capclr2nothing)
92    }
93    #[doc = "Clears the CAP2 register value"]
94    #[inline(always)]
95    pub fn capclr2cleared(self) -> &'a mut crate::W<REG> {
96        self.variant(Capclr2::Capclr2cleared)
97    }
98}
99#[doc = "Clear Capture 3\n\nValue on reset: 0"]
100#[cfg_attr(feature = "defmt", derive(defmt::Format))]
101#[derive(Clone, Copy, Debug, PartialEq, Eq)]
102pub enum Capclr3 {
103    #[doc = "0: Does nothing"]
104    Capclr3nothing = 0,
105    #[doc = "1: Clears the CAP3 register value"]
106    Capclr3cleared = 1,
107}
108impl From<Capclr3> for bool {
109    #[inline(always)]
110    fn from(variant: Capclr3) -> Self {
111        variant as u8 != 0
112    }
113}
114#[doc = "Field `CAPCLR3` writer - Clear Capture 3"]
115pub type Capclr3W<'a, REG> = crate::BitWriter<'a, REG, Capclr3>;
116impl<'a, REG> Capclr3W<'a, REG>
117where
118    REG: crate::Writable + crate::RegisterSpec,
119{
120    #[doc = "Does nothing"]
121    #[inline(always)]
122    pub fn capclr3nothing(self) -> &'a mut crate::W<REG> {
123        self.variant(Capclr3::Capclr3nothing)
124    }
125    #[doc = "Clears the CAP3 register value"]
126    #[inline(always)]
127    pub fn capclr3cleared(self) -> &'a mut crate::W<REG> {
128        self.variant(Capclr3::Capclr3cleared)
129    }
130}
131#[cfg(feature = "debug")]
132impl core::fmt::Debug for crate::generic::Reg<CapclrSpec> {
133    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
134        write!(f, "(not readable)")
135    }
136}
137impl W {
138    #[doc = "Bit 0 - Clear Capture 0"]
139    #[inline(always)]
140    pub fn capclr0(&mut self) -> Capclr0W<'_, CapclrSpec> {
141        Capclr0W::new(self, 0)
142    }
143    #[doc = "Bit 1 - Clear Capture 1"]
144    #[inline(always)]
145    pub fn capclr1(&mut self) -> Capclr1W<'_, CapclrSpec> {
146        Capclr1W::new(self, 1)
147    }
148    #[doc = "Bit 2 - Clear Capture 2"]
149    #[inline(always)]
150    pub fn capclr2(&mut self) -> Capclr2W<'_, CapclrSpec> {
151        Capclr2W::new(self, 2)
152    }
153    #[doc = "Bit 3 - Clear Capture 3"]
154    #[inline(always)]
155    pub fn capclr3(&mut self) -> Capclr3W<'_, CapclrSpec> {
156        Capclr3W::new(self, 3)
157    }
158}
159#[doc = "Capture Clear\n\nYou can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`capclr::W`](W). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
160pub struct CapclrSpec;
161impl crate::RegisterSpec for CapclrSpec {
162    type Ux = u32;
163}
164#[doc = "`write(|w| ..)` method takes [`capclr::W`](W) writer structure"]
165impl crate::Writable for CapclrSpec {
166    type Safety = crate::Unsafe;
167}
168#[doc = "`reset()` method sets CAPCLR to value 0"]
169impl crate::Resettable for CapclrSpec {}