bl616_pac/pwm/group/
interrupt_state.rs1#[doc = "Register `interrupt_state` reader"]
2pub struct R(crate::R<INTERRUPT_STATE_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<INTERRUPT_STATE_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<INTERRUPT_STATE_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<INTERRUPT_STATE_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `threshold_low[0-3]` reader - Intenal counter for channel have exceeded low threshold"]
17pub type THRESHOLD_LOW_R = crate::BitReader<INTERRUPT_STATE_A>;
18#[doc = "Intenal counter for channel have exceeded low threshold\n\nValue on reset: 0"]
19#[derive(Clone, Copy, Debug, PartialEq, Eq)]
20pub enum INTERRUPT_STATE_A {
21 #[doc = "1: Has interrupt"]
22 HAS_INTERRUPT = 1,
23 #[doc = "0: No interrupt occurred"]
24 NO_INTERRUPT = 0,
25}
26impl From<INTERRUPT_STATE_A> for bool {
27 #[inline(always)]
28 fn from(variant: INTERRUPT_STATE_A) -> Self {
29 variant as u8 != 0
30 }
31}
32impl THRESHOLD_LOW_R {
33 #[doc = "Get enumerated values variant"]
34 #[inline(always)]
35 pub fn variant(&self) -> INTERRUPT_STATE_A {
36 match self.bits {
37 true => INTERRUPT_STATE_A::HAS_INTERRUPT,
38 false => INTERRUPT_STATE_A::NO_INTERRUPT,
39 }
40 }
41 #[doc = "Checks if the value of the field is `HAS_INTERRUPT`"]
42 #[inline(always)]
43 pub fn is_has_interrupt(&self) -> bool {
44 *self == INTERRUPT_STATE_A::HAS_INTERRUPT
45 }
46 #[doc = "Checks if the value of the field is `NO_INTERRUPT`"]
47 #[inline(always)]
48 pub fn is_no_interrupt(&self) -> bool {
49 *self == INTERRUPT_STATE_A::NO_INTERRUPT
50 }
51}
52#[doc = "Field `threshold_high[0-3]` reader - Intenal counter for channel have exceeded high threshold"]
53pub use THRESHOLD_LOW_R as THRESHOLD_HIGH_R;
54#[doc = "Field `interrupt_period` reader - Intenal counter for channel have exceeded interrupt cycle threshold"]
55pub use THRESHOLD_LOW_R as INTERRUPT_PERIOD_R;
56#[doc = "Field `external_break` reader - External break signal occurred"]
57pub use THRESHOLD_LOW_R as EXTERNAL_BREAK_R;
58#[doc = "Field `repeat` reader - Peripheral group have completed one repeat cycle"]
59pub use THRESHOLD_LOW_R as REPEAT_R;
60impl R {
61 #[doc = "Intenal counter for channel have exceeded low threshold"]
62 #[inline(always)]
63 pub unsafe fn threshold_low(&self, n: u8) -> THRESHOLD_LOW_R {
64 THRESHOLD_LOW_R::new(((self.bits >> (n * 2)) & 1) != 0)
65 }
66 #[doc = "Bit 0 - Intenal counter for channel have exceeded low threshold"]
67 #[inline(always)]
68 pub fn threshold_low0(&self) -> THRESHOLD_LOW_R {
69 THRESHOLD_LOW_R::new((self.bits & 1) != 0)
70 }
71 #[doc = "Bit 2 - Intenal counter for channel have exceeded low threshold"]
72 #[inline(always)]
73 pub fn threshold_low1(&self) -> THRESHOLD_LOW_R {
74 THRESHOLD_LOW_R::new(((self.bits >> 2) & 1) != 0)
75 }
76 #[doc = "Bit 4 - Intenal counter for channel have exceeded low threshold"]
77 #[inline(always)]
78 pub fn threshold_low2(&self) -> THRESHOLD_LOW_R {
79 THRESHOLD_LOW_R::new(((self.bits >> 4) & 1) != 0)
80 }
81 #[doc = "Bit 6 - Intenal counter for channel have exceeded low threshold"]
82 #[inline(always)]
83 pub fn threshold_low3(&self) -> THRESHOLD_LOW_R {
84 THRESHOLD_LOW_R::new(((self.bits >> 6) & 1) != 0)
85 }
86 #[doc = "Intenal counter for channel have exceeded high threshold"]
87 #[inline(always)]
88 pub unsafe fn threshold_high(&self, n: u8) -> THRESHOLD_HIGH_R {
89 THRESHOLD_HIGH_R::new(((self.bits >> (n * 2 + 1)) & 1) != 0)
90 }
91 #[doc = "Bit 1 - Intenal counter for channel have exceeded high threshold"]
92 #[inline(always)]
93 pub fn threshold_high0(&self) -> THRESHOLD_HIGH_R {
94 THRESHOLD_HIGH_R::new(((self.bits >> 1) & 1) != 0)
95 }
96 #[doc = "Bit 3 - Intenal counter for channel have exceeded high threshold"]
97 #[inline(always)]
98 pub fn threshold_high1(&self) -> THRESHOLD_HIGH_R {
99 THRESHOLD_HIGH_R::new(((self.bits >> 3) & 1) != 0)
100 }
101 #[doc = "Bit 5 - Intenal counter for channel have exceeded high threshold"]
102 #[inline(always)]
103 pub fn threshold_high2(&self) -> THRESHOLD_HIGH_R {
104 THRESHOLD_HIGH_R::new(((self.bits >> 5) & 1) != 0)
105 }
106 #[doc = "Bit 7 - Intenal counter for channel have exceeded high threshold"]
107 #[inline(always)]
108 pub fn threshold_high3(&self) -> THRESHOLD_HIGH_R {
109 THRESHOLD_HIGH_R::new(((self.bits >> 7) & 1) != 0)
110 }
111 #[doc = "Bit 8 - Intenal counter for channel have exceeded interrupt cycle threshold"]
112 #[inline(always)]
113 pub fn interrupt_period(&self) -> INTERRUPT_PERIOD_R {
114 INTERRUPT_PERIOD_R::new(((self.bits >> 8) & 1) != 0)
115 }
116 #[doc = "Bit 9 - External break signal occurred"]
117 #[inline(always)]
118 pub fn external_break(&self) -> EXTERNAL_BREAK_R {
119 EXTERNAL_BREAK_R::new(((self.bits >> 9) & 1) != 0)
120 }
121 #[doc = "Bit 10 - Peripheral group have completed one repeat cycle"]
122 #[inline(always)]
123 pub fn repeat(&self) -> REPEAT_R {
124 REPEAT_R::new(((self.bits >> 10) & 1) != 0)
125 }
126}
127#[doc = "Interrupt state register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [interrupt_state](index.html) module"]
128pub struct INTERRUPT_STATE_SPEC;
129impl crate::RegisterSpec for INTERRUPT_STATE_SPEC {
130 type Ux = u32;
131}
132#[doc = "`read()` method returns [interrupt_state::R](R) reader structure"]
133impl crate::Readable for INTERRUPT_STATE_SPEC {
134 type Reader = R;
135}
136#[doc = "`reset()` method sets interrupt_state to value 0"]
137impl crate::Resettable for INTERRUPT_STATE_SPEC {
138 const RESET_VALUE: Self::Ux = 0;
139}