bl602_pac/hbn/
rc32k_ctrl0.rs

1#[doc = "Register `rc32k_ctrl0` reader"]
2pub struct R(crate::R<RC32K_CTRL0_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<RC32K_CTRL0_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<RC32K_CTRL0_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<RC32K_CTRL0_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `rc32k_ctrl0` writer"]
17pub struct W(crate::W<RC32K_CTRL0_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<RC32K_CTRL0_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<RC32K_CTRL0_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<RC32K_CTRL0_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `rc32k_cal_done` reader - "]
38pub type RC32K_CAL_DONE_R = crate::BitReader<bool>;
39#[doc = "Field `rc32k_rdy` reader - "]
40pub type RC32K_RDY_R = crate::BitReader<bool>;
41#[doc = "Field `rc32k_cal_inprogress` reader - "]
42pub type RC32K_CAL_INPROGRESS_R = crate::BitReader<bool>;
43#[doc = "Field `rc32k_cal_div` reader - "]
44pub type RC32K_CAL_DIV_R = crate::FieldReader<u8, u8>;
45#[doc = "Field `rc32k_cal_div` writer - "]
46pub type RC32K_CAL_DIV_W<'a, const O: u8> =
47    crate::FieldWriter<'a, u32, RC32K_CTRL0_SPEC, u8, u8, 2, O>;
48#[doc = "Field `rc32k_cal_precharge` reader - "]
49pub type RC32K_CAL_PRECHARGE_R = crate::BitReader<bool>;
50#[doc = "Field `rc32k_dig_code_fr_cal` reader - "]
51pub type RC32K_DIG_CODE_FR_CAL_R = crate::FieldReader<u16, u16>;
52#[doc = "Field `rc32k_vref_dly` reader - "]
53pub type RC32K_VREF_DLY_R = crate::FieldReader<u8, u8>;
54#[doc = "Field `rc32k_vref_dly` writer - "]
55pub type RC32K_VREF_DLY_W<'a, const O: u8> =
56    crate::FieldWriter<'a, u32, RC32K_CTRL0_SPEC, u8, u8, 2, O>;
57#[doc = "Field `rc32k_allow_cal` reader - "]
58pub type RC32K_ALLOW_CAL_R = crate::BitReader<bool>;
59#[doc = "Field `rc32k_allow_cal` writer - "]
60pub type RC32K_ALLOW_CAL_W<'a, const O: u8> = crate::BitWriter<'a, u32, RC32K_CTRL0_SPEC, bool, O>;
61#[doc = "Field `rc32k_ext_code_en` reader - "]
62pub type RC32K_EXT_CODE_EN_R = crate::BitReader<bool>;
63#[doc = "Field `rc32k_ext_code_en` writer - "]
64pub type RC32K_EXT_CODE_EN_W<'a, const O: u8> =
65    crate::BitWriter<'a, u32, RC32K_CTRL0_SPEC, bool, O>;
66#[doc = "Field `rc32k_cal_en` reader - "]
67pub type RC32K_CAL_EN_R = crate::BitReader<bool>;
68#[doc = "Field `rc32k_cal_en` writer - "]
69pub type RC32K_CAL_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, RC32K_CTRL0_SPEC, bool, O>;
70#[doc = "Field `rc32k_code_fr_ext` reader - "]
71pub type RC32K_CODE_FR_EXT_R = crate::FieldReader<u16, u16>;
72#[doc = "Field `rc32k_code_fr_ext` writer - "]
73pub type RC32K_CODE_FR_EXT_W<'a, const O: u8> =
74    crate::FieldWriter<'a, u32, RC32K_CTRL0_SPEC, u16, u16, 10, O>;
75impl R {
76    #[doc = "Bit 0"]
77    #[inline(always)]
78    pub fn rc32k_cal_done(&self) -> RC32K_CAL_DONE_R {
79        RC32K_CAL_DONE_R::new((self.bits & 1) != 0)
80    }
81    #[doc = "Bit 1"]
82    #[inline(always)]
83    pub fn rc32k_rdy(&self) -> RC32K_RDY_R {
84        RC32K_RDY_R::new(((self.bits >> 1) & 1) != 0)
85    }
86    #[doc = "Bit 2"]
87    #[inline(always)]
88    pub fn rc32k_cal_inprogress(&self) -> RC32K_CAL_INPROGRESS_R {
89        RC32K_CAL_INPROGRESS_R::new(((self.bits >> 2) & 1) != 0)
90    }
91    #[doc = "Bits 3:4"]
92    #[inline(always)]
93    pub fn rc32k_cal_div(&self) -> RC32K_CAL_DIV_R {
94        RC32K_CAL_DIV_R::new(((self.bits >> 3) & 3) as u8)
95    }
96    #[doc = "Bit 5"]
97    #[inline(always)]
98    pub fn rc32k_cal_precharge(&self) -> RC32K_CAL_PRECHARGE_R {
99        RC32K_CAL_PRECHARGE_R::new(((self.bits >> 5) & 1) != 0)
100    }
101    #[doc = "Bits 6:15"]
102    #[inline(always)]
103    pub fn rc32k_dig_code_fr_cal(&self) -> RC32K_DIG_CODE_FR_CAL_R {
104        RC32K_DIG_CODE_FR_CAL_R::new(((self.bits >> 6) & 0x03ff) as u16)
105    }
106    #[doc = "Bits 16:17"]
107    #[inline(always)]
108    pub fn rc32k_vref_dly(&self) -> RC32K_VREF_DLY_R {
109        RC32K_VREF_DLY_R::new(((self.bits >> 16) & 3) as u8)
110    }
111    #[doc = "Bit 18"]
112    #[inline(always)]
113    pub fn rc32k_allow_cal(&self) -> RC32K_ALLOW_CAL_R {
114        RC32K_ALLOW_CAL_R::new(((self.bits >> 18) & 1) != 0)
115    }
116    #[doc = "Bit 19"]
117    #[inline(always)]
118    pub fn rc32k_ext_code_en(&self) -> RC32K_EXT_CODE_EN_R {
119        RC32K_EXT_CODE_EN_R::new(((self.bits >> 19) & 1) != 0)
120    }
121    #[doc = "Bit 20"]
122    #[inline(always)]
123    pub fn rc32k_cal_en(&self) -> RC32K_CAL_EN_R {
124        RC32K_CAL_EN_R::new(((self.bits >> 20) & 1) != 0)
125    }
126    #[doc = "Bits 22:31"]
127    #[inline(always)]
128    pub fn rc32k_code_fr_ext(&self) -> RC32K_CODE_FR_EXT_R {
129        RC32K_CODE_FR_EXT_R::new(((self.bits >> 22) & 0x03ff) as u16)
130    }
131}
132impl W {
133    #[doc = "Bits 3:4"]
134    #[inline(always)]
135    #[must_use]
136    pub fn rc32k_cal_div(&mut self) -> RC32K_CAL_DIV_W<3> {
137        RC32K_CAL_DIV_W::new(self)
138    }
139    #[doc = "Bits 16:17"]
140    #[inline(always)]
141    #[must_use]
142    pub fn rc32k_vref_dly(&mut self) -> RC32K_VREF_DLY_W<16> {
143        RC32K_VREF_DLY_W::new(self)
144    }
145    #[doc = "Bit 18"]
146    #[inline(always)]
147    #[must_use]
148    pub fn rc32k_allow_cal(&mut self) -> RC32K_ALLOW_CAL_W<18> {
149        RC32K_ALLOW_CAL_W::new(self)
150    }
151    #[doc = "Bit 19"]
152    #[inline(always)]
153    #[must_use]
154    pub fn rc32k_ext_code_en(&mut self) -> RC32K_EXT_CODE_EN_W<19> {
155        RC32K_EXT_CODE_EN_W::new(self)
156    }
157    #[doc = "Bit 20"]
158    #[inline(always)]
159    #[must_use]
160    pub fn rc32k_cal_en(&mut self) -> RC32K_CAL_EN_W<20> {
161        RC32K_CAL_EN_W::new(self)
162    }
163    #[doc = "Bits 22:31"]
164    #[inline(always)]
165    #[must_use]
166    pub fn rc32k_code_fr_ext(&mut self) -> RC32K_CODE_FR_EXT_W<22> {
167        RC32K_CODE_FR_EXT_W::new(self)
168    }
169    #[doc = "Writes raw bits to the register."]
170    #[inline(always)]
171    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
172        self.0.bits(bits);
173        self
174    }
175}
176#[doc = "rc32k_ctrl0.\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 [rc32k_ctrl0](index.html) module"]
177pub struct RC32K_CTRL0_SPEC;
178impl crate::RegisterSpec for RC32K_CTRL0_SPEC {
179    type Ux = u32;
180}
181#[doc = "`read()` method returns [rc32k_ctrl0::R](R) reader structure"]
182impl crate::Readable for RC32K_CTRL0_SPEC {
183    type Reader = R;
184}
185#[doc = "`write(|w| ..)` method takes [rc32k_ctrl0::W](W) writer structure"]
186impl crate::Writable for RC32K_CTRL0_SPEC {
187    type Writer = W;
188    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
189    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
190}
191#[doc = "`reset()` method sets rc32k_ctrl0 to value 0x5008_801b"]
192impl crate::Resettable for RC32K_CTRL0_SPEC {
193    const RESET_VALUE: Self::Ux = 0x5008_801b;
194}