bl61x_pac/pwm/group/
interrupt_enable.rs1#[doc = "Register `interrupt_enable` reader"]
2pub type R = crate::R<INTERRUPT_ENABLE_SPEC>;
3#[doc = "Register `interrupt_enable` writer"]
4pub type W = crate::W<INTERRUPT_ENABLE_SPEC>;
5#[doc = "Field `threshold_low(0-3)` reader - Intenal counter for channel have exceeded low threshold"]
6pub type THRESHOLD_LOW_R = crate::BitReader<INTERRUPT_ENABLE_A>;
7#[doc = "Intenal counter for channel have exceeded low threshold\n\nValue on reset: 1"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum INTERRUPT_ENABLE_A {
10 #[doc = "1: Enable interrupt"]
11 ENABLE = 1,
12 #[doc = "0: Disable interrupt"]
13 DISABLE = 0,
14}
15impl From<INTERRUPT_ENABLE_A> for bool {
16 #[inline(always)]
17 fn from(variant: INTERRUPT_ENABLE_A) -> Self {
18 variant as u8 != 0
19 }
20}
21impl THRESHOLD_LOW_R {
22 #[doc = "Get enumerated values variant"]
23 #[inline(always)]
24 pub const fn variant(&self) -> INTERRUPT_ENABLE_A {
25 match self.bits {
26 true => INTERRUPT_ENABLE_A::ENABLE,
27 false => INTERRUPT_ENABLE_A::DISABLE,
28 }
29 }
30 #[doc = "Enable interrupt"]
31 #[inline(always)]
32 pub fn is_enable(&self) -> bool {
33 *self == INTERRUPT_ENABLE_A::ENABLE
34 }
35 #[doc = "Disable interrupt"]
36 #[inline(always)]
37 pub fn is_disable(&self) -> bool {
38 *self == INTERRUPT_ENABLE_A::DISABLE
39 }
40}
41#[doc = "Field `threshold_low(0-3)` writer - Intenal counter for channel have exceeded low threshold"]
42pub type THRESHOLD_LOW_W<'a, REG> = crate::BitWriter<'a, REG, INTERRUPT_ENABLE_A>;
43impl<'a, REG> THRESHOLD_LOW_W<'a, REG>
44where
45 REG: crate::Writable + crate::RegisterSpec,
46{
47 #[doc = "Enable interrupt"]
48 #[inline(always)]
49 pub fn enable(self) -> &'a mut crate::W<REG> {
50 self.variant(INTERRUPT_ENABLE_A::ENABLE)
51 }
52 #[doc = "Disable interrupt"]
53 #[inline(always)]
54 pub fn disable(self) -> &'a mut crate::W<REG> {
55 self.variant(INTERRUPT_ENABLE_A::DISABLE)
56 }
57}
58#[doc = "Field `threshold_high(0-3)` reader - Intenal counter for channel have exceeded high threshold"]
59pub use THRESHOLD_LOW_R as THRESHOLD_HIGH_R;
60#[doc = "Field `interrupt_period` reader - Intenal counter for channel have exceeded interrupt cycle threshold"]
61pub use THRESHOLD_LOW_R as INTERRUPT_PERIOD_R;
62#[doc = "Field `external_break` reader - External break signal occurred"]
63pub use THRESHOLD_LOW_R as EXTERNAL_BREAK_R;
64#[doc = "Field `repeat` reader - Peripheral group have completed one repeat cycle"]
65pub use THRESHOLD_LOW_R as REPEAT_R;
66#[doc = "Field `threshold_high(0-3)` writer - Intenal counter for channel have exceeded high threshold"]
67pub use THRESHOLD_LOW_W as THRESHOLD_HIGH_W;
68#[doc = "Field `interrupt_period` writer - Intenal counter for channel have exceeded interrupt cycle threshold"]
69pub use THRESHOLD_LOW_W as INTERRUPT_PERIOD_W;
70#[doc = "Field `external_break` writer - External break signal occurred"]
71pub use THRESHOLD_LOW_W as EXTERNAL_BREAK_W;
72#[doc = "Field `repeat` writer - Peripheral group have completed one repeat cycle"]
73pub use THRESHOLD_LOW_W as REPEAT_W;
74impl R {
75 #[doc = "Intenal counter for channel have exceeded low threshold"]
76 #[doc = ""]
77 #[doc = "NOTE: `n` is number of field in register. `n == 0` corresponds to `threshold_low0` field"]
78 #[inline(always)]
79 pub fn threshold_low(&self, n: u8) -> THRESHOLD_LOW_R {
80 #[allow(clippy::no_effect)]
81 [(); 4][n as usize];
82 THRESHOLD_LOW_R::new(((self.bits >> (n * 2)) & 1) != 0)
83 }
84 #[doc = "Iterator for array of:"]
85 #[doc = "Intenal counter for channel have exceeded low threshold"]
86 #[inline(always)]
87 pub fn threshold_low_iter(&self) -> impl Iterator<Item = THRESHOLD_LOW_R> + '_ {
88 (0..4).map(move |n| THRESHOLD_LOW_R::new(((self.bits >> (n * 2)) & 1) != 0))
89 }
90 #[doc = "Bit 0 - Intenal counter for channel have exceeded low threshold"]
91 #[inline(always)]
92 pub fn threshold_low0(&self) -> THRESHOLD_LOW_R {
93 THRESHOLD_LOW_R::new((self.bits & 1) != 0)
94 }
95 #[doc = "Bit 2 - Intenal counter for channel have exceeded low threshold"]
96 #[inline(always)]
97 pub fn threshold_low1(&self) -> THRESHOLD_LOW_R {
98 THRESHOLD_LOW_R::new(((self.bits >> 2) & 1) != 0)
99 }
100 #[doc = "Bit 4 - Intenal counter for channel have exceeded low threshold"]
101 #[inline(always)]
102 pub fn threshold_low2(&self) -> THRESHOLD_LOW_R {
103 THRESHOLD_LOW_R::new(((self.bits >> 4) & 1) != 0)
104 }
105 #[doc = "Bit 6 - Intenal counter for channel have exceeded low threshold"]
106 #[inline(always)]
107 pub fn threshold_low3(&self) -> THRESHOLD_LOW_R {
108 THRESHOLD_LOW_R::new(((self.bits >> 6) & 1) != 0)
109 }
110 #[doc = "Intenal counter for channel have exceeded high threshold"]
111 #[doc = ""]
112 #[doc = "NOTE: `n` is number of field in register. `n == 0` corresponds to `threshold_high0` field"]
113 #[inline(always)]
114 pub fn threshold_high(&self, n: u8) -> THRESHOLD_HIGH_R {
115 #[allow(clippy::no_effect)]
116 [(); 4][n as usize];
117 THRESHOLD_HIGH_R::new(((self.bits >> (n * 2 + 1)) & 1) != 0)
118 }
119 #[doc = "Iterator for array of:"]
120 #[doc = "Intenal counter for channel have exceeded high threshold"]
121 #[inline(always)]
122 pub fn threshold_high_iter(&self) -> impl Iterator<Item = THRESHOLD_HIGH_R> + '_ {
123 (0..4).map(move |n| THRESHOLD_HIGH_R::new(((self.bits >> (n * 2 + 1)) & 1) != 0))
124 }
125 #[doc = "Bit 1 - Intenal counter for channel have exceeded high threshold"]
126 #[inline(always)]
127 pub fn threshold_high0(&self) -> THRESHOLD_HIGH_R {
128 THRESHOLD_HIGH_R::new(((self.bits >> 1) & 1) != 0)
129 }
130 #[doc = "Bit 3 - Intenal counter for channel have exceeded high threshold"]
131 #[inline(always)]
132 pub fn threshold_high1(&self) -> THRESHOLD_HIGH_R {
133 THRESHOLD_HIGH_R::new(((self.bits >> 3) & 1) != 0)
134 }
135 #[doc = "Bit 5 - Intenal counter for channel have exceeded high threshold"]
136 #[inline(always)]
137 pub fn threshold_high2(&self) -> THRESHOLD_HIGH_R {
138 THRESHOLD_HIGH_R::new(((self.bits >> 5) & 1) != 0)
139 }
140 #[doc = "Bit 7 - Intenal counter for channel have exceeded high threshold"]
141 #[inline(always)]
142 pub fn threshold_high3(&self) -> THRESHOLD_HIGH_R {
143 THRESHOLD_HIGH_R::new(((self.bits >> 7) & 1) != 0)
144 }
145 #[doc = "Bit 8 - Intenal counter for channel have exceeded interrupt cycle threshold"]
146 #[inline(always)]
147 pub fn interrupt_period(&self) -> INTERRUPT_PERIOD_R {
148 INTERRUPT_PERIOD_R::new(((self.bits >> 8) & 1) != 0)
149 }
150 #[doc = "Bit 9 - External break signal occurred"]
151 #[inline(always)]
152 pub fn external_break(&self) -> EXTERNAL_BREAK_R {
153 EXTERNAL_BREAK_R::new(((self.bits >> 9) & 1) != 0)
154 }
155 #[doc = "Bit 10 - Peripheral group have completed one repeat cycle"]
156 #[inline(always)]
157 pub fn repeat(&self) -> REPEAT_R {
158 REPEAT_R::new(((self.bits >> 10) & 1) != 0)
159 }
160}
161impl W {
162 #[doc = "Intenal counter for channel have exceeded low threshold"]
163 #[doc = ""]
164 #[doc = "NOTE: `n` is number of field in register. `n == 0` corresponds to `threshold_low0` field"]
165 #[inline(always)]
166 #[must_use]
167 pub fn threshold_low(&mut self, n: u8) -> THRESHOLD_LOW_W<INTERRUPT_ENABLE_SPEC> {
168 #[allow(clippy::no_effect)]
169 [(); 4][n as usize];
170 THRESHOLD_LOW_W::new(self, n * 2)
171 }
172 #[doc = "Bit 0 - Intenal counter for channel have exceeded low threshold"]
173 #[inline(always)]
174 #[must_use]
175 pub fn threshold_low0(&mut self) -> THRESHOLD_LOW_W<INTERRUPT_ENABLE_SPEC> {
176 THRESHOLD_LOW_W::new(self, 0)
177 }
178 #[doc = "Bit 2 - Intenal counter for channel have exceeded low threshold"]
179 #[inline(always)]
180 #[must_use]
181 pub fn threshold_low1(&mut self) -> THRESHOLD_LOW_W<INTERRUPT_ENABLE_SPEC> {
182 THRESHOLD_LOW_W::new(self, 2)
183 }
184 #[doc = "Bit 4 - Intenal counter for channel have exceeded low threshold"]
185 #[inline(always)]
186 #[must_use]
187 pub fn threshold_low2(&mut self) -> THRESHOLD_LOW_W<INTERRUPT_ENABLE_SPEC> {
188 THRESHOLD_LOW_W::new(self, 4)
189 }
190 #[doc = "Bit 6 - Intenal counter for channel have exceeded low threshold"]
191 #[inline(always)]
192 #[must_use]
193 pub fn threshold_low3(&mut self) -> THRESHOLD_LOW_W<INTERRUPT_ENABLE_SPEC> {
194 THRESHOLD_LOW_W::new(self, 6)
195 }
196 #[doc = "Intenal counter for channel have exceeded high threshold"]
197 #[doc = ""]
198 #[doc = "NOTE: `n` is number of field in register. `n == 0` corresponds to `threshold_high0` field"]
199 #[inline(always)]
200 #[must_use]
201 pub fn threshold_high(&mut self, n: u8) -> THRESHOLD_HIGH_W<INTERRUPT_ENABLE_SPEC> {
202 #[allow(clippy::no_effect)]
203 [(); 4][n as usize];
204 THRESHOLD_HIGH_W::new(self, n * 2 + 1)
205 }
206 #[doc = "Bit 1 - Intenal counter for channel have exceeded high threshold"]
207 #[inline(always)]
208 #[must_use]
209 pub fn threshold_high0(&mut self) -> THRESHOLD_HIGH_W<INTERRUPT_ENABLE_SPEC> {
210 THRESHOLD_HIGH_W::new(self, 1)
211 }
212 #[doc = "Bit 3 - Intenal counter for channel have exceeded high threshold"]
213 #[inline(always)]
214 #[must_use]
215 pub fn threshold_high1(&mut self) -> THRESHOLD_HIGH_W<INTERRUPT_ENABLE_SPEC> {
216 THRESHOLD_HIGH_W::new(self, 3)
217 }
218 #[doc = "Bit 5 - Intenal counter for channel have exceeded high threshold"]
219 #[inline(always)]
220 #[must_use]
221 pub fn threshold_high2(&mut self) -> THRESHOLD_HIGH_W<INTERRUPT_ENABLE_SPEC> {
222 THRESHOLD_HIGH_W::new(self, 5)
223 }
224 #[doc = "Bit 7 - Intenal counter for channel have exceeded high threshold"]
225 #[inline(always)]
226 #[must_use]
227 pub fn threshold_high3(&mut self) -> THRESHOLD_HIGH_W<INTERRUPT_ENABLE_SPEC> {
228 THRESHOLD_HIGH_W::new(self, 7)
229 }
230 #[doc = "Bit 8 - Intenal counter for channel have exceeded interrupt cycle threshold"]
231 #[inline(always)]
232 #[must_use]
233 pub fn interrupt_period(&mut self) -> INTERRUPT_PERIOD_W<INTERRUPT_ENABLE_SPEC> {
234 INTERRUPT_PERIOD_W::new(self, 8)
235 }
236 #[doc = "Bit 9 - External break signal occurred"]
237 #[inline(always)]
238 #[must_use]
239 pub fn external_break(&mut self) -> EXTERNAL_BREAK_W<INTERRUPT_ENABLE_SPEC> {
240 EXTERNAL_BREAK_W::new(self, 9)
241 }
242 #[doc = "Bit 10 - Peripheral group have completed one repeat cycle"]
243 #[inline(always)]
244 #[must_use]
245 pub fn repeat(&mut self) -> REPEAT_W<INTERRUPT_ENABLE_SPEC> {
246 REPEAT_W::new(self, 10)
247 }
248 #[doc = r" Writes raw bits to the register."]
249 #[doc = r""]
250 #[doc = r" # Safety"]
251 #[doc = r""]
252 #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
253 #[inline(always)]
254 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
255 self.bits = bits;
256 self
257 }
258}
259#[doc = "Interrupt enable register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`interrupt_enable::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`interrupt_enable::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
260pub struct INTERRUPT_ENABLE_SPEC;
261impl crate::RegisterSpec for INTERRUPT_ENABLE_SPEC {
262 type Ux = u32;
263}
264#[doc = "`read()` method returns [`interrupt_enable::R`](R) reader structure"]
265impl crate::Readable for INTERRUPT_ENABLE_SPEC {}
266#[doc = "`write(|w| ..)` method takes [`interrupt_enable::W`](W) writer structure"]
267impl crate::Writable for INTERRUPT_ENABLE_SPEC {
268 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
269 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
270}
271#[doc = "`reset()` method sets interrupt_enable to value 0x7f"]
272impl crate::Resettable for INTERRUPT_ENABLE_SPEC {
273 const RESET_VALUE: Self::Ux = 0x7f;
274}