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 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482
#[doc = "Reader of register DCCTL2"] pub type R = crate::R<u32, super::DCCTL2>; #[doc = "Writer for register DCCTL2"] pub type W = crate::W<u32, super::DCCTL2>; #[doc = "Register DCCTL2 `reset()`'s with value 0"] impl crate::ResetValue for super::DCCTL2 { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Comparison Interrupt Mode\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum CIM_A { #[doc = "0: Always"] ALWAYS, #[doc = "1: Once"] ONCE, #[doc = "2: Hysteresis Always"] HALWAYS, #[doc = "3: Hysteresis Once"] HONCE, } impl From<CIM_A> for u8 { #[inline(always)] fn from(variant: CIM_A) -> Self { match variant { CIM_A::ALWAYS => 0, CIM_A::ONCE => 1, CIM_A::HALWAYS => 2, CIM_A::HONCE => 3, } } } #[doc = "Reader of field `CIM`"] pub type CIM_R = crate::R<u8, CIM_A>; impl CIM_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> CIM_A { match self.bits { 0 => CIM_A::ALWAYS, 1 => CIM_A::ONCE, 2 => CIM_A::HALWAYS, 3 => CIM_A::HONCE, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `ALWAYS`"] #[inline(always)] pub fn is_always(&self) -> bool { *self == CIM_A::ALWAYS } #[doc = "Checks if the value of the field is `ONCE`"] #[inline(always)] pub fn is_once(&self) -> bool { *self == CIM_A::ONCE } #[doc = "Checks if the value of the field is `HALWAYS`"] #[inline(always)] pub fn is_halways(&self) -> bool { *self == CIM_A::HALWAYS } #[doc = "Checks if the value of the field is `HONCE`"] #[inline(always)] pub fn is_honce(&self) -> bool { *self == CIM_A::HONCE } } #[doc = "Write proxy for field `CIM`"] pub struct CIM_W<'a> { w: &'a mut W, } impl<'a> CIM_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: CIM_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "Always"] #[inline(always)] pub fn always(self) -> &'a mut W { self.variant(CIM_A::ALWAYS) } #[doc = "Once"] #[inline(always)] pub fn once(self) -> &'a mut W { self.variant(CIM_A::ONCE) } #[doc = "Hysteresis Always"] #[inline(always)] pub fn halways(self) -> &'a mut W { self.variant(CIM_A::HALWAYS) } #[doc = "Hysteresis Once"] #[inline(always)] pub fn honce(self) -> &'a mut W { self.variant(CIM_A::HONCE) } #[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 & !0x03) | ((value as u32) & 0x03); self.w } } #[doc = "Comparison Interrupt Condition\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum CIC_A { #[doc = "0: Low Band"] LOW, #[doc = "1: Mid Band"] MID, #[doc = "3: High Band"] HIGH, } impl From<CIC_A> for u8 { #[inline(always)] fn from(variant: CIC_A) -> Self { match variant { CIC_A::LOW => 0, CIC_A::MID => 1, CIC_A::HIGH => 3, } } } #[doc = "Reader of field `CIC`"] pub type CIC_R = crate::R<u8, CIC_A>; impl CIC_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, CIC_A> { use crate::Variant::*; match self.bits { 0 => Val(CIC_A::LOW), 1 => Val(CIC_A::MID), 3 => Val(CIC_A::HIGH), i => Res(i), } } #[doc = "Checks if the value of the field is `LOW`"] #[inline(always)] pub fn is_low(&self) -> bool { *self == CIC_A::LOW } #[doc = "Checks if the value of the field is `MID`"] #[inline(always)] pub fn is_mid(&self) -> bool { *self == CIC_A::MID } #[doc = "Checks if the value of the field is `HIGH`"] #[inline(always)] pub fn is_high(&self) -> bool { *self == CIC_A::HIGH } } #[doc = "Write proxy for field `CIC`"] pub struct CIC_W<'a> { w: &'a mut W, } impl<'a> CIC_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: CIC_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "Low Band"] #[inline(always)] pub fn low(self) -> &'a mut W { self.variant(CIC_A::LOW) } #[doc = "Mid Band"] #[inline(always)] pub fn mid(self) -> &'a mut W { self.variant(CIC_A::MID) } #[doc = "High Band"] #[inline(always)] pub fn high(self) -> &'a mut W { self.variant(CIC_A::HIGH) } #[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 & !(0x03 << 2)) | (((value as u32) & 0x03) << 2); self.w } } #[doc = "Reader of field `CIE`"] pub type CIE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CIE`"] pub struct CIE_W<'a> { w: &'a mut W, } impl<'a> CIE_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 << 4)) | (((value as u32) & 0x01) << 4); self.w } } #[doc = "Comparison Trigger Mode\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum CTM_A { #[doc = "0: Always"] ALWAYS, #[doc = "1: Once"] ONCE, #[doc = "2: Hysteresis Always"] HALWAYS, #[doc = "3: Hysteresis Once"] HONCE, } impl From<CTM_A> for u8 { #[inline(always)] fn from(variant: CTM_A) -> Self { match variant { CTM_A::ALWAYS => 0, CTM_A::ONCE => 1, CTM_A::HALWAYS => 2, CTM_A::HONCE => 3, } } } #[doc = "Reader of field `CTM`"] pub type CTM_R = crate::R<u8, CTM_A>; impl CTM_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> CTM_A { match self.bits { 0 => CTM_A::ALWAYS, 1 => CTM_A::ONCE, 2 => CTM_A::HALWAYS, 3 => CTM_A::HONCE, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `ALWAYS`"] #[inline(always)] pub fn is_always(&self) -> bool { *self == CTM_A::ALWAYS } #[doc = "Checks if the value of the field is `ONCE`"] #[inline(always)] pub fn is_once(&self) -> bool { *self == CTM_A::ONCE } #[doc = "Checks if the value of the field is `HALWAYS`"] #[inline(always)] pub fn is_halways(&self) -> bool { *self == CTM_A::HALWAYS } #[doc = "Checks if the value of the field is `HONCE`"] #[inline(always)] pub fn is_honce(&self) -> bool { *self == CTM_A::HONCE } } #[doc = "Write proxy for field `CTM`"] pub struct CTM_W<'a> { w: &'a mut W, } impl<'a> CTM_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: CTM_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "Always"] #[inline(always)] pub fn always(self) -> &'a mut W { self.variant(CTM_A::ALWAYS) } #[doc = "Once"] #[inline(always)] pub fn once(self) -> &'a mut W { self.variant(CTM_A::ONCE) } #[doc = "Hysteresis Always"] #[inline(always)] pub fn halways(self) -> &'a mut W { self.variant(CTM_A::HALWAYS) } #[doc = "Hysteresis Once"] #[inline(always)] pub fn honce(self) -> &'a mut W { self.variant(CTM_A::HONCE) } #[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 & !(0x03 << 8)) | (((value as u32) & 0x03) << 8); self.w } } #[doc = "Comparison Trigger Condition\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum CTC_A { #[doc = "0: Low Band"] LOW, #[doc = "1: Mid Band"] MID, #[doc = "3: High Band"] HIGH, } impl From<CTC_A> for u8 { #[inline(always)] fn from(variant: CTC_A) -> Self { match variant { CTC_A::LOW => 0, CTC_A::MID => 1, CTC_A::HIGH => 3, } } } #[doc = "Reader of field `CTC`"] pub type CTC_R = crate::R<u8, CTC_A>; impl CTC_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, CTC_A> { use crate::Variant::*; match self.bits { 0 => Val(CTC_A::LOW), 1 => Val(CTC_A::MID), 3 => Val(CTC_A::HIGH), i => Res(i), } } #[doc = "Checks if the value of the field is `LOW`"] #[inline(always)] pub fn is_low(&self) -> bool { *self == CTC_A::LOW } #[doc = "Checks if the value of the field is `MID`"] #[inline(always)] pub fn is_mid(&self) -> bool { *self == CTC_A::MID } #[doc = "Checks if the value of the field is `HIGH`"] #[inline(always)] pub fn is_high(&self) -> bool { *self == CTC_A::HIGH } } #[doc = "Write proxy for field `CTC`"] pub struct CTC_W<'a> { w: &'a mut W, } impl<'a> CTC_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: CTC_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "Low Band"] #[inline(always)] pub fn low(self) -> &'a mut W { self.variant(CTC_A::LOW) } #[doc = "Mid Band"] #[inline(always)] pub fn mid(self) -> &'a mut W { self.variant(CTC_A::MID) } #[doc = "High Band"] #[inline(always)] pub fn high(self) -> &'a mut W { self.variant(CTC_A::HIGH) } #[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 & !(0x03 << 10)) | (((value as u32) & 0x03) << 10); self.w } } #[doc = "Reader of field `CTE`"] pub type CTE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CTE`"] pub struct CTE_W<'a> { w: &'a mut W, } impl<'a> CTE_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 << 12)) | (((value as u32) & 0x01) << 12); self.w } } impl R { #[doc = "Bits 0:1 - Comparison Interrupt Mode"] #[inline(always)] pub fn cim(&self) -> CIM_R { CIM_R::new((self.bits & 0x03) as u8) } #[doc = "Bits 2:3 - Comparison Interrupt Condition"] #[inline(always)] pub fn cic(&self) -> CIC_R { CIC_R::new(((self.bits >> 2) & 0x03) as u8) } #[doc = "Bit 4 - Comparison Interrupt Enable"] #[inline(always)] pub fn cie(&self) -> CIE_R { CIE_R::new(((self.bits >> 4) & 0x01) != 0) } #[doc = "Bits 8:9 - Comparison Trigger Mode"] #[inline(always)] pub fn ctm(&self) -> CTM_R { CTM_R::new(((self.bits >> 8) & 0x03) as u8) } #[doc = "Bits 10:11 - Comparison Trigger Condition"] #[inline(always)] pub fn ctc(&self) -> CTC_R { CTC_R::new(((self.bits >> 10) & 0x03) as u8) } #[doc = "Bit 12 - Comparison Trigger Enable"] #[inline(always)] pub fn cte(&self) -> CTE_R { CTE_R::new(((self.bits >> 12) & 0x01) != 0) } } impl W { #[doc = "Bits 0:1 - Comparison Interrupt Mode"] #[inline(always)] pub fn cim(&mut self) -> CIM_W { CIM_W { w: self } } #[doc = "Bits 2:3 - Comparison Interrupt Condition"] #[inline(always)] pub fn cic(&mut self) -> CIC_W { CIC_W { w: self } } #[doc = "Bit 4 - Comparison Interrupt Enable"] #[inline(always)] pub fn cie(&mut self) -> CIE_W { CIE_W { w: self } } #[doc = "Bits 8:9 - Comparison Trigger Mode"] #[inline(always)] pub fn ctm(&mut self) -> CTM_W { CTM_W { w: self } } #[doc = "Bits 10:11 - Comparison Trigger Condition"] #[inline(always)] pub fn ctc(&mut self) -> CTC_W { CTC_W { w: self } } #[doc = "Bit 12 - Comparison Trigger Enable"] #[inline(always)] pub fn cte(&mut self) -> CTE_W { CTE_W { w: self } } }