ra2a1/adc160/
adcalexe.rs

1#[doc = "Register `ADCALEXE` reader"]
2pub struct R(crate::R<ADCALEXE_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ADCALEXE_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ADCALEXE_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ADCALEXE_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `ADCALEXE` writer"]
17pub struct W(crate::W<ADCALEXE_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ADCALEXE_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<ADCALEXE_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ADCALEXE_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CALMON` reader - Calibration Status Flag"]
38pub type CALMON_R = crate::BitReader<CALMON_A>;
39#[doc = "Calibration Status Flag\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum CALMON_A {
42    #[doc = "0: Calibration is not in progress"]
43    _0 = 0,
44    #[doc = "1: Calibration is in progress"]
45    _1 = 1,
46}
47impl From<CALMON_A> for bool {
48    #[inline(always)]
49    fn from(variant: CALMON_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl CALMON_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> CALMON_A {
57        match self.bits {
58            false => CALMON_A::_0,
59            true => CALMON_A::_1,
60        }
61    }
62    #[doc = "Checks if the value of the field is `_0`"]
63    #[inline(always)]
64    pub fn is_0(&self) -> bool {
65        *self == CALMON_A::_0
66    }
67    #[doc = "Checks if the value of the field is `_1`"]
68    #[inline(always)]
69    pub fn is_1(&self) -> bool {
70        *self == CALMON_A::_1
71    }
72}
73#[doc = "Field `CALEXE` reader - Calibration Start"]
74pub type CALEXE_R = crate::BitReader<CALEXE_A>;
75#[doc = "Calibration Start\n\nValue on reset: 0"]
76#[derive(Clone, Copy, Debug, PartialEq, Eq)]
77pub enum CALEXE_A {
78    #[doc = "0: Calibration does not start"]
79    _0 = 0,
80    #[doc = "1: Calibration starts"]
81    _1 = 1,
82}
83impl From<CALEXE_A> for bool {
84    #[inline(always)]
85    fn from(variant: CALEXE_A) -> Self {
86        variant as u8 != 0
87    }
88}
89impl CALEXE_R {
90    #[doc = "Get enumerated values variant"]
91    #[inline(always)]
92    pub fn variant(&self) -> CALEXE_A {
93        match self.bits {
94            false => CALEXE_A::_0,
95            true => CALEXE_A::_1,
96        }
97    }
98    #[doc = "Checks if the value of the field is `_0`"]
99    #[inline(always)]
100    pub fn is_0(&self) -> bool {
101        *self == CALEXE_A::_0
102    }
103    #[doc = "Checks if the value of the field is `_1`"]
104    #[inline(always)]
105    pub fn is_1(&self) -> bool {
106        *self == CALEXE_A::_1
107    }
108}
109#[doc = "Field `CALEXE` writer - Calibration Start"]
110pub type CALEXE_W<'a, const O: u8> = crate::BitWriter<'a, u8, ADCALEXE_SPEC, CALEXE_A, O>;
111impl<'a, const O: u8> CALEXE_W<'a, O> {
112    #[doc = "Calibration does not start"]
113    #[inline(always)]
114    pub fn _0(self) -> &'a mut W {
115        self.variant(CALEXE_A::_0)
116    }
117    #[doc = "Calibration starts"]
118    #[inline(always)]
119    pub fn _1(self) -> &'a mut W {
120        self.variant(CALEXE_A::_1)
121    }
122}
123impl R {
124    #[doc = "Bit 6 - Calibration Status Flag"]
125    #[inline(always)]
126    pub fn calmon(&self) -> CALMON_R {
127        CALMON_R::new(((self.bits >> 6) & 1) != 0)
128    }
129    #[doc = "Bit 7 - Calibration Start"]
130    #[inline(always)]
131    pub fn calexe(&self) -> CALEXE_R {
132        CALEXE_R::new(((self.bits >> 7) & 1) != 0)
133    }
134}
135impl W {
136    #[doc = "Bit 7 - Calibration Start"]
137    #[inline(always)]
138    #[must_use]
139    pub fn calexe(&mut self) -> CALEXE_W<7> {
140        CALEXE_W::new(self)
141    }
142    #[doc = "Writes raw bits to the register."]
143    #[inline(always)]
144    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
145        self.0.bits(bits);
146        self
147    }
148}
149#[doc = "A/D Calibration Execution 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 [adcalexe](index.html) module"]
150pub struct ADCALEXE_SPEC;
151impl crate::RegisterSpec for ADCALEXE_SPEC {
152    type Ux = u8;
153}
154#[doc = "`read()` method returns [adcalexe::R](R) reader structure"]
155impl crate::Readable for ADCALEXE_SPEC {
156    type Reader = R;
157}
158#[doc = "`write(|w| ..)` method takes [adcalexe::W](W) writer structure"]
159impl crate::Writable for ADCALEXE_SPEC {
160    type Writer = W;
161    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
162    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
163}
164#[doc = "`reset()` method sets ADCALEXE to value 0"]
165impl crate::Resettable for ADCALEXE_SPEC {
166    const RESET_VALUE: Self::Ux = 0;
167}