d1_pac/sys_cfg/
rescal_ctrl.rs

1#[doc = "Register `rescal_ctrl` reader"]
2pub type R = crate::R<RESCAL_CTRL_SPEC>;
3#[doc = "Register `rescal_ctrl` writer"]
4pub type W = crate::W<RESCAL_CTRL_SPEC>;
5#[doc = "Field `cal_en` reader - Auto Calibration Enable"]
6pub type CAL_EN_R = crate::BitReader<CAL_EN_A>;
7#[doc = "Auto Calibration Enable\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum CAL_EN_A {
10    #[doc = "0: `0`"]
11    DISABLE = 0,
12    #[doc = "1: `1`"]
13    ENABLE = 1,
14}
15impl From<CAL_EN_A> for bool {
16    #[inline(always)]
17    fn from(variant: CAL_EN_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl CAL_EN_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> CAL_EN_A {
25        match self.bits {
26            false => CAL_EN_A::DISABLE,
27            true => CAL_EN_A::ENABLE,
28        }
29    }
30    #[doc = "`0`"]
31    #[inline(always)]
32    pub fn is_disable(&self) -> bool {
33        *self == CAL_EN_A::DISABLE
34    }
35    #[doc = "`1`"]
36    #[inline(always)]
37    pub fn is_enable(&self) -> bool {
38        *self == CAL_EN_A::ENABLE
39    }
40}
41#[doc = "Field `cal_en` writer - Auto Calibration Enable"]
42pub type CAL_EN_W<'a, REG> = crate::BitWriter<'a, REG, CAL_EN_A>;
43impl<'a, REG> CAL_EN_W<'a, REG>
44where
45    REG: crate::Writable + crate::RegisterSpec,
46{
47    #[doc = "`0`"]
48    #[inline(always)]
49    pub fn disable(self) -> &'a mut crate::W<REG> {
50        self.variant(CAL_EN_A::DISABLE)
51    }
52    #[doc = "`1`"]
53    #[inline(always)]
54    pub fn enable(self) -> &'a mut crate::W<REG> {
55        self.variant(CAL_EN_A::ENABLE)
56    }
57}
58#[doc = "Field `cal_ana_en` reader - Calibration Circuits Analog Enable"]
59pub type CAL_ANA_EN_R = crate::BitReader<CAL_ANA_EN_A>;
60#[doc = "Calibration Circuits Analog Enable\n\nValue on reset: 0"]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum CAL_ANA_EN_A {
63    #[doc = "0: `0`"]
64    DISABLE = 0,
65    #[doc = "1: `1`"]
66    ENABLE = 1,
67}
68impl From<CAL_ANA_EN_A> for bool {
69    #[inline(always)]
70    fn from(variant: CAL_ANA_EN_A) -> Self {
71        variant as u8 != 0
72    }
73}
74impl CAL_ANA_EN_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub const fn variant(&self) -> CAL_ANA_EN_A {
78        match self.bits {
79            false => CAL_ANA_EN_A::DISABLE,
80            true => CAL_ANA_EN_A::ENABLE,
81        }
82    }
83    #[doc = "`0`"]
84    #[inline(always)]
85    pub fn is_disable(&self) -> bool {
86        *self == CAL_ANA_EN_A::DISABLE
87    }
88    #[doc = "`1`"]
89    #[inline(always)]
90    pub fn is_enable(&self) -> bool {
91        *self == CAL_ANA_EN_A::ENABLE
92    }
93}
94#[doc = "Field `cal_ana_en` writer - Calibration Circuits Analog Enable"]
95pub type CAL_ANA_EN_W<'a, REG> = crate::BitWriter<'a, REG, CAL_ANA_EN_A>;
96impl<'a, REG> CAL_ANA_EN_W<'a, REG>
97where
98    REG: crate::Writable + crate::RegisterSpec,
99{
100    #[doc = "`0`"]
101    #[inline(always)]
102    pub fn disable(self) -> &'a mut crate::W<REG> {
103        self.variant(CAL_ANA_EN_A::DISABLE)
104    }
105    #[doc = "`1`"]
106    #[inline(always)]
107    pub fn enable(self) -> &'a mut crate::W<REG> {
108        self.variant(CAL_ANA_EN_A::ENABLE)
109    }
110}
111#[doc = "Field `rescal_mode` reader - RESCAL Calibration Mode Select"]
112pub type RESCAL_MODE_R = crate::BitReader<RESCAL_MODE_A>;
113#[doc = "RESCAL Calibration Mode Select\n\nValue on reset: 0"]
114#[derive(Clone, Copy, Debug, PartialEq, Eq)]
115pub enum RESCAL_MODE_A {
116    #[doc = "0: `0`"]
117    AUTO_CALIBRATION = 0,
118}
119impl From<RESCAL_MODE_A> for bool {
120    #[inline(always)]
121    fn from(variant: RESCAL_MODE_A) -> Self {
122        variant as u8 != 0
123    }
124}
125impl RESCAL_MODE_R {
126    #[doc = "Get enumerated values variant"]
127    #[inline(always)]
128    pub const fn variant(&self) -> Option<RESCAL_MODE_A> {
129        match self.bits {
130            false => Some(RESCAL_MODE_A::AUTO_CALIBRATION),
131            _ => None,
132        }
133    }
134    #[doc = "`0`"]
135    #[inline(always)]
136    pub fn is_auto_calibration(&self) -> bool {
137        *self == RESCAL_MODE_A::AUTO_CALIBRATION
138    }
139}
140#[doc = "Field `rescal_mode` writer - RESCAL Calibration Mode Select"]
141pub type RESCAL_MODE_W<'a, REG> = crate::BitWriter<'a, REG, RESCAL_MODE_A>;
142impl<'a, REG> RESCAL_MODE_W<'a, REG>
143where
144    REG: crate::Writable + crate::RegisterSpec,
145{
146    #[doc = "`0`"]
147    #[inline(always)]
148    pub fn auto_calibration(self) -> &'a mut crate::W<REG> {
149        self.variant(RESCAL_MODE_A::AUTO_CALIBRATION)
150    }
151}
152#[doc = "Field `ddr_res240_trimming_sel` reader - 240ohms Resistor Trimming Source Select"]
153pub type DDR_RES240_TRIMMING_SEL_R = crate::BitReader<DDR_RES240_TRIMMING_SEL_A>;
154#[doc = "240ohms Resistor Trimming Source Select\n\nValue on reset: 0"]
155#[derive(Clone, Copy, Debug, PartialEq, Eq)]
156pub enum DDR_RES240_TRIMMING_SEL_A {
157    #[doc = "0: `0`"]
158    RESCAL = 0,
159    #[doc = "1: `1`"]
160    RES240_TRIM = 1,
161}
162impl From<DDR_RES240_TRIMMING_SEL_A> for bool {
163    #[inline(always)]
164    fn from(variant: DDR_RES240_TRIMMING_SEL_A) -> Self {
165        variant as u8 != 0
166    }
167}
168impl DDR_RES240_TRIMMING_SEL_R {
169    #[doc = "Get enumerated values variant"]
170    #[inline(always)]
171    pub const fn variant(&self) -> DDR_RES240_TRIMMING_SEL_A {
172        match self.bits {
173            false => DDR_RES240_TRIMMING_SEL_A::RESCAL,
174            true => DDR_RES240_TRIMMING_SEL_A::RES240_TRIM,
175        }
176    }
177    #[doc = "`0`"]
178    #[inline(always)]
179    pub fn is_rescal(&self) -> bool {
180        *self == DDR_RES240_TRIMMING_SEL_A::RESCAL
181    }
182    #[doc = "`1`"]
183    #[inline(always)]
184    pub fn is_res240_trim(&self) -> bool {
185        *self == DDR_RES240_TRIMMING_SEL_A::RES240_TRIM
186    }
187}
188#[doc = "Field `ddr_res240_trimming_sel` writer - 240ohms Resistor Trimming Source Select"]
189pub type DDR_RES240_TRIMMING_SEL_W<'a, REG> = crate::BitWriter<'a, REG, DDR_RES240_TRIMMING_SEL_A>;
190impl<'a, REG> DDR_RES240_TRIMMING_SEL_W<'a, REG>
191where
192    REG: crate::Writable + crate::RegisterSpec,
193{
194    #[doc = "`0`"]
195    #[inline(always)]
196    pub fn rescal(self) -> &'a mut crate::W<REG> {
197        self.variant(DDR_RES240_TRIMMING_SEL_A::RESCAL)
198    }
199    #[doc = "`1`"]
200    #[inline(always)]
201    pub fn res240_trim(self) -> &'a mut crate::W<REG> {
202        self.variant(DDR_RES240_TRIMMING_SEL_A::RES240_TRIM)
203    }
204}
205impl R {
206    #[doc = "Bit 0 - Auto Calibration Enable"]
207    #[inline(always)]
208    pub fn cal_en(&self) -> CAL_EN_R {
209        CAL_EN_R::new((self.bits & 1) != 0)
210    }
211    #[doc = "Bit 1 - Calibration Circuits Analog Enable"]
212    #[inline(always)]
213    pub fn cal_ana_en(&self) -> CAL_ANA_EN_R {
214        CAL_ANA_EN_R::new(((self.bits >> 1) & 1) != 0)
215    }
216    #[doc = "Bit 2 - RESCAL Calibration Mode Select"]
217    #[inline(always)]
218    pub fn rescal_mode(&self) -> RESCAL_MODE_R {
219        RESCAL_MODE_R::new(((self.bits >> 2) & 1) != 0)
220    }
221    #[doc = "Bit 8 - 240ohms Resistor Trimming Source Select"]
222    #[inline(always)]
223    pub fn ddr_res240_trimming_sel(&self) -> DDR_RES240_TRIMMING_SEL_R {
224        DDR_RES240_TRIMMING_SEL_R::new(((self.bits >> 8) & 1) != 0)
225    }
226}
227impl W {
228    #[doc = "Bit 0 - Auto Calibration Enable"]
229    #[inline(always)]
230    #[must_use]
231    pub fn cal_en(&mut self) -> CAL_EN_W<RESCAL_CTRL_SPEC> {
232        CAL_EN_W::new(self, 0)
233    }
234    #[doc = "Bit 1 - Calibration Circuits Analog Enable"]
235    #[inline(always)]
236    #[must_use]
237    pub fn cal_ana_en(&mut self) -> CAL_ANA_EN_W<RESCAL_CTRL_SPEC> {
238        CAL_ANA_EN_W::new(self, 1)
239    }
240    #[doc = "Bit 2 - RESCAL Calibration Mode Select"]
241    #[inline(always)]
242    #[must_use]
243    pub fn rescal_mode(&mut self) -> RESCAL_MODE_W<RESCAL_CTRL_SPEC> {
244        RESCAL_MODE_W::new(self, 2)
245    }
246    #[doc = "Bit 8 - 240ohms Resistor Trimming Source Select"]
247    #[inline(always)]
248    #[must_use]
249    pub fn ddr_res240_trimming_sel(&mut self) -> DDR_RES240_TRIMMING_SEL_W<RESCAL_CTRL_SPEC> {
250        DDR_RES240_TRIMMING_SEL_W::new(self, 8)
251    }
252    #[doc = r" Writes raw bits to the register."]
253    #[doc = r""]
254    #[doc = r" # Safety"]
255    #[doc = r""]
256    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
257    #[inline(always)]
258    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
259        self.bits = bits;
260        self
261    }
262}
263#[doc = "Resistor Calibration Control Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`rescal_ctrl::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`rescal_ctrl::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
264pub struct RESCAL_CTRL_SPEC;
265impl crate::RegisterSpec for RESCAL_CTRL_SPEC {
266    type Ux = u32;
267}
268#[doc = "`read()` method returns [`rescal_ctrl::R`](R) reader structure"]
269impl crate::Readable for RESCAL_CTRL_SPEC {}
270#[doc = "`write(|w| ..)` method takes [`rescal_ctrl::W`](W) writer structure"]
271impl crate::Writable for RESCAL_CTRL_SPEC {
272    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
273    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
274}
275#[doc = "`reset()` method sets rescal_ctrl to value 0"]
276impl crate::Resettable for RESCAL_CTRL_SPEC {
277    const RESET_VALUE: Self::Ux = 0;
278}