1#[doc = "Register `ADRD` reader"]
2pub struct R(crate::R<ADRD_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<ADRD_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<ADRD_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<ADRD_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Field `AD` reader - Converted Value 11 to 0"]
17pub type AD_R = crate::FieldReader<u16, u16>;
18#[doc = "Field `DIAGST` reader - Self-Diagnosis Status"]
19pub type DIAGST_R = crate::FieldReader<u8, DIAGST_A>;
20#[doc = "Self-Diagnosis Status\n\nValue on reset: 0"]
21#[derive(Clone, Copy, Debug, PartialEq, Eq)]
22#[repr(u8)]
23pub enum DIAGST_A {
24 #[doc = "0: Self-diagnosis not executed after power-on."]
25 _00 = 0,
26 #[doc = "1: Self-diagnosis was executed using the 0 V voltage."]
27 _01 = 1,
28 #[doc = "2: Self-diagnosis was executed using the reference voltage Ã\u{97} 1/2."]
29 _10 = 2,
30 #[doc = "3: Self-diagnosis was executed using the reference voltage ."]
31 _11 = 3,
32}
33impl From<DIAGST_A> for u8 {
34 #[inline(always)]
35 fn from(variant: DIAGST_A) -> Self {
36 variant as _
37 }
38}
39impl DIAGST_R {
40 #[doc = "Get enumerated values variant"]
41 #[inline(always)]
42 pub fn variant(&self) -> DIAGST_A {
43 match self.bits {
44 0 => DIAGST_A::_00,
45 1 => DIAGST_A::_01,
46 2 => DIAGST_A::_10,
47 3 => DIAGST_A::_11,
48 _ => unreachable!(),
49 }
50 }
51 #[doc = "Checks if the value of the field is `_00`"]
52 #[inline(always)]
53 pub fn is_00(&self) -> bool {
54 *self == DIAGST_A::_00
55 }
56 #[doc = "Checks if the value of the field is `_01`"]
57 #[inline(always)]
58 pub fn is_01(&self) -> bool {
59 *self == DIAGST_A::_01
60 }
61 #[doc = "Checks if the value of the field is `_10`"]
62 #[inline(always)]
63 pub fn is_10(&self) -> bool {
64 *self == DIAGST_A::_10
65 }
66 #[doc = "Checks if the value of the field is `_11`"]
67 #[inline(always)]
68 pub fn is_11(&self) -> bool {
69 *self == DIAGST_A::_11
70 }
71}
72impl R {
73 #[doc = "Bits 0:11 - Converted Value 11 to 0"]
74 #[inline(always)]
75 pub fn ad(&self) -> AD_R {
76 AD_R::new(self.bits & 0x0fff)
77 }
78 #[doc = "Bits 14:15 - Self-Diagnosis Status"]
79 #[inline(always)]
80 pub fn diagst(&self) -> DIAGST_R {
81 DIAGST_R::new(((self.bits >> 14) & 3) as u8)
82 }
83}
84#[doc = "A/D Self-Diagnosis Data Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [adrd](index.html) module"]
85pub struct ADRD_SPEC;
86impl crate::RegisterSpec for ADRD_SPEC {
87 type Ux = u16;
88}
89#[doc = "`read()` method returns [adrd::R](R) reader structure"]
90impl crate::Readable for ADRD_SPEC {
91 type Reader = R;
92}
93#[doc = "`reset()` method sets ADRD to value 0"]
94impl crate::Resettable for ADRD_SPEC {
95 const RESET_VALUE: Self::Ux = 0;
96}