lpc55_pac/flash_cmpa/
xtal_16mhz_capabank_trim.rs

1#[doc = "Register `XTAL_16MHZ_CAPABANK_TRIM` reader"]
2pub struct R(crate::R<XTAL_16MHZ_CAPABANK_TRIM_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<XTAL_16MHZ_CAPABANK_TRIM_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<XTAL_16MHZ_CAPABANK_TRIM_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<XTAL_16MHZ_CAPABANK_TRIM_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `XTAL_16MHZ_CAPABANK_TRIM` writer"]
17pub struct W(crate::W<XTAL_16MHZ_CAPABANK_TRIM_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<XTAL_16MHZ_CAPABANK_TRIM_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<XTAL_16MHZ_CAPABANK_TRIM_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<XTAL_16MHZ_CAPABANK_TRIM_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TRIM_VALID` reader - 0 : Capa Bank trimmings not valid. Default trimmings value are used. 1 : Capa Bank trimmings valid."]
38pub struct TRIM_VALID_R(crate::FieldReader<bool, bool>);
39impl TRIM_VALID_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: bool) -> Self {
42        TRIM_VALID_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for TRIM_VALID_R {
46    type Target = crate::FieldReader<bool, bool>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `TRIM_VALID` writer - 0 : Capa Bank trimmings not valid. Default trimmings value are used. 1 : Capa Bank trimmings valid."]
53pub struct TRIM_VALID_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> TRIM_VALID_W<'a> {
57    #[doc = r"Sets the field bit"]
58    #[inline(always)]
59    pub fn set_bit(self) -> &'a mut W {
60        self.bit(true)
61    }
62    #[doc = r"Clears the field bit"]
63    #[inline(always)]
64    pub fn clear_bit(self) -> &'a mut W {
65        self.bit(false)
66    }
67    #[doc = r"Writes raw bits to the field"]
68    #[inline(always)]
69    pub fn bit(self, value: bool) -> &'a mut W {
70        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
71        self.w
72    }
73}
74#[doc = "Field `XTAL_LOAD_CAP_IEC_PF_X100` reader - Load capacitance, pF x 100. For example, 6pF becomes 600."]
75pub struct XTAL_LOAD_CAP_IEC_PF_X100_R(crate::FieldReader<u16, u16>);
76impl XTAL_LOAD_CAP_IEC_PF_X100_R {
77    #[inline(always)]
78    pub(crate) fn new(bits: u16) -> Self {
79        XTAL_LOAD_CAP_IEC_PF_X100_R(crate::FieldReader::new(bits))
80    }
81}
82impl core::ops::Deref for XTAL_LOAD_CAP_IEC_PF_X100_R {
83    type Target = crate::FieldReader<u16, u16>;
84    #[inline(always)]
85    fn deref(&self) -> &Self::Target {
86        &self.0
87    }
88}
89#[doc = "Field `XTAL_LOAD_CAP_IEC_PF_X100` writer - Load capacitance, pF x 100. For example, 6pF becomes 600."]
90pub struct XTAL_LOAD_CAP_IEC_PF_X100_W<'a> {
91    w: &'a mut W,
92}
93impl<'a> XTAL_LOAD_CAP_IEC_PF_X100_W<'a> {
94    #[doc = r"Writes raw bits to the field"]
95    #[inline(always)]
96    pub unsafe fn bits(self, value: u16) -> &'a mut W {
97        self.w.bits = (self.w.bits & !(0x03ff << 1)) | ((value as u32 & 0x03ff) << 1);
98        self.w
99    }
100}
101#[doc = "Field `PCB_XIN_PARA_CAP_PF_X100` reader - PCB XIN parasitic capacitance, pF x 100. For example, 6pF becomes 600."]
102pub struct PCB_XIN_PARA_CAP_PF_X100_R(crate::FieldReader<u16, u16>);
103impl PCB_XIN_PARA_CAP_PF_X100_R {
104    #[inline(always)]
105    pub(crate) fn new(bits: u16) -> Self {
106        PCB_XIN_PARA_CAP_PF_X100_R(crate::FieldReader::new(bits))
107    }
108}
109impl core::ops::Deref for PCB_XIN_PARA_CAP_PF_X100_R {
110    type Target = crate::FieldReader<u16, u16>;
111    #[inline(always)]
112    fn deref(&self) -> &Self::Target {
113        &self.0
114    }
115}
116#[doc = "Field `PCB_XIN_PARA_CAP_PF_X100` writer - PCB XIN parasitic capacitance, pF x 100. For example, 6pF becomes 600."]
117pub struct PCB_XIN_PARA_CAP_PF_X100_W<'a> {
118    w: &'a mut W,
119}
120impl<'a> PCB_XIN_PARA_CAP_PF_X100_W<'a> {
121    #[doc = r"Writes raw bits to the field"]
122    #[inline(always)]
123    pub unsafe fn bits(self, value: u16) -> &'a mut W {
124        self.w.bits = (self.w.bits & !(0x03ff << 11)) | ((value as u32 & 0x03ff) << 11);
125        self.w
126    }
127}
128#[doc = "Field `PCB_XOUT_PARA_CAP_PF_X100` reader - PCB XOUT parasitic capacitance, pF x 100. For example, 6pF becomes 600."]
129pub struct PCB_XOUT_PARA_CAP_PF_X100_R(crate::FieldReader<u16, u16>);
130impl PCB_XOUT_PARA_CAP_PF_X100_R {
131    #[inline(always)]
132    pub(crate) fn new(bits: u16) -> Self {
133        PCB_XOUT_PARA_CAP_PF_X100_R(crate::FieldReader::new(bits))
134    }
135}
136impl core::ops::Deref for PCB_XOUT_PARA_CAP_PF_X100_R {
137    type Target = crate::FieldReader<u16, u16>;
138    #[inline(always)]
139    fn deref(&self) -> &Self::Target {
140        &self.0
141    }
142}
143#[doc = "Field `PCB_XOUT_PARA_CAP_PF_X100` writer - PCB XOUT parasitic capacitance, pF x 100. For example, 6pF becomes 600."]
144pub struct PCB_XOUT_PARA_CAP_PF_X100_W<'a> {
145    w: &'a mut W,
146}
147impl<'a> PCB_XOUT_PARA_CAP_PF_X100_W<'a> {
148    #[doc = r"Writes raw bits to the field"]
149    #[inline(always)]
150    pub unsafe fn bits(self, value: u16) -> &'a mut W {
151        self.w.bits = (self.w.bits & !(0x03ff << 21)) | ((value as u32 & 0x03ff) << 21);
152        self.w
153    }
154}
155impl R {
156    #[doc = "Bit 0 - 0 : Capa Bank trimmings not valid. Default trimmings value are used. 1 : Capa Bank trimmings valid."]
157    #[inline(always)]
158    pub fn trim_valid(&self) -> TRIM_VALID_R {
159        TRIM_VALID_R::new((self.bits & 0x01) != 0)
160    }
161    #[doc = "Bits 1:10 - Load capacitance, pF x 100. For example, 6pF becomes 600."]
162    #[inline(always)]
163    pub fn xtal_load_cap_iec_pf_x100(&self) -> XTAL_LOAD_CAP_IEC_PF_X100_R {
164        XTAL_LOAD_CAP_IEC_PF_X100_R::new(((self.bits >> 1) & 0x03ff) as u16)
165    }
166    #[doc = "Bits 11:20 - PCB XIN parasitic capacitance, pF x 100. For example, 6pF becomes 600."]
167    #[inline(always)]
168    pub fn pcb_xin_para_cap_pf_x100(&self) -> PCB_XIN_PARA_CAP_PF_X100_R {
169        PCB_XIN_PARA_CAP_PF_X100_R::new(((self.bits >> 11) & 0x03ff) as u16)
170    }
171    #[doc = "Bits 21:30 - PCB XOUT parasitic capacitance, pF x 100. For example, 6pF becomes 600."]
172    #[inline(always)]
173    pub fn pcb_xout_para_cap_pf_x100(&self) -> PCB_XOUT_PARA_CAP_PF_X100_R {
174        PCB_XOUT_PARA_CAP_PF_X100_R::new(((self.bits >> 21) & 0x03ff) as u16)
175    }
176}
177impl W {
178    #[doc = "Bit 0 - 0 : Capa Bank trimmings not valid. Default trimmings value are used. 1 : Capa Bank trimmings valid."]
179    #[inline(always)]
180    pub fn trim_valid(&mut self) -> TRIM_VALID_W {
181        TRIM_VALID_W { w: self }
182    }
183    #[doc = "Bits 1:10 - Load capacitance, pF x 100. For example, 6pF becomes 600."]
184    #[inline(always)]
185    pub fn xtal_load_cap_iec_pf_x100(&mut self) -> XTAL_LOAD_CAP_IEC_PF_X100_W {
186        XTAL_LOAD_CAP_IEC_PF_X100_W { w: self }
187    }
188    #[doc = "Bits 11:20 - PCB XIN parasitic capacitance, pF x 100. For example, 6pF becomes 600."]
189    #[inline(always)]
190    pub fn pcb_xin_para_cap_pf_x100(&mut self) -> PCB_XIN_PARA_CAP_PF_X100_W {
191        PCB_XIN_PARA_CAP_PF_X100_W { w: self }
192    }
193    #[doc = "Bits 21:30 - PCB XOUT parasitic capacitance, pF x 100. For example, 6pF becomes 600."]
194    #[inline(always)]
195    pub fn pcb_xout_para_cap_pf_x100(&mut self) -> PCB_XOUT_PARA_CAP_PF_X100_W {
196        PCB_XOUT_PARA_CAP_PF_X100_W { w: self }
197    }
198    #[doc = "Writes raw bits to the register."]
199    #[inline(always)]
200    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
201        self.0.bits(bits);
202        self
203    }
204}
205#[doc = "Xtal 16MHz capabank triming.\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 [xtal_16mhz_capabank_trim](index.html) module"]
206pub struct XTAL_16MHZ_CAPABANK_TRIM_SPEC;
207impl crate::RegisterSpec for XTAL_16MHZ_CAPABANK_TRIM_SPEC {
208    type Ux = u32;
209}
210#[doc = "`read()` method returns [xtal_16mhz_capabank_trim::R](R) reader structure"]
211impl crate::Readable for XTAL_16MHZ_CAPABANK_TRIM_SPEC {
212    type Reader = R;
213}
214#[doc = "`write(|w| ..)` method takes [xtal_16mhz_capabank_trim::W](W) writer structure"]
215impl crate::Writable for XTAL_16MHZ_CAPABANK_TRIM_SPEC {
216    type Writer = W;
217}
218#[doc = "`reset()` method sets XTAL_16MHZ_CAPABANK_TRIM to value 0"]
219impl crate::Resettable for XTAL_16MHZ_CAPABANK_TRIM_SPEC {
220    #[inline(always)]
221    fn reset_value() -> Self::Ux {
222        0
223    }
224}