corstone300_pac/timer0/
cntp_ctl.rs1#[doc = "Register `CNTP_CTL` reader"]
6pub struct R(crate::R<CNTP_CTL_SPEC>);
7impl core::ops::Deref for R {
8 type Target = crate::R<CNTP_CTL_SPEC>;
9 #[inline(always)]
10 fn deref(&self) -> &Self::Target {
11 &self.0
12 }
13}
14impl From<crate::R<CNTP_CTL_SPEC>> for R {
15 #[inline(always)]
16 fn from(reader: crate::R<CNTP_CTL_SPEC>) -> Self {
17 R(reader)
18 }
19}
20#[doc = "Register `CNTP_CTL` writer"]
21pub struct W(crate::W<CNTP_CTL_SPEC>);
22impl core::ops::Deref for W {
23 type Target = crate::W<CNTP_CTL_SPEC>;
24 #[inline(always)]
25 fn deref(&self) -> &Self::Target {
26 &self.0
27 }
28}
29impl core::ops::DerefMut for W {
30 #[inline(always)]
31 fn deref_mut(&mut self) -> &mut Self::Target {
32 &mut self.0
33 }
34}
35impl From<crate::W<CNTP_CTL_SPEC>> for W {
36 #[inline(always)]
37 fn from(writer: crate::W<CNTP_CTL_SPEC>) -> Self {
38 W(writer)
39 }
40}
41#[doc = "Field `En` reader - Enable Counter"]
42pub type EN_R = crate::BitReader<EN_A>;
43#[doc = "Enable Counter\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum EN_A {
46 #[doc = "0: `0`"]
47 OFF = 0,
48 #[doc = "1: `1`"]
49 ON = 1,
50}
51impl From<EN_A> for bool {
52 #[inline(always)]
53 fn from(variant: EN_A) -> Self {
54 variant as u8 != 0
55 }
56}
57impl EN_R {
58 #[doc = "Get enumerated values variant"]
59 #[inline(always)]
60 pub fn variant(&self) -> EN_A {
61 match self.bits {
62 false => EN_A::OFF,
63 true => EN_A::ON,
64 }
65 }
66 #[doc = "Checks if the value of the field is `OFF`"]
67 #[inline(always)]
68 pub fn is_off(&self) -> bool {
69 *self == EN_A::OFF
70 }
71 #[doc = "Checks if the value of the field is `ON`"]
72 #[inline(always)]
73 pub fn is_on(&self) -> bool {
74 *self == EN_A::ON
75 }
76}
77#[doc = "Field `En` writer - Enable Counter"]
78pub type EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CNTP_CTL_SPEC, EN_A, O>;
79impl<'a, const O: u8> EN_W<'a, O> {
80 #[doc = "`0`"]
81 #[inline(always)]
82 pub fn off(self) -> &'a mut W {
83 self.variant(EN_A::OFF)
84 }
85 #[doc = "`1`"]
86 #[inline(always)]
87 pub fn on(self) -> &'a mut W {
88 self.variant(EN_A::ON)
89 }
90}
91#[doc = "Field `IMASK` reader - Interrupt Mask"]
92pub type IMASK_R = crate::BitReader<IMASK_A>;
93#[doc = "Interrupt Mask\n\nValue on reset: 0"]
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
95pub enum IMASK_A {
96 #[doc = "0: `0`"]
97 OFF = 0,
98 #[doc = "1: `1`"]
99 ON = 1,
100}
101impl From<IMASK_A> for bool {
102 #[inline(always)]
103 fn from(variant: IMASK_A) -> Self {
104 variant as u8 != 0
105 }
106}
107impl IMASK_R {
108 #[doc = "Get enumerated values variant"]
109 #[inline(always)]
110 pub fn variant(&self) -> IMASK_A {
111 match self.bits {
112 false => IMASK_A::OFF,
113 true => IMASK_A::ON,
114 }
115 }
116 #[doc = "Checks if the value of the field is `OFF`"]
117 #[inline(always)]
118 pub fn is_off(&self) -> bool {
119 *self == IMASK_A::OFF
120 }
121 #[doc = "Checks if the value of the field is `ON`"]
122 #[inline(always)]
123 pub fn is_on(&self) -> bool {
124 *self == IMASK_A::ON
125 }
126}
127#[doc = "Field `IMASK` writer - Interrupt Mask"]
128pub type IMASK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CNTP_CTL_SPEC, IMASK_A, O>;
129impl<'a, const O: u8> IMASK_W<'a, O> {
130 #[doc = "`0`"]
131 #[inline(always)]
132 pub fn off(self) -> &'a mut W {
133 self.variant(IMASK_A::OFF)
134 }
135 #[doc = "`1`"]
136 #[inline(always)]
137 pub fn on(self) -> &'a mut W {
138 self.variant(IMASK_A::ON)
139 }
140}
141#[doc = "Field `ISTATUS` reader - Interrupt Status"]
142pub type ISTATUS_R = crate::BitReader<ISTATUS_A>;
143#[doc = "Interrupt Status\n\nValue on reset: 0"]
144#[derive(Clone, Copy, Debug, PartialEq, Eq)]
145pub enum ISTATUS_A {
146 #[doc = "0: `0`"]
147 OFF = 0,
148 #[doc = "1: `1`"]
149 ON = 1,
150}
151impl From<ISTATUS_A> for bool {
152 #[inline(always)]
153 fn from(variant: ISTATUS_A) -> Self {
154 variant as u8 != 0
155 }
156}
157impl ISTATUS_R {
158 #[doc = "Get enumerated values variant"]
159 #[inline(always)]
160 pub fn variant(&self) -> ISTATUS_A {
161 match self.bits {
162 false => ISTATUS_A::OFF,
163 true => ISTATUS_A::ON,
164 }
165 }
166 #[doc = "Checks if the value of the field is `OFF`"]
167 #[inline(always)]
168 pub fn is_off(&self) -> bool {
169 *self == ISTATUS_A::OFF
170 }
171 #[doc = "Checks if the value of the field is `ON`"]
172 #[inline(always)]
173 pub fn is_on(&self) -> bool {
174 *self == ISTATUS_A::ON
175 }
176}
177#[doc = "Field `ISTATUS` writer - Interrupt Status"]
178pub type ISTATUS_W<'a, const O: u8> = crate::BitWriter<'a, u32, CNTP_CTL_SPEC, ISTATUS_A, O>;
179impl<'a, const O: u8> ISTATUS_W<'a, O> {
180 #[doc = "`0`"]
181 #[inline(always)]
182 pub fn off(self) -> &'a mut W {
183 self.variant(ISTATUS_A::OFF)
184 }
185 #[doc = "`1`"]
186 #[inline(always)]
187 pub fn on(self) -> &'a mut W {
188 self.variant(ISTATUS_A::ON)
189 }
190}
191impl R {
192 #[doc = "Bit 0 - Enable Counter"]
193 #[inline(always)]
194 pub fn en(&self) -> EN_R {
195 EN_R::new((self.bits & 1) != 0)
196 }
197 #[doc = "Bit 1 - Interrupt Mask"]
198 #[inline(always)]
199 pub fn imask(&self) -> IMASK_R {
200 IMASK_R::new(((self.bits >> 1) & 1) != 0)
201 }
202 #[doc = "Bit 2 - Interrupt Status"]
203 #[inline(always)]
204 pub fn istatus(&self) -> ISTATUS_R {
205 ISTATUS_R::new(((self.bits >> 2) & 1) != 0)
206 }
207}
208impl W {
209 #[doc = "Bit 0 - Enable Counter"]
210 #[inline(always)]
211 pub fn en(&mut self) -> EN_W<0> {
212 EN_W::new(self)
213 }
214 #[doc = "Bit 1 - Interrupt Mask"]
215 #[inline(always)]
216 pub fn imask(&mut self) -> IMASK_W<1> {
217 IMASK_W::new(self)
218 }
219 #[doc = "Bit 2 - Interrupt Status"]
220 #[inline(always)]
221 pub fn istatus(&mut self) -> ISTATUS_W<2> {
222 ISTATUS_W::new(self)
223 }
224 #[doc = "Writes raw bits to the register."]
225 #[inline(always)]
226 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
227 self.0.bits(bits);
228 self
229 }
230}
231#[doc = "Timer Control register.\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 [cntp_ctl](index.html) module"]
232pub struct CNTP_CTL_SPEC;
233impl crate::RegisterSpec for CNTP_CTL_SPEC {
234 type Ux = u32;
235}
236#[doc = "`read()` method returns [cntp_ctl::R](R) reader structure"]
237impl crate::Readable for CNTP_CTL_SPEC {
238 type Reader = R;
239}
240#[doc = "`write(|w| ..)` method takes [cntp_ctl::W](W) writer structure"]
241impl crate::Writable for CNTP_CTL_SPEC {
242 type Writer = W;
243}
244#[doc = "`reset()` method sets CNTP_CTL to value 0"]
245impl crate::Resettable for CNTP_CTL_SPEC {
246 #[inline(always)]
247 fn reset_value() -> Self::Ux {
248 0
249 }
250}