nrf52/ecb/intenclr/
mod.rs1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::INTENCLR {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = "Possible values of the field `ENDECB`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum ENDECBR {
48 #[doc = "Read: Disabled"]
49 DISABLED,
50 #[doc = "Read: Enabled"]
51 ENABLED,
52}
53impl ENDECBR {
54 #[doc = r" Returns `true` if the bit is clear (0)"]
55 #[inline]
56 pub fn bit_is_clear(&self) -> bool {
57 !self.bit()
58 }
59 #[doc = r" Returns `true` if the bit is set (1)"]
60 #[inline]
61 pub fn bit_is_set(&self) -> bool {
62 self.bit()
63 }
64 #[doc = r" Value of the field as raw bits"]
65 #[inline]
66 pub fn bit(&self) -> bool {
67 match *self {
68 ENDECBR::DISABLED => false,
69 ENDECBR::ENABLED => true,
70 }
71 }
72 #[allow(missing_docs)]
73 #[doc(hidden)]
74 #[inline]
75 pub fn _from(value: bool) -> ENDECBR {
76 match value {
77 false => ENDECBR::DISABLED,
78 true => ENDECBR::ENABLED,
79 }
80 }
81 #[doc = "Checks if the value of the field is `DISABLED`"]
82 #[inline]
83 pub fn is_disabled(&self) -> bool {
84 *self == ENDECBR::DISABLED
85 }
86 #[doc = "Checks if the value of the field is `ENABLED`"]
87 #[inline]
88 pub fn is_enabled(&self) -> bool {
89 *self == ENDECBR::ENABLED
90 }
91}
92#[doc = "Possible values of the field `ERRORECB`"]
93#[derive(Clone, Copy, Debug, PartialEq)]
94pub enum ERRORECBR {
95 #[doc = "Read: Disabled"]
96 DISABLED,
97 #[doc = "Read: Enabled"]
98 ENABLED,
99}
100impl ERRORECBR {
101 #[doc = r" Returns `true` if the bit is clear (0)"]
102 #[inline]
103 pub fn bit_is_clear(&self) -> bool {
104 !self.bit()
105 }
106 #[doc = r" Returns `true` if the bit is set (1)"]
107 #[inline]
108 pub fn bit_is_set(&self) -> bool {
109 self.bit()
110 }
111 #[doc = r" Value of the field as raw bits"]
112 #[inline]
113 pub fn bit(&self) -> bool {
114 match *self {
115 ERRORECBR::DISABLED => false,
116 ERRORECBR::ENABLED => true,
117 }
118 }
119 #[allow(missing_docs)]
120 #[doc(hidden)]
121 #[inline]
122 pub fn _from(value: bool) -> ERRORECBR {
123 match value {
124 false => ERRORECBR::DISABLED,
125 true => ERRORECBR::ENABLED,
126 }
127 }
128 #[doc = "Checks if the value of the field is `DISABLED`"]
129 #[inline]
130 pub fn is_disabled(&self) -> bool {
131 *self == ERRORECBR::DISABLED
132 }
133 #[doc = "Checks if the value of the field is `ENABLED`"]
134 #[inline]
135 pub fn is_enabled(&self) -> bool {
136 *self == ERRORECBR::ENABLED
137 }
138}
139#[doc = "Values that can be written to the field `ENDECB`"]
140pub enum ENDECBW {
141 #[doc = "Disable"]
142 CLEAR,
143}
144impl ENDECBW {
145 #[allow(missing_docs)]
146 #[doc(hidden)]
147 #[inline]
148 pub fn _bits(&self) -> bool {
149 match *self {
150 ENDECBW::CLEAR => true,
151 }
152 }
153}
154#[doc = r" Proxy"]
155pub struct _ENDECBW<'a> {
156 w: &'a mut W,
157}
158impl<'a> _ENDECBW<'a> {
159 #[doc = r" Writes `variant` to the field"]
160 #[inline]
161 pub fn variant(self, variant: ENDECBW) -> &'a mut W {
162 {
163 self.bit(variant._bits())
164 }
165 }
166 #[doc = "Disable"]
167 #[inline]
168 pub fn clear(self) -> &'a mut W {
169 self.variant(ENDECBW::CLEAR)
170 }
171 #[doc = r" Sets the field bit"]
172 pub fn set_bit(self) -> &'a mut W {
173 self.bit(true)
174 }
175 #[doc = r" Clears the field bit"]
176 pub fn clear_bit(self) -> &'a mut W {
177 self.bit(false)
178 }
179 #[doc = r" Writes raw bits to the field"]
180 #[inline]
181 pub fn bit(self, value: bool) -> &'a mut W {
182 const MASK: bool = true;
183 const OFFSET: u8 = 0;
184 self.w.bits &= !((MASK as u32) << OFFSET);
185 self.w.bits |= ((value & MASK) as u32) << OFFSET;
186 self.w
187 }
188}
189#[doc = "Values that can be written to the field `ERRORECB`"]
190pub enum ERRORECBW {
191 #[doc = "Disable"]
192 CLEAR,
193}
194impl ERRORECBW {
195 #[allow(missing_docs)]
196 #[doc(hidden)]
197 #[inline]
198 pub fn _bits(&self) -> bool {
199 match *self {
200 ERRORECBW::CLEAR => true,
201 }
202 }
203}
204#[doc = r" Proxy"]
205pub struct _ERRORECBW<'a> {
206 w: &'a mut W,
207}
208impl<'a> _ERRORECBW<'a> {
209 #[doc = r" Writes `variant` to the field"]
210 #[inline]
211 pub fn variant(self, variant: ERRORECBW) -> &'a mut W {
212 {
213 self.bit(variant._bits())
214 }
215 }
216 #[doc = "Disable"]
217 #[inline]
218 pub fn clear(self) -> &'a mut W {
219 self.variant(ERRORECBW::CLEAR)
220 }
221 #[doc = r" Sets the field bit"]
222 pub fn set_bit(self) -> &'a mut W {
223 self.bit(true)
224 }
225 #[doc = r" Clears the field bit"]
226 pub fn clear_bit(self) -> &'a mut W {
227 self.bit(false)
228 }
229 #[doc = r" Writes raw bits to the field"]
230 #[inline]
231 pub fn bit(self, value: bool) -> &'a mut W {
232 const MASK: bool = true;
233 const OFFSET: u8 = 1;
234 self.w.bits &= !((MASK as u32) << OFFSET);
235 self.w.bits |= ((value & MASK) as u32) << OFFSET;
236 self.w
237 }
238}
239impl R {
240 #[doc = r" Value of the register as raw bits"]
241 #[inline]
242 pub fn bits(&self) -> u32 {
243 self.bits
244 }
245 #[doc = "Bit 0 - Write '1' to Disable interrupt for ENDECB event"]
246 #[inline]
247 pub fn endecb(&self) -> ENDECBR {
248 ENDECBR::_from({
249 const MASK: bool = true;
250 const OFFSET: u8 = 0;
251 ((self.bits >> OFFSET) & MASK as u32) != 0
252 })
253 }
254 #[doc = "Bit 1 - Write '1' to Disable interrupt for ERRORECB event"]
255 #[inline]
256 pub fn errorecb(&self) -> ERRORECBR {
257 ERRORECBR::_from({
258 const MASK: bool = true;
259 const OFFSET: u8 = 1;
260 ((self.bits >> OFFSET) & MASK as u32) != 0
261 })
262 }
263}
264impl W {
265 #[doc = r" Reset value of the register"]
266 #[inline]
267 pub fn reset_value() -> W {
268 W { bits: 0 }
269 }
270 #[doc = r" Writes raw bits to the register"]
271 #[inline]
272 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
273 self.bits = bits;
274 self
275 }
276 #[doc = "Bit 0 - Write '1' to Disable interrupt for ENDECB event"]
277 #[inline]
278 pub fn endecb(&mut self) -> _ENDECBW {
279 _ENDECBW { w: self }
280 }
281 #[doc = "Bit 1 - Write '1' to Disable interrupt for ERRORECB event"]
282 #[inline]
283 pub fn errorecb(&mut self) -> _ERRORECBW {
284 _ERRORECBW { w: self }
285 }
286}