1#[doc = "Register `GCC0` reader"]
2pub type R = crate::R<Gcc0Spec>;
3#[doc = "Field `GAIN_CAL` reader - Gain Calibration Value"]
4pub type GainCalR = crate::FieldReader<u16>;
5#[doc = "Gain Calibration Value Valid\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Rdy {
9 #[doc = "0: The GAIN_CAL value is invalid. Run the hardware calibration routine for this value to be set."]
10 GainCalNotValid = 0,
11 #[doc = "1: The GAIN_CAL value is valid. GAIN_CAL should be used by software to derive GCRa\\[GCALR\\]."]
12 HardwareCalRoutineCompleted = 1,
13}
14impl From<Rdy> for bool {
15 #[inline(always)]
16 fn from(variant: Rdy) -> Self {
17 variant as u8 != 0
18 }
19}
20#[doc = "Field `RDY` reader - Gain Calibration Value Valid"]
21pub type RdyR = crate::BitReader<Rdy>;
22impl RdyR {
23 #[doc = "Get enumerated values variant"]
24 #[inline(always)]
25 pub const fn variant(&self) -> Rdy {
26 match self.bits {
27 false => Rdy::GainCalNotValid,
28 true => Rdy::HardwareCalRoutineCompleted,
29 }
30 }
31 #[doc = "The GAIN_CAL value is invalid. Run the hardware calibration routine for this value to be set."]
32 #[inline(always)]
33 pub fn is_gain_cal_not_valid(&self) -> bool {
34 *self == Rdy::GainCalNotValid
35 }
36 #[doc = "The GAIN_CAL value is valid. GAIN_CAL should be used by software to derive GCRa\\[GCALR\\]."]
37 #[inline(always)]
38 pub fn is_hardware_cal_routine_completed(&self) -> bool {
39 *self == Rdy::HardwareCalRoutineCompleted
40 }
41}
42impl R {
43 #[doc = "Bits 0:15 - Gain Calibration Value"]
44 #[inline(always)]
45 pub fn gain_cal(&self) -> GainCalR {
46 GainCalR::new((self.bits & 0xffff) as u16)
47 }
48 #[doc = "Bit 24 - Gain Calibration Value Valid"]
49 #[inline(always)]
50 pub fn rdy(&self) -> RdyR {
51 RdyR::new(((self.bits >> 24) & 1) != 0)
52 }
53}
54#[cfg(feature = "debug")]
55impl core::fmt::Debug for R {
56 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
57 f.debug_struct("GCC0")
58 .field("gain_cal", &self.gain_cal())
59 .field("rdy", &self.rdy())
60 .finish()
61 }
62}
63#[doc = "Gain Calibration Control\n\nYou can [`read`](crate::Reg::read) this register and get [`gcc0::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
64pub struct Gcc0Spec;
65impl crate::RegisterSpec for Gcc0Spec {
66 type Ux = u32;
67}
68#[doc = "`read()` method returns [`gcc0::R`](R) reader structure"]
69impl crate::Readable for Gcc0Spec {}
70#[doc = "`reset()` method sets GCC0 to value 0"]
71impl crate::Resettable for Gcc0Spec {}