1#[doc = "Register `OSC_CTRL_3` reader"]
2pub struct R(crate::R<OSC_CTRL_3_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<OSC_CTRL_3_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<OSC_CTRL_3_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<OSC_CTRL_3_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `OSC_CTRL_3` writer"]
17pub struct W(crate::W<OSC_CTRL_3_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<OSC_CTRL_3_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<OSC_CTRL_3_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<OSC_CTRL_3_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `refok` reader - If 1'b1, will force the refok pin to 1, otherwise, it is control by the RTC/oscok"]
38pub struct REFOK_R(crate::FieldReader<bool, bool>);
39impl REFOK_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: bool) -> Self {
42 REFOK_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for REFOK_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 `refok` writer - If 1'b1, will force the refok pin to 1, otherwise, it is control by the RTC/oscok"]
53pub struct REFOK_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> REFOK_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 `enmon` reader - Turn on Monitor function by default"]
75pub struct ENMON_R(crate::FieldReader<bool, bool>);
76impl ENMON_R {
77 #[inline(always)]
78 pub(crate) fn new(bits: bool) -> Self {
79 ENMON_R(crate::FieldReader::new(bits))
80 }
81}
82impl core::ops::Deref for ENMON_R {
83 type Target = crate::FieldReader<bool, bool>;
84 #[inline(always)]
85 fn deref(&self) -> &Self::Target {
86 &self.0
87 }
88}
89#[doc = "Field `enmon` writer - Turn on Monitor function by default"]
90pub struct ENMON_W<'a> {
91 w: &'a mut W,
92}
93impl<'a> ENMON_W<'a> {
94 #[doc = r"Sets the field bit"]
95 #[inline(always)]
96 pub fn set_bit(self) -> &'a mut W {
97 self.bit(true)
98 }
99 #[doc = r"Clears the field bit"]
100 #[inline(always)]
101 pub fn clear_bit(self) -> &'a mut W {
102 self.bit(false)
103 }
104 #[doc = r"Writes raw bits to the field"]
105 #[inline(always)]
106 pub fn bit(self, value: bool) -> &'a mut W {
107 self.w.bits =
108 (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
109 self.w
110 }
111}
112#[doc = "Field `General_Purpos_SFR` reader - No description given"]
113pub struct GENERAL_PURPOS_SFR_R(crate::FieldReader<u8, u8>);
114impl GENERAL_PURPOS_SFR_R {
115 #[inline(always)]
116 pub(crate) fn new(bits: u8) -> Self {
117 GENERAL_PURPOS_SFR_R(crate::FieldReader::new(bits))
118 }
119}
120impl core::ops::Deref for GENERAL_PURPOS_SFR_R {
121 type Target = crate::FieldReader<u8, u8>;
122 #[inline(always)]
123 fn deref(&self) -> &Self::Target {
124 &self.0
125 }
126}
127#[doc = "Field `General_Purpos_SFR` writer - No description given"]
128pub struct GENERAL_PURPOS_SFR_W<'a> {
129 w: &'a mut W,
130}
131impl<'a> GENERAL_PURPOS_SFR_W<'a> {
132 #[doc = r"Writes raw bits to the field"]
133 #[inline(always)]
134 pub unsafe fn bits(self, value: u8) -> &'a mut W {
135 self.w.bits =
136 (self.w.bits & !(0x0f << 4)) | ((value as u32 & 0x0f) << 4);
137 self.w
138 }
139}
140impl R {
141 #[doc = "Bit 0 - If 1'b1, will force the refok pin to 1, otherwise, it is control by the RTC/oscok"]
142 #[inline(always)]
143 pub fn refok(&self) -> REFOK_R {
144 REFOK_R::new((self.bits & 0x01) != 0)
145 }
146 #[doc = "Bit 3 - Turn on Monitor function by default"]
147 #[inline(always)]
148 pub fn enmon(&self) -> ENMON_R {
149 ENMON_R::new(((self.bits >> 3) & 0x01) != 0)
150 }
151 #[doc = "Bits 4:7 - No description given"]
152 #[inline(always)]
153 pub fn general_purpos_sfr(&self) -> GENERAL_PURPOS_SFR_R {
154 GENERAL_PURPOS_SFR_R::new(((self.bits >> 4) & 0x0f) as u8)
155 }
156}
157impl W {
158 #[doc = "Bit 0 - If 1'b1, will force the refok pin to 1, otherwise, it is control by the RTC/oscok"]
159 #[inline(always)]
160 pub fn refok(&mut self) -> REFOK_W {
161 REFOK_W { w: self }
162 }
163 #[doc = "Bit 3 - Turn on Monitor function by default"]
164 #[inline(always)]
165 pub fn enmon(&mut self) -> ENMON_W {
166 ENMON_W { w: self }
167 }
168 #[doc = "Bits 4:7 - No description given"]
169 #[inline(always)]
170 pub fn general_purpos_sfr(&mut self) -> GENERAL_PURPOS_SFR_W {
171 GENERAL_PURPOS_SFR_W { w: self }
172 }
173 #[doc = "Writes raw bits to the register."]
174 #[inline(always)]
175 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
176 self.0.bits(bits);
177 self
178 }
179}
180#[doc = "Oscilator control register 3\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 [osc_ctrl_3](index.html) module"]
181pub struct OSC_CTRL_3_SPEC;
182impl crate::RegisterSpec for OSC_CTRL_3_SPEC {
183 type Ux = u32;
184}
185#[doc = "`read()` method returns [osc_ctrl_3::R](R) reader structure"]
186impl crate::Readable for OSC_CTRL_3_SPEC {
187 type Reader = R;
188}
189#[doc = "`write(|w| ..)` method takes [osc_ctrl_3::W](W) writer structure"]
190impl crate::Writable for OSC_CTRL_3_SPEC {
191 type Writer = W;
192}
193#[doc = "`reset()` method sets OSC_CTRL_3 to value 0x08"]
194impl crate::Resettable for OSC_CTRL_3_SPEC {
195 #[inline(always)]
196 fn reset_value() -> Self::Ux {
197 0x08
198 }
199}