1#[doc = "Register `C2` reader"]
2pub struct R(crate::R<C2_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<C2_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<C2_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<C2_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `C2` writer"]
17pub struct W(crate::W<C2_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<C2_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<C2_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<C2_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "ACMP Input Pin Enable\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum ACIPE_A {
41 #[doc = "0: The corresponding external analog input is not allowed."]
42 _0 = 0,
43 #[doc = "1: The corresponding external analog input is allowed."]
44 _1 = 1,
45}
46impl From<ACIPE_A> for u8 {
47 #[inline(always)]
48 fn from(variant: ACIPE_A) -> Self {
49 variant as _
50 }
51}
52#[doc = "Field `ACIPE` reader - ACMP Input Pin Enable"]
53pub struct ACIPE_R(crate::FieldReader<u8, ACIPE_A>);
54impl ACIPE_R {
55 pub(crate) fn new(bits: u8) -> Self {
56 ACIPE_R(crate::FieldReader::new(bits))
57 }
58 #[doc = r"Get enumerated values variant"]
59 #[inline(always)]
60 pub fn variant(&self) -> Option<ACIPE_A> {
61 match self.bits {
62 0 => Some(ACIPE_A::_0),
63 1 => Some(ACIPE_A::_1),
64 _ => None,
65 }
66 }
67 #[doc = "Checks if the value of the field is `_0`"]
68 #[inline(always)]
69 pub fn is_0(&self) -> bool {
70 **self == ACIPE_A::_0
71 }
72 #[doc = "Checks if the value of the field is `_1`"]
73 #[inline(always)]
74 pub fn is_1(&self) -> bool {
75 **self == ACIPE_A::_1
76 }
77}
78impl core::ops::Deref for ACIPE_R {
79 type Target = crate::FieldReader<u8, ACIPE_A>;
80 #[inline(always)]
81 fn deref(&self) -> &Self::Target {
82 &self.0
83 }
84}
85#[doc = "Field `ACIPE` writer - ACMP Input Pin Enable"]
86pub struct ACIPE_W<'a> {
87 w: &'a mut W,
88}
89impl<'a> ACIPE_W<'a> {
90 #[doc = r"Writes `variant` to the field"]
91 #[inline(always)]
92 pub fn variant(self, variant: ACIPE_A) -> &'a mut W {
93 unsafe { self.bits(variant.into()) }
94 }
95 #[doc = "The corresponding external analog input is not allowed."]
96 #[inline(always)]
97 pub fn _0(self) -> &'a mut W {
98 self.variant(ACIPE_A::_0)
99 }
100 #[doc = "The corresponding external analog input is allowed."]
101 #[inline(always)]
102 pub fn _1(self) -> &'a mut W {
103 self.variant(ACIPE_A::_1)
104 }
105 #[doc = r"Writes raw bits to the field"]
106 #[inline(always)]
107 pub unsafe fn bits(self, value: u8) -> &'a mut W {
108 self.w.bits = (self.w.bits & !0x07) | (value as u8 & 0x07);
109 self.w
110 }
111}
112impl R {
113 #[doc = "Bits 0:2 - ACMP Input Pin Enable"]
114 #[inline(always)]
115 pub fn acipe(&self) -> ACIPE_R {
116 ACIPE_R::new((self.bits & 0x07) as u8)
117 }
118}
119impl W {
120 #[doc = "Bits 0:2 - ACMP Input Pin Enable"]
121 #[inline(always)]
122 pub fn acipe(&mut self) -> ACIPE_W {
123 ACIPE_W { w: self }
124 }
125 #[doc = "Writes raw bits to the register."]
126 #[inline(always)]
127 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
128 self.0.bits(bits);
129 self
130 }
131}
132#[doc = "ACMP Control Register 2\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 [c2](index.html) module"]
133pub struct C2_SPEC;
134impl crate::RegisterSpec for C2_SPEC {
135 type Ux = u8;
136}
137#[doc = "`read()` method returns [c2::R](R) reader structure"]
138impl crate::Readable for C2_SPEC {
139 type Reader = R;
140}
141#[doc = "`write(|w| ..)` method takes [c2::W](W) writer structure"]
142impl crate::Writable for C2_SPEC {
143 type Writer = W;
144}
145#[doc = "`reset()` method sets C2 to value 0"]
146impl crate::Resettable for C2_SPEC {
147 #[inline(always)]
148 fn reset_value() -> Self::Ux {
149 0
150 }
151}