1#[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::SR {
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 `UIF`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum UIFR {
48 #[doc = "No update occurred"]
49 CLEAR,
50 #[doc = "Update interrupt pending."]
51 UPDATEPENDING,
52}
53impl UIFR {
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 UIFR::CLEAR => false,
69 UIFR::UPDATEPENDING => true,
70 }
71 }
72 #[allow(missing_docs)]
73 #[doc(hidden)]
74 #[inline]
75 pub fn _from(value: bool) -> UIFR {
76 match value {
77 false => UIFR::CLEAR,
78 true => UIFR::UPDATEPENDING,
79 }
80 }
81 #[doc = "Checks if the value of the field is `CLEAR`"]
82 #[inline]
83 pub fn is_clear(&self) -> bool {
84 *self == UIFR::CLEAR
85 }
86 #[doc = "Checks if the value of the field is `UPDATEPENDING`"]
87 #[inline]
88 pub fn is_update_pending(&self) -> bool {
89 *self == UIFR::UPDATEPENDING
90 }
91}
92#[doc = "Values that can be written to the field `UIF`"]
93pub enum UIFW {
94 #[doc = "No update occurred"]
95 CLEAR,
96 #[doc = "Update interrupt pending."]
97 UPDATEPENDING,
98}
99impl UIFW {
100 #[allow(missing_docs)]
101 #[doc(hidden)]
102 #[inline]
103 pub fn _bits(&self) -> bool {
104 match *self {
105 UIFW::CLEAR => false,
106 UIFW::UPDATEPENDING => true,
107 }
108 }
109}
110#[doc = r" Proxy"]
111pub struct _UIFW<'a> {
112 w: &'a mut W,
113}
114impl<'a> _UIFW<'a> {
115 #[doc = r" Writes `variant` to the field"]
116 #[inline]
117 pub fn variant(self, variant: UIFW) -> &'a mut W {
118 {
119 self.bit(variant._bits())
120 }
121 }
122 #[doc = "No update occurred"]
123 #[inline]
124 pub fn clear(self) -> &'a mut W {
125 self.variant(UIFW::CLEAR)
126 }
127 #[doc = "Update interrupt pending."]
128 #[inline]
129 pub fn update_pending(self) -> &'a mut W {
130 self.variant(UIFW::UPDATEPENDING)
131 }
132 #[doc = r" Sets the field bit"]
133 pub fn set_bit(self) -> &'a mut W {
134 self.bit(true)
135 }
136 #[doc = r" Clears the field bit"]
137 pub fn clear_bit(self) -> &'a mut W {
138 self.bit(false)
139 }
140 #[doc = r" Writes raw bits to the field"]
141 #[inline]
142 pub fn bit(self, value: bool) -> &'a mut W {
143 const MASK: bool = true;
144 const OFFSET: u8 = 0;
145 self.w.bits &= !((MASK as u32) << OFFSET);
146 self.w.bits |= ((value & MASK) as u32) << OFFSET;
147 self.w
148 }
149}
150impl R {
151 #[doc = r" Value of the register as raw bits"]
152 #[inline]
153 pub fn bits(&self) -> u32 {
154 self.bits
155 }
156 #[doc = "Bit 0 - Update interrupt flag"]
157 #[inline]
158 pub fn uif(&self) -> UIFR {
159 UIFR::_from({
160 const MASK: bool = true;
161 const OFFSET: u8 = 0;
162 ((self.bits >> OFFSET) & MASK as u32) != 0
163 })
164 }
165}
166impl W {
167 #[doc = r" Reset value of the register"]
168 #[inline]
169 pub fn reset_value() -> W {
170 W { bits: 0 }
171 }
172 #[doc = r" Writes raw bits to the register"]
173 #[inline]
174 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
175 self.bits = bits;
176 self
177 }
178 #[doc = "Bit 0 - Update interrupt flag"]
179 #[inline]
180 pub fn uif(&mut self) -> _UIFW {
181 _UIFW { w: self }
182 }
183}