bl616_pac/pwm/group/
interrupt_mask.rs

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