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::ENABLE {
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 `ENABLE`"]
46#[derive(Clone, Copy, Debug, PartialEq)]
47pub enum ENABLER {
48 #[doc = "Disable"]
49 DISABLED,
50 #[doc = "Enable"]
51 ENABLED,
52 #[doc = r" Reserved"]
53 _Reserved(u8),
54}
55impl ENABLER {
56 #[doc = r" Value of the field as raw bits"]
57 #[inline]
58 pub fn bits(&self) -> u8 {
59 match *self {
60 ENABLER::DISABLED => 0,
61 ENABLER::ENABLED => 2,
62 ENABLER::_Reserved(bits) => bits,
63 }
64 }
65 #[allow(missing_docs)]
66 #[doc(hidden)]
67 #[inline]
68 pub fn _from(value: u8) -> ENABLER {
69 match value {
70 0 => ENABLER::DISABLED,
71 2 => ENABLER::ENABLED,
72 i => ENABLER::_Reserved(i),
73 }
74 }
75 #[doc = "Checks if the value of the field is `DISABLED`"]
76 #[inline]
77 pub fn is_disabled(&self) -> bool {
78 *self == ENABLER::DISABLED
79 }
80 #[doc = "Checks if the value of the field is `ENABLED`"]
81 #[inline]
82 pub fn is_enabled(&self) -> bool {
83 *self == ENABLER::ENABLED
84 }
85}
86#[doc = "Values that can be written to the field `ENABLE`"]
87pub enum ENABLEW {
88 #[doc = "Disable"]
89 DISABLED,
90 #[doc = "Enable"]
91 ENABLED,
92}
93impl ENABLEW {
94 #[allow(missing_docs)]
95 #[doc(hidden)]
96 #[inline]
97 pub fn _bits(&self) -> u8 {
98 match *self {
99 ENABLEW::DISABLED => 0,
100 ENABLEW::ENABLED => 2,
101 }
102 }
103}
104#[doc = r" Proxy"]
105pub struct _ENABLEW<'a> {
106 w: &'a mut W,
107}
108impl<'a> _ENABLEW<'a> {
109 #[doc = r" Writes `variant` to the field"]
110 #[inline]
111 pub fn variant(self, variant: ENABLEW) -> &'a mut W {
112 unsafe { self.bits(variant._bits()) }
113 }
114 #[doc = "Disable"]
115 #[inline]
116 pub fn disabled(self) -> &'a mut W {
117 self.variant(ENABLEW::DISABLED)
118 }
119 #[doc = "Enable"]
120 #[inline]
121 pub fn enabled(self) -> &'a mut W {
122 self.variant(ENABLEW::ENABLED)
123 }
124 #[doc = r" Writes raw bits to the field"]
125 #[inline]
126 pub unsafe fn bits(self, value: u8) -> &'a mut W {
127 const MASK: u8 = 3;
128 const OFFSET: u8 = 0;
129 self.w.bits &= !((MASK as u32) << OFFSET);
130 self.w.bits |= ((value & MASK) as u32) << OFFSET;
131 self.w
132 }
133}
134impl R {
135 #[doc = r" Value of the register as raw bits"]
136 #[inline]
137 pub fn bits(&self) -> u32 {
138 self.bits
139 }
140 #[doc = "Bits 0:1 - Enable or disable COMP"]
141 #[inline]
142 pub fn enable(&self) -> ENABLER {
143 ENABLER::_from({
144 const MASK: u8 = 3;
145 const OFFSET: u8 = 0;
146 ((self.bits >> OFFSET) & MASK as u32) as u8
147 })
148 }
149}
150impl W {
151 #[doc = r" Reset value of the register"]
152 #[inline]
153 pub fn reset_value() -> W {
154 W { bits: 0 }
155 }
156 #[doc = r" Writes raw bits to the register"]
157 #[inline]
158 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
159 self.bits = bits;
160 self
161 }
162 #[doc = "Bits 0:1 - Enable or disable COMP"]
163 #[inline]
164 pub fn enable(&mut self) -> _ENABLEW {
165 _ENABLEW { w: self }
166 }
167}