1#[doc = "Register `GCR[%s]` reader"]
2pub struct R(crate::R<GCR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<GCR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<GCR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<GCR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `GCR[%s]` writer"]
17pub struct W(crate::W<GCR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<GCR_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<GCR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<GCR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `GCALR` reader - Gain Calculation Result"]
38pub struct GCALR_R(crate::FieldReader<u16, u16>);
39impl GCALR_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: u16) -> Self {
42 GCALR_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for GCALR_R {
46 type Target = crate::FieldReader<u16, u16>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `GCALR` writer - Gain Calculation Result"]
53pub struct GCALR_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> GCALR_W<'a> {
57 #[doc = r"Writes raw bits to the field"]
58 #[inline(always)]
59 pub unsafe fn bits(self, value: u16) -> &'a mut W {
60 self.w.bits = (self.w.bits & !0xffff) | (value as u32 & 0xffff);
61 self.w
62 }
63}
64#[doc = "Gain Calculation Ready\n\nValue on reset: 0"]
65#[derive(Clone, Copy, Debug, PartialEq)]
66pub enum RDY_A {
67 #[doc = "0: The gain offset calculation value is invalid."]
68 RDY_0 = 0,
69 #[doc = "1: The gain calibration value is valid."]
70 RDY_1 = 1,
71}
72impl From<RDY_A> for bool {
73 #[inline(always)]
74 fn from(variant: RDY_A) -> Self {
75 variant as u8 != 0
76 }
77}
78#[doc = "Field `RDY` reader - Gain Calculation Ready"]
79pub struct RDY_R(crate::FieldReader<bool, RDY_A>);
80impl RDY_R {
81 #[inline(always)]
82 pub(crate) fn new(bits: bool) -> Self {
83 RDY_R(crate::FieldReader::new(bits))
84 }
85 #[doc = r"Get enumerated values variant"]
86 #[inline(always)]
87 pub fn variant(&self) -> RDY_A {
88 match self.bits {
89 false => RDY_A::RDY_0,
90 true => RDY_A::RDY_1,
91 }
92 }
93 #[doc = "Checks if the value of the field is `RDY_0`"]
94 #[inline(always)]
95 pub fn is_rdy_0(&self) -> bool {
96 **self == RDY_A::RDY_0
97 }
98 #[doc = "Checks if the value of the field is `RDY_1`"]
99 #[inline(always)]
100 pub fn is_rdy_1(&self) -> bool {
101 **self == RDY_A::RDY_1
102 }
103}
104impl core::ops::Deref for RDY_R {
105 type Target = crate::FieldReader<bool, RDY_A>;
106 #[inline(always)]
107 fn deref(&self) -> &Self::Target {
108 &self.0
109 }
110}
111#[doc = "Field `RDY` writer - Gain Calculation Ready"]
112pub struct RDY_W<'a> {
113 w: &'a mut W,
114}
115impl<'a> RDY_W<'a> {
116 #[doc = r"Writes `variant` to the field"]
117 #[inline(always)]
118 pub fn variant(self, variant: RDY_A) -> &'a mut W {
119 self.bit(variant.into())
120 }
121 #[doc = "The gain offset calculation value is invalid."]
122 #[inline(always)]
123 pub fn rdy_0(self) -> &'a mut W {
124 self.variant(RDY_A::RDY_0)
125 }
126 #[doc = "The gain calibration value is valid."]
127 #[inline(always)]
128 pub fn rdy_1(self) -> &'a mut W {
129 self.variant(RDY_A::RDY_1)
130 }
131 #[doc = r"Sets the field bit"]
132 #[inline(always)]
133 pub fn set_bit(self) -> &'a mut W {
134 self.bit(true)
135 }
136 #[doc = r"Clears the field bit"]
137 #[inline(always)]
138 pub fn clear_bit(self) -> &'a mut W {
139 self.bit(false)
140 }
141 #[doc = r"Writes raw bits to the field"]
142 #[inline(always)]
143 pub fn bit(self, value: bool) -> &'a mut W {
144 self.w.bits = (self.w.bits & !(0x01 << 24)) | ((value as u32 & 0x01) << 24);
145 self.w
146 }
147}
148impl R {
149 #[doc = "Bits 0:15 - Gain Calculation Result"]
150 #[inline(always)]
151 pub fn gcalr(&self) -> GCALR_R {
152 GCALR_R::new((self.bits & 0xffff) as u16)
153 }
154 #[doc = "Bit 24 - Gain Calculation Ready"]
155 #[inline(always)]
156 pub fn rdy(&self) -> RDY_R {
157 RDY_R::new(((self.bits >> 24) & 0x01) != 0)
158 }
159}
160impl W {
161 #[doc = "Bits 0:15 - Gain Calculation Result"]
162 #[inline(always)]
163 pub fn gcalr(&mut self) -> GCALR_W {
164 GCALR_W { w: self }
165 }
166 #[doc = "Bit 24 - Gain Calculation Ready"]
167 #[inline(always)]
168 pub fn rdy(&mut self) -> RDY_W {
169 RDY_W { w: self }
170 }
171 #[doc = "Writes raw bits to the register."]
172 #[inline(always)]
173 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
174 self.0.bits(bits);
175 self
176 }
177}
178#[doc = "Gain Calculation Result\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 [gcr](index.html) module"]
179pub struct GCR_SPEC;
180impl crate::RegisterSpec for GCR_SPEC {
181 type Ux = u32;
182}
183#[doc = "`read()` method returns [gcr::R](R) reader structure"]
184impl crate::Readable for GCR_SPEC {
185 type Reader = R;
186}
187#[doc = "`write(|w| ..)` method takes [gcr::W](W) writer structure"]
188impl crate::Writable for GCR_SPEC {
189 type Writer = W;
190}
191#[doc = "`reset()` method sets GCR[%s]
192to value 0"]
193impl crate::Resettable for GCR_SPEC {
194 #[inline(always)]
195 fn reset_value() -> Self::Ux {
196 0
197 }
198}