Skip to main content

ra2a1/ctsu/
ctsucr0.rs

1#[doc = "Register `CTSUCR0` reader"]
2pub struct R(crate::R<CTSUCR0_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CTSUCR0_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CTSUCR0_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CTSUCR0_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CTSUCR0` writer"]
17pub struct W(crate::W<CTSUCR0_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CTSUCR0_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<CTSUCR0_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CTSUCR0_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CTSUSTRT` reader - CTSU Measurement Operation Start"]
38pub type CTSUSTRT_R = crate::BitReader<CTSUSTRT_A>;
39#[doc = "CTSU Measurement Operation Start\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum CTSUSTRT_A {
42    #[doc = "0: Measurement operation stops."]
43    _0 = 0,
44    #[doc = "1: Measurement operation starts."]
45    _1 = 1,
46}
47impl From<CTSUSTRT_A> for bool {
48    #[inline(always)]
49    fn from(variant: CTSUSTRT_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl CTSUSTRT_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> CTSUSTRT_A {
57        match self.bits {
58            false => CTSUSTRT_A::_0,
59            true => CTSUSTRT_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == CTSUSTRT_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == CTSUSTRT_A::_1
71    }
72}
73#[doc = "Field `CTSUSTRT` writer - CTSU Measurement Operation Start"]
74pub type CTSUSTRT_W<'a, const O: u8> = crate::BitWriter<'a, u8, CTSUCR0_SPEC, CTSUSTRT_A, O>;
75impl<'a, const O: u8> CTSUSTRT_W<'a, O> {
76    #[doc = "Measurement operation stops."]
77    #[inline(always)]
78    pub fn _0(self) -> &'a mut W {
79        self.variant(CTSUSTRT_A::_0)
80    }
81    #[doc = "Measurement operation starts."]
82    #[inline(always)]
83    pub fn _1(self) -> &'a mut W {
84        self.variant(CTSUSTRT_A::_1)
85    }
86}
87#[doc = "Field `CTSUCAP` reader - CTSU Measurement Operation Start Trigger Select"]
88pub type CTSUCAP_R = crate::BitReader<CTSUCAP_A>;
89#[doc = "CTSU Measurement Operation Start Trigger Select\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum CTSUCAP_A {
92    #[doc = "0: Software trigger."]
93    _0 = 0,
94    #[doc = "1: External trigger."]
95    _1 = 1,
96}
97impl From<CTSUCAP_A> for bool {
98    #[inline(always)]
99    fn from(variant: CTSUCAP_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl CTSUCAP_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> CTSUCAP_A {
107        match self.bits {
108            false => CTSUCAP_A::_0,
109            true => CTSUCAP_A::_1,
110        }
111    }
112    #[doc = "Checks if the value of the field is `_0`"]
113    #[inline(always)]
114    pub fn is_0(&self) -> bool {
115        *self == CTSUCAP_A::_0
116    }
117    #[doc = "Checks if the value of the field is `_1`"]
118    #[inline(always)]
119    pub fn is_1(&self) -> bool {
120        *self == CTSUCAP_A::_1
121    }
122}
123#[doc = "Field `CTSUCAP` writer - CTSU Measurement Operation Start Trigger Select"]
124pub type CTSUCAP_W<'a, const O: u8> = crate::BitWriter<'a, u8, CTSUCR0_SPEC, CTSUCAP_A, O>;
125impl<'a, const O: u8> CTSUCAP_W<'a, O> {
126    #[doc = "Software trigger."]
127    #[inline(always)]
128    pub fn _0(self) -> &'a mut W {
129        self.variant(CTSUCAP_A::_0)
130    }
131    #[doc = "External trigger."]
132    #[inline(always)]
133    pub fn _1(self) -> &'a mut W {
134        self.variant(CTSUCAP_A::_1)
135    }
136}
137#[doc = "Field `CTSUSNZ` reader - CTSU Wait State Power-Saving Enable"]
138pub type CTSUSNZ_R = crate::BitReader<CTSUSNZ_A>;
139#[doc = "CTSU Wait State Power-Saving Enable\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum CTSUSNZ_A {
142    #[doc = "0: Power-saving function during wait state is disabled."]
143    _0 = 0,
144    #[doc = "1: Power-saving function during wait state is enabled."]
145    _1 = 1,
146}
147impl From<CTSUSNZ_A> for bool {
148    #[inline(always)]
149    fn from(variant: CTSUSNZ_A) -> Self {
150        variant as u8 != 0
151    }
152}
153impl CTSUSNZ_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> CTSUSNZ_A {
157        match self.bits {
158            false => CTSUSNZ_A::_0,
159            true => CTSUSNZ_A::_1,
160        }
161    }
162    #[doc = "Checks if the value of the field is `_0`"]
163    #[inline(always)]
164    pub fn is_0(&self) -> bool {
165        *self == CTSUSNZ_A::_0
166    }
167    #[doc = "Checks if the value of the field is `_1`"]
168    #[inline(always)]
169    pub fn is_1(&self) -> bool {
170        *self == CTSUSNZ_A::_1
171    }
172}
173#[doc = "Field `CTSUSNZ` writer - CTSU Wait State Power-Saving Enable"]
174pub type CTSUSNZ_W<'a, const O: u8> = crate::BitWriter<'a, u8, CTSUCR0_SPEC, CTSUSNZ_A, O>;
175impl<'a, const O: u8> CTSUSNZ_W<'a, O> {
176    #[doc = "Power-saving function during wait state is disabled."]
177    #[inline(always)]
178    pub fn _0(self) -> &'a mut W {
179        self.variant(CTSUSNZ_A::_0)
180    }
181    #[doc = "Power-saving function during wait state is enabled."]
182    #[inline(always)]
183    pub fn _1(self) -> &'a mut W {
184        self.variant(CTSUSNZ_A::_1)
185    }
186}
187#[doc = "Field `CTSUINIT` reader - CTSU Control Block Initialization"]
188pub type CTSUINIT_R = crate::BitReader<CTSUINIT_A>;
189#[doc = "CTSU Control Block Initialization\n\nValue on reset: 0"]
190#[derive(Clone, Copy, Debug, PartialEq, Eq)]
191pub enum CTSUINIT_A {
192    #[doc = "0: Writing a 0 has no effect, this bit is read as 0."]
193    _0 = 0,
194    #[doc = "1: initializes the CTSU control block and registers."]
195    _1 = 1,
196}
197impl From<CTSUINIT_A> for bool {
198    #[inline(always)]
199    fn from(variant: CTSUINIT_A) -> Self {
200        variant as u8 != 0
201    }
202}
203impl CTSUINIT_R {
204    #[doc = "Get enumerated values variant"]
205    #[inline(always)]
206    pub fn variant(&self) -> CTSUINIT_A {
207        match self.bits {
208            false => CTSUINIT_A::_0,
209            true => CTSUINIT_A::_1,
210        }
211    }
212    #[doc = "Checks if the value of the field is `_0`"]
213    #[inline(always)]
214    pub fn is_0(&self) -> bool {
215        *self == CTSUINIT_A::_0
216    }
217    #[doc = "Checks if the value of the field is `_1`"]
218    #[inline(always)]
219    pub fn is_1(&self) -> bool {
220        *self == CTSUINIT_A::_1
221    }
222}
223#[doc = "Field `CTSUINIT` writer - CTSU Control Block Initialization"]
224pub type CTSUINIT_W<'a, const O: u8> = crate::BitWriter<'a, u8, CTSUCR0_SPEC, CTSUINIT_A, O>;
225impl<'a, const O: u8> CTSUINIT_W<'a, O> {
226    #[doc = "Writing a 0 has no effect, this bit is read as 0."]
227    #[inline(always)]
228    pub fn _0(self) -> &'a mut W {
229        self.variant(CTSUINIT_A::_0)
230    }
231    #[doc = "initializes the CTSU control block and registers."]
232    #[inline(always)]
233    pub fn _1(self) -> &'a mut W {
234        self.variant(CTSUINIT_A::_1)
235    }
236}
237impl R {
238    #[doc = "Bit 0 - CTSU Measurement Operation Start"]
239    #[inline(always)]
240    pub fn ctsustrt(&self) -> CTSUSTRT_R {
241        CTSUSTRT_R::new((self.bits & 1) != 0)
242    }
243    #[doc = "Bit 1 - CTSU Measurement Operation Start Trigger Select"]
244    #[inline(always)]
245    pub fn ctsucap(&self) -> CTSUCAP_R {
246        CTSUCAP_R::new(((self.bits >> 1) & 1) != 0)
247    }
248    #[doc = "Bit 2 - CTSU Wait State Power-Saving Enable"]
249    #[inline(always)]
250    pub fn ctsusnz(&self) -> CTSUSNZ_R {
251        CTSUSNZ_R::new(((self.bits >> 2) & 1) != 0)
252    }
253    #[doc = "Bit 4 - CTSU Control Block Initialization"]
254    #[inline(always)]
255    pub fn ctsuinit(&self) -> CTSUINIT_R {
256        CTSUINIT_R::new(((self.bits >> 4) & 1) != 0)
257    }
258}
259impl W {
260    #[doc = "Bit 0 - CTSU Measurement Operation Start"]
261    #[inline(always)]
262    #[must_use]
263    pub fn ctsustrt(&mut self) -> CTSUSTRT_W<0> {
264        CTSUSTRT_W::new(self)
265    }
266    #[doc = "Bit 1 - CTSU Measurement Operation Start Trigger Select"]
267    #[inline(always)]
268    #[must_use]
269    pub fn ctsucap(&mut self) -> CTSUCAP_W<1> {
270        CTSUCAP_W::new(self)
271    }
272    #[doc = "Bit 2 - CTSU Wait State Power-Saving Enable"]
273    #[inline(always)]
274    #[must_use]
275    pub fn ctsusnz(&mut self) -> CTSUSNZ_W<2> {
276        CTSUSNZ_W::new(self)
277    }
278    #[doc = "Bit 4 - CTSU Control Block Initialization"]
279    #[inline(always)]
280    #[must_use]
281    pub fn ctsuinit(&mut self) -> CTSUINIT_W<4> {
282        CTSUINIT_W::new(self)
283    }
284    #[doc = "Writes raw bits to the register."]
285    #[inline(always)]
286    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
287        self.0.bits(bits);
288        self
289    }
290}
291#[doc = "CTSU Control Register 0\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 [ctsucr0](index.html) module"]
292pub struct CTSUCR0_SPEC;
293impl crate::RegisterSpec for CTSUCR0_SPEC {
294    type Ux = u8;
295}
296#[doc = "`read()` method returns [ctsucr0::R](R) reader structure"]
297impl crate::Readable for CTSUCR0_SPEC {
298    type Reader = R;
299}
300#[doc = "`write(|w| ..)` method takes [ctsucr0::W](W) writer structure"]
301impl crate::Writable for CTSUCR0_SPEC {
302    type Writer = W;
303    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
304    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
305}
306#[doc = "`reset()` method sets CTSUCR0 to value 0"]
307impl crate::Resettable for CTSUCR0_SPEC {
308    const RESET_VALUE: Self::Ux = 0;
309}