1#[doc = "Register `GCR0` reader"]
2pub type R = crate::R<Gcr0Spec>;
3#[doc = "Register `GCR0` writer"]
4pub type W = crate::W<Gcr0Spec>;
5#[doc = "Field `GCALR` reader - Gain Calculation Result"]
6pub type GcalrR = crate::FieldReader<u32>;
7#[doc = "Field `GCALR` writer - Gain Calculation Result"]
8pub type GcalrW<'a, REG> = crate::FieldWriter<'a, REG, 17, u32>;
9#[doc = "Gain Calculation Ready\n\nValue on reset: 0"]
10#[cfg_attr(feature = "defmt", derive(defmt::Format))]
11#[derive(Clone, Copy, Debug, PartialEq, Eq)]
12pub enum Rdy {
13 #[doc = "0: The GCALR value is invalid."]
14 NotValid = 0,
15 #[doc = "1: The GCALR value is valid."]
16 Valid = 1,
17}
18impl From<Rdy> for bool {
19 #[inline(always)]
20 fn from(variant: Rdy) -> Self {
21 variant as u8 != 0
22 }
23}
24#[doc = "Field `RDY` reader - Gain Calculation Ready"]
25pub type RdyR = crate::BitReader<Rdy>;
26impl RdyR {
27 #[doc = "Get enumerated values variant"]
28 #[inline(always)]
29 pub const fn variant(&self) -> Rdy {
30 match self.bits {
31 false => Rdy::NotValid,
32 true => Rdy::Valid,
33 }
34 }
35 #[doc = "The GCALR value is invalid."]
36 #[inline(always)]
37 pub fn is_not_valid(&self) -> bool {
38 *self == Rdy::NotValid
39 }
40 #[doc = "The GCALR value is valid."]
41 #[inline(always)]
42 pub fn is_valid(&self) -> bool {
43 *self == Rdy::Valid
44 }
45}
46#[doc = "Field `RDY` writer - Gain Calculation Ready"]
47pub type RdyW<'a, REG> = crate::BitWriter<'a, REG, Rdy>;
48impl<'a, REG> RdyW<'a, REG>
49where
50 REG: crate::Writable + crate::RegisterSpec,
51{
52 #[doc = "The GCALR value is invalid."]
53 #[inline(always)]
54 pub fn not_valid(self) -> &'a mut crate::W<REG> {
55 self.variant(Rdy::NotValid)
56 }
57 #[doc = "The GCALR value is valid."]
58 #[inline(always)]
59 pub fn valid(self) -> &'a mut crate::W<REG> {
60 self.variant(Rdy::Valid)
61 }
62}
63impl R {
64 #[doc = "Bits 0:16 - Gain Calculation Result"]
65 #[inline(always)]
66 pub fn gcalr(&self) -> GcalrR {
67 GcalrR::new(self.bits & 0x0001_ffff)
68 }
69 #[doc = "Bit 24 - Gain Calculation Ready"]
70 #[inline(always)]
71 pub fn rdy(&self) -> RdyR {
72 RdyR::new(((self.bits >> 24) & 1) != 0)
73 }
74}
75#[cfg(feature = "debug")]
76impl core::fmt::Debug for R {
77 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
78 f.debug_struct("GCR0")
79 .field("gcalr", &self.gcalr())
80 .field("rdy", &self.rdy())
81 .finish()
82 }
83}
84impl W {
85 #[doc = "Bits 0:16 - Gain Calculation Result"]
86 #[inline(always)]
87 pub fn gcalr(&mut self) -> GcalrW<'_, Gcr0Spec> {
88 GcalrW::new(self, 0)
89 }
90 #[doc = "Bit 24 - Gain Calculation Ready"]
91 #[inline(always)]
92 pub fn rdy(&mut self) -> RdyW<'_, Gcr0Spec> {
93 RdyW::new(self, 24)
94 }
95}
96#[doc = "Gain Calculation Result\n\nYou can [`read`](crate::Reg::read) this register and get [`gcr0::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`gcr0::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
97pub struct Gcr0Spec;
98impl crate::RegisterSpec for Gcr0Spec {
99 type Ux = u32;
100}
101#[doc = "`read()` method returns [`gcr0::R`](R) reader structure"]
102impl crate::Readable for Gcr0Spec {}
103#[doc = "`write(|w| ..)` method takes [`gcr0::W`](W) writer structure"]
104impl crate::Writable for Gcr0Spec {
105 type Safety = crate::Unsafe;
106}
107#[doc = "`reset()` method sets GCR0 to value 0x0001_0000"]
108impl crate::Resettable for Gcr0Spec {
109 const RESET_VALUE: u32 = 0x0001_0000;
110}