1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
#[doc = "Reader of register OPA3_MUX"] pub type R = crate::R<u32, super::OPA3_MUX>; #[doc = "Writer for register OPA3_MUX"] pub type W = crate::W<u32, super::OPA3_MUX>; #[doc = "Register OPA3_MUX `reset()`'s with value 0x0016_f2f1"] impl crate::ResetValue for super::OPA3_MUX { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0x0016_f2f1 } } #[doc = "Reader of field `POSSEL`"] pub type POSSEL_R = crate::R<u8, u8>; #[doc = "Write proxy for field `POSSEL`"] pub struct POSSEL_W<'a> { w: &'a mut W, } impl<'a> POSSEL_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !0xff) | ((value as u32) & 0xff); self.w } } #[doc = "Reader of field `NEGSEL`"] pub type NEGSEL_R = crate::R<u8, u8>; #[doc = "Write proxy for field `NEGSEL`"] pub struct NEGSEL_W<'a> { w: &'a mut W, } impl<'a> NEGSEL_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0xff << 8)) | (((value as u32) & 0xff) << 8); self.w } } #[doc = "OPAx Resistor Ladder Input Mux\n\nValue on reset: 6"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum RESINMUX_A { #[doc = "0: Set for Unity Gain"] DISABLE = 0, #[doc = "1: Set for NEXTOUT(x-1) input"] OPANEXT = 1, #[doc = "2: NEG pad connected"] NEGPAD = 2, #[doc = "3: POS pad connected"] POSPAD = 3, #[doc = "4: Neg pad of OPA0 connected. Direct input to support common reference."] COMPAD = 4, #[doc = "5: OPA0 and OPA1 Resmux connected to form fully differential instrumentation amplifier."] CENTER = 5, #[doc = "6: VSS connected"] VSS = 6, } impl From<RESINMUX_A> for u8 { #[inline(always)] fn from(variant: RESINMUX_A) -> Self { variant as _ } } #[doc = "Reader of field `RESINMUX`"] pub type RESINMUX_R = crate::R<u8, RESINMUX_A>; impl RESINMUX_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, RESINMUX_A> { use crate::Variant::*; match self.bits { 0 => Val(RESINMUX_A::DISABLE), 1 => Val(RESINMUX_A::OPANEXT), 2 => Val(RESINMUX_A::NEGPAD), 3 => Val(RESINMUX_A::POSPAD), 4 => Val(RESINMUX_A::COMPAD), 5 => Val(RESINMUX_A::CENTER), 6 => Val(RESINMUX_A::VSS), i => Res(i), } } #[doc = "Checks if the value of the field is `DISABLE`"] #[inline(always)] pub fn is_disable(&self) -> bool { *self == RESINMUX_A::DISABLE } #[doc = "Checks if the value of the field is `OPANEXT`"] #[inline(always)] pub fn is_opanext(&self) -> bool { *self == RESINMUX_A::OPANEXT } #[doc = "Checks if the value of the field is `NEGPAD`"] #[inline(always)] pub fn is_negpad(&self) -> bool { *self == RESINMUX_A::NEGPAD } #[doc = "Checks if the value of the field is `POSPAD`"] #[inline(always)] pub fn is_pospad(&self) -> bool { *self == RESINMUX_A::POSPAD } #[doc = "Checks if the value of the field is `COMPAD`"] #[inline(always)] pub fn is_compad(&self) -> bool { *self == RESINMUX_A::COMPAD } #[doc = "Checks if the value of the field is `CENTER`"] #[inline(always)] pub fn is_center(&self) -> bool { *self == RESINMUX_A::CENTER } #[doc = "Checks if the value of the field is `VSS`"] #[inline(always)] pub fn is_vss(&self) -> bool { *self == RESINMUX_A::VSS } } #[doc = "Write proxy for field `RESINMUX`"] pub struct RESINMUX_W<'a> { w: &'a mut W, } impl<'a> RESINMUX_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: RESINMUX_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "Set for Unity Gain"] #[inline(always)] pub fn disable(self) -> &'a mut W { self.variant(RESINMUX_A::DISABLE) } #[doc = "Set for NEXTOUT(x-1) input"] #[inline(always)] pub fn opanext(self) -> &'a mut W { self.variant(RESINMUX_A::OPANEXT) } #[doc = "NEG pad connected"] #[inline(always)] pub fn negpad(self) -> &'a mut W { self.variant(RESINMUX_A::NEGPAD) } #[doc = "POS pad connected"] #[inline(always)] pub fn pospad(self) -> &'a mut W { self.variant(RESINMUX_A::POSPAD) } #[doc = "Neg pad of OPA0 connected. Direct input to support common reference."] #[inline(always)] pub fn compad(self) -> &'a mut W { self.variant(RESINMUX_A::COMPAD) } #[doc = "OPA0 and OPA1 Resmux connected to form fully differential instrumentation amplifier."] #[inline(always)] pub fn center(self) -> &'a mut W { self.variant(RESINMUX_A::CENTER) } #[doc = "VSS connected"] #[inline(always)] pub fn vss(self) -> &'a mut W { self.variant(RESINMUX_A::VSS) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x07 << 16)) | (((value as u32) & 0x07) << 16); self.w } } #[doc = "Reader of field `GAIN3X`"] pub type GAIN3X_R = crate::R<bool, bool>; #[doc = "Write proxy for field `GAIN3X`"] pub struct GAIN3X_W<'a> { w: &'a mut W, } impl<'a> GAIN3X_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 20)) | (((value as u32) & 0x01) << 20); self.w } } #[doc = "OPAx Resistor Ladder Select\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum RESSEL_A { #[doc = "0: Gain of 1/3"] RES0 = 0, #[doc = "1: Gain of 1"] RES1 = 1, #[doc = "2: Gain of 1 2/3"] RES2 = 2, #[doc = "3: Gain of 2 1/5"] RES3 = 3, #[doc = "4: Gain of 3"] RES4 = 4, #[doc = "5: Gain of 4 1/3"] RES5 = 5, #[doc = "6: Gain of 7"] RES6 = 6, #[doc = "7: Gain of 15"] RES7 = 7, } impl From<RESSEL_A> for u8 { #[inline(always)] fn from(variant: RESSEL_A) -> Self { variant as _ } } #[doc = "Reader of field `RESSEL`"] pub type RESSEL_R = crate::R<u8, RESSEL_A>; impl RESSEL_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> RESSEL_A { match self.bits { 0 => RESSEL_A::RES0, 1 => RESSEL_A::RES1, 2 => RESSEL_A::RES2, 3 => RESSEL_A::RES3, 4 => RESSEL_A::RES4, 5 => RESSEL_A::RES5, 6 => RESSEL_A::RES6, 7 => RESSEL_A::RES7, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `RES0`"] #[inline(always)] pub fn is_res0(&self) -> bool { *self == RESSEL_A::RES0 } #[doc = "Checks if the value of the field is `RES1`"] #[inline(always)] pub fn is_res1(&self) -> bool { *self == RESSEL_A::RES1 } #[doc = "Checks if the value of the field is `RES2`"] #[inline(always)] pub fn is_res2(&self) -> bool { *self == RESSEL_A::RES2 } #[doc = "Checks if the value of the field is `RES3`"] #[inline(always)] pub fn is_res3(&self) -> bool { *self == RESSEL_A::RES3 } #[doc = "Checks if the value of the field is `RES4`"] #[inline(always)] pub fn is_res4(&self) -> bool { *self == RESSEL_A::RES4 } #[doc = "Checks if the value of the field is `RES5`"] #[inline(always)] pub fn is_res5(&self) -> bool { *self == RESSEL_A::RES5 } #[doc = "Checks if the value of the field is `RES6`"] #[inline(always)] pub fn is_res6(&self) -> bool { *self == RESSEL_A::RES6 } #[doc = "Checks if the value of the field is `RES7`"] #[inline(always)] pub fn is_res7(&self) -> bool { *self == RESSEL_A::RES7 } } #[doc = "Write proxy for field `RESSEL`"] pub struct RESSEL_W<'a> { w: &'a mut W, } impl<'a> RESSEL_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: RESSEL_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "Gain of 1/3"] #[inline(always)] pub fn res0(self) -> &'a mut W { self.variant(RESSEL_A::RES0) } #[doc = "Gain of 1"] #[inline(always)] pub fn res1(self) -> &'a mut W { self.variant(RESSEL_A::RES1) } #[doc = "Gain of 1 2/3"] #[inline(always)] pub fn res2(self) -> &'a mut W { self.variant(RESSEL_A::RES2) } #[doc = "Gain of 2 1/5"] #[inline(always)] pub fn res3(self) -> &'a mut W { self.variant(RESSEL_A::RES3) } #[doc = "Gain of 3"] #[inline(always)] pub fn res4(self) -> &'a mut W { self.variant(RESSEL_A::RES4) } #[doc = "Gain of 4 1/3"] #[inline(always)] pub fn res5(self) -> &'a mut W { self.variant(RESSEL_A::RES5) } #[doc = "Gain of 7"] #[inline(always)] pub fn res6(self) -> &'a mut W { self.variant(RESSEL_A::RES6) } #[doc = "Gain of 15"] #[inline(always)] pub fn res7(self) -> &'a mut W { self.variant(RESSEL_A::RES7) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x07 << 24)) | (((value as u32) & 0x07) << 24); self.w } } impl R { #[doc = "Bits 0:7 - OPAx Non-inverting Input Mux"] #[inline(always)] pub fn possel(&self) -> POSSEL_R { POSSEL_R::new((self.bits & 0xff) as u8) } #[doc = "Bits 8:15 - OPAx Inverting Input Mux"] #[inline(always)] pub fn negsel(&self) -> NEGSEL_R { NEGSEL_R::new(((self.bits >> 8) & 0xff) as u8) } #[doc = "Bits 16:18 - OPAx Resistor Ladder Input Mux"] #[inline(always)] pub fn resinmux(&self) -> RESINMUX_R { RESINMUX_R::new(((self.bits >> 16) & 0x07) as u8) } #[doc = "Bit 20 - OPAx Dedicated 3x Gain Resistor Ladder"] #[inline(always)] pub fn gain3x(&self) -> GAIN3X_R { GAIN3X_R::new(((self.bits >> 20) & 0x01) != 0) } #[doc = "Bits 24:26 - OPAx Resistor Ladder Select"] #[inline(always)] pub fn ressel(&self) -> RESSEL_R { RESSEL_R::new(((self.bits >> 24) & 0x07) as u8) } } impl W { #[doc = "Bits 0:7 - OPAx Non-inverting Input Mux"] #[inline(always)] pub fn possel(&mut self) -> POSSEL_W { POSSEL_W { w: self } } #[doc = "Bits 8:15 - OPAx Inverting Input Mux"] #[inline(always)] pub fn negsel(&mut self) -> NEGSEL_W { NEGSEL_W { w: self } } #[doc = "Bits 16:18 - OPAx Resistor Ladder Input Mux"] #[inline(always)] pub fn resinmux(&mut self) -> RESINMUX_W { RESINMUX_W { w: self } } #[doc = "Bit 20 - OPAx Dedicated 3x Gain Resistor Ladder"] #[inline(always)] pub fn gain3x(&mut self) -> GAIN3X_W { GAIN3X_W { w: self } } #[doc = "Bits 24:26 - OPAx Resistor Ladder Select"] #[inline(always)] pub fn ressel(&mut self) -> RESSEL_W { RESSEL_W { w: self } } }