1#[doc = "Register `ADDISCR` reader"]
2pub struct R(crate::R<ADDISCR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<ADDISCR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<ADDISCR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<ADDISCR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `ADDISCR` writer"]
17pub struct W(crate::W<ADDISCR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<ADDISCR_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<ADDISCR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<ADDISCR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `ADNDIS` reader - Disconnection Detection Assist Setting"]
38pub type ADNDIS_R = crate::FieldReader<u8, ADNDIS_A>;
39#[doc = "Disconnection Detection Assist Setting\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum ADNDIS_A {
43 #[doc = "0: The disconnection detection assist function is disabled"]
44 _0X0 = 0,
45 #[doc = "1: Setting prohibited"]
46 _0X1 = 1,
47}
48impl From<ADNDIS_A> for u8 {
49 #[inline(always)]
50 fn from(variant: ADNDIS_A) -> Self {
51 variant as _
52 }
53}
54impl ADNDIS_R {
55 #[doc = "Get enumerated values variant"]
56 #[inline(always)]
57 pub fn variant(&self) -> Option<ADNDIS_A> {
58 match self.bits {
59 0 => Some(ADNDIS_A::_0X0),
60 1 => Some(ADNDIS_A::_0X1),
61 _ => None,
62 }
63 }
64 #[doc = "Checks if the value of the field is `_0X0`"]
65 #[inline(always)]
66 pub fn is_0x0(&self) -> bool {
67 *self == ADNDIS_A::_0X0
68 }
69 #[doc = "Checks if the value of the field is `_0X1`"]
70 #[inline(always)]
71 pub fn is_0x1(&self) -> bool {
72 *self == ADNDIS_A::_0X1
73 }
74}
75#[doc = "Field `ADNDIS` writer - Disconnection Detection Assist Setting"]
76pub type ADNDIS_W<'a, const O: u8> = crate::FieldWriter<'a, u8, ADDISCR_SPEC, u8, ADNDIS_A, 4, O>;
77impl<'a, const O: u8> ADNDIS_W<'a, O> {
78 #[doc = "The disconnection detection assist function is disabled"]
79 #[inline(always)]
80 pub fn _0x0(self) -> &'a mut W {
81 self.variant(ADNDIS_A::_0X0)
82 }
83 #[doc = "Setting prohibited"]
84 #[inline(always)]
85 pub fn _0x1(self) -> &'a mut W {
86 self.variant(ADNDIS_A::_0X1)
87 }
88}
89#[doc = "Field `PCHG` reader - Precharge/discharge select"]
90pub type PCHG_R = crate::BitReader<PCHG_A>;
91#[doc = "Precharge/discharge select\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq, Eq)]
93pub enum PCHG_A {
94 #[doc = "0: Discharge"]
95 _0 = 0,
96 #[doc = "1: Precharge"]
97 _1 = 1,
98}
99impl From<PCHG_A> for bool {
100 #[inline(always)]
101 fn from(variant: PCHG_A) -> Self {
102 variant as u8 != 0
103 }
104}
105impl PCHG_R {
106 #[doc = "Get enumerated values variant"]
107 #[inline(always)]
108 pub fn variant(&self) -> PCHG_A {
109 match self.bits {
110 false => PCHG_A::_0,
111 true => PCHG_A::_1,
112 }
113 }
114 #[doc = "Checks if the value of the field is `_0`"]
115 #[inline(always)]
116 pub fn is_0(&self) -> bool {
117 *self == PCHG_A::_0
118 }
119 #[doc = "Checks if the value of the field is `_1`"]
120 #[inline(always)]
121 pub fn is_1(&self) -> bool {
122 *self == PCHG_A::_1
123 }
124}
125#[doc = "Field `PCHG` writer - Precharge/discharge select"]
126pub type PCHG_W<'a, const O: u8> = crate::BitWriter<'a, u8, ADDISCR_SPEC, PCHG_A, O>;
127impl<'a, const O: u8> PCHG_W<'a, O> {
128 #[doc = "Discharge"]
129 #[inline(always)]
130 pub fn _0(self) -> &'a mut W {
131 self.variant(PCHG_A::_0)
132 }
133 #[doc = "Precharge"]
134 #[inline(always)]
135 pub fn _1(self) -> &'a mut W {
136 self.variant(PCHG_A::_1)
137 }
138}
139impl R {
140 #[doc = "Bits 0:3 - Disconnection Detection Assist Setting"]
141 #[inline(always)]
142 pub fn adndis(&self) -> ADNDIS_R {
143 ADNDIS_R::new(self.bits & 0x0f)
144 }
145 #[doc = "Bit 4 - Precharge/discharge select"]
146 #[inline(always)]
147 pub fn pchg(&self) -> PCHG_R {
148 PCHG_R::new(((self.bits >> 4) & 1) != 0)
149 }
150}
151impl W {
152 #[doc = "Bits 0:3 - Disconnection Detection Assist Setting"]
153 #[inline(always)]
154 #[must_use]
155 pub fn adndis(&mut self) -> ADNDIS_W<0> {
156 ADNDIS_W::new(self)
157 }
158 #[doc = "Bit 4 - Precharge/discharge select"]
159 #[inline(always)]
160 #[must_use]
161 pub fn pchg(&mut self) -> PCHG_W<4> {
162 PCHG_W::new(self)
163 }
164 #[doc = "Writes raw bits to the register."]
165 #[inline(always)]
166 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
167 self.0.bits(bits);
168 self
169 }
170}
171#[doc = "A/D Disconnection Detection Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [addiscr](index.html) module"]
172pub struct ADDISCR_SPEC;
173impl crate::RegisterSpec for ADDISCR_SPEC {
174 type Ux = u8;
175}
176#[doc = "`read()` method returns [addiscr::R](R) reader structure"]
177impl crate::Readable for ADDISCR_SPEC {
178 type Reader = R;
179}
180#[doc = "`write(|w| ..)` method takes [addiscr::W](W) writer structure"]
181impl crate::Writable for ADDISCR_SPEC {
182 type Writer = W;
183 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
184 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
185}
186#[doc = "`reset()` method sets ADDISCR to value 0"]
187impl crate::Resettable for ADDISCR_SPEC {
188 const RESET_VALUE: Self::Ux = 0;
189}