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