1#[doc = "Register `OSC_CTRL_4` reader"]
2pub struct R(crate::R<OSC_CTRL_4_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<OSC_CTRL_4_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<OSC_CTRL_4_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<OSC_CTRL_4_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `OSC_CTRL_4` writer"]
17pub struct W(crate::W<OSC_CTRL_4_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<OSC_CTRL_4_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_4_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<OSC_CTRL_4_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `test` reader - Please refer to the Technical Reference Manual for detail"]
38pub struct TEST_R(crate::FieldReader<u8, u8>);
39impl TEST_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: u8) -> Self {
42 TEST_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for TEST_R {
46 type Target = crate::FieldReader<u8, u8>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `test` writer - Please refer to the Technical Reference Manual for detail"]
53pub struct TEST_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> TEST_W<'a> {
57 #[doc = r"Writes raw bits to the field"]
58 #[inline(always)]
59 pub unsafe fn bits(self, value: u8) -> &'a mut W {
60 self.w.bits = (self.w.bits & !0x07) | (value as u32 & 0x07);
61 self.w
62 }
63}
64#[doc = "Field `ce` reader - Please refer to the Technical Reference Manual for detail"]
65pub struct CE_R(crate::FieldReader<u8, u8>);
66impl CE_R {
67 #[inline(always)]
68 pub(crate) fn new(bits: u8) -> Self {
69 CE_R(crate::FieldReader::new(bits))
70 }
71}
72impl core::ops::Deref for CE_R {
73 type Target = crate::FieldReader<u8, u8>;
74 #[inline(always)]
75 fn deref(&self) -> &Self::Target {
76 &self.0
77 }
78}
79#[doc = "Field `ce` writer - Please refer to the Technical Reference Manual for detail"]
80pub struct CE_W<'a> {
81 w: &'a mut W,
82}
83impl<'a> CE_W<'a> {
84 #[doc = r"Writes raw bits to the field"]
85 #[inline(always)]
86 pub unsafe fn bits(self, value: u8) -> &'a mut W {
87 self.w.bits =
88 (self.w.bits & !(0x03 << 3)) | ((value as u32 & 0x03) << 3);
89 self.w
90 }
91}
92#[doc = "Field `wr` reader - Please refer to the Technical Reference Manual for detail"]
93pub struct WR_R(crate::FieldReader<bool, bool>);
94impl WR_R {
95 #[inline(always)]
96 pub(crate) fn new(bits: bool) -> Self {
97 WR_R(crate::FieldReader::new(bits))
98 }
99}
100impl core::ops::Deref for WR_R {
101 type Target = crate::FieldReader<bool, bool>;
102 #[inline(always)]
103 fn deref(&self) -> &Self::Target {
104 &self.0
105 }
106}
107#[doc = "Field `wr` writer - Please refer to the Technical Reference Manual for detail"]
108pub struct WR_W<'a> {
109 w: &'a mut W,
110}
111impl<'a> WR_W<'a> {
112 #[doc = r"Sets the field bit"]
113 #[inline(always)]
114 pub fn set_bit(self) -> &'a mut W {
115 self.bit(true)
116 }
117 #[doc = r"Clears the field bit"]
118 #[inline(always)]
119 pub fn clear_bit(self) -> &'a mut W {
120 self.bit(false)
121 }
122 #[doc = r"Writes raw bits to the field"]
123 #[inline(always)]
124 pub fn bit(self, value: bool) -> &'a mut W {
125 self.w.bits =
126 (self.w.bits & !(0x01 << 5)) | ((value as u32 & 0x01) << 5);
127 self.w
128 }
129}
130impl R {
131 #[doc = "Bits 0:2 - Please refer to the Technical Reference Manual for detail"]
132 #[inline(always)]
133 pub fn test(&self) -> TEST_R {
134 TEST_R::new((self.bits & 0x07) as u8)
135 }
136 #[doc = "Bits 3:4 - Please refer to the Technical Reference Manual for detail"]
137 #[inline(always)]
138 pub fn ce(&self) -> CE_R {
139 CE_R::new(((self.bits >> 3) & 0x03) as u8)
140 }
141 #[doc = "Bit 5 - Please refer to the Technical Reference Manual for detail"]
142 #[inline(always)]
143 pub fn wr(&self) -> WR_R {
144 WR_R::new(((self.bits >> 5) & 0x01) != 0)
145 }
146}
147impl W {
148 #[doc = "Bits 0:2 - Please refer to the Technical Reference Manual for detail"]
149 #[inline(always)]
150 pub fn test(&mut self) -> TEST_W {
151 TEST_W { w: self }
152 }
153 #[doc = "Bits 3:4 - Please refer to the Technical Reference Manual for detail"]
154 #[inline(always)]
155 pub fn ce(&mut self) -> CE_W {
156 CE_W { w: self }
157 }
158 #[doc = "Bit 5 - Please refer to the Technical Reference Manual for detail"]
159 #[inline(always)]
160 pub fn wr(&mut self) -> WR_W {
161 WR_W { w: self }
162 }
163 #[doc = "Writes raw bits to the register."]
164 #[inline(always)]
165 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
166 self.0.bits(bits);
167 self
168 }
169}
170#[doc = "Oscilator control register 4\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_4](index.html) module"]
171pub struct OSC_CTRL_4_SPEC;
172impl crate::RegisterSpec for OSC_CTRL_4_SPEC {
173 type Ux = u32;
174}
175#[doc = "`read()` method returns [osc_ctrl_4::R](R) reader structure"]
176impl crate::Readable for OSC_CTRL_4_SPEC {
177 type Reader = R;
178}
179#[doc = "`write(|w| ..)` method takes [osc_ctrl_4::W](W) writer structure"]
180impl crate::Writable for OSC_CTRL_4_SPEC {
181 type Writer = W;
182}
183#[doc = "`reset()` method sets OSC_CTRL_4 to value 0"]
184impl crate::Resettable for OSC_CTRL_4_SPEC {
185 #[inline(always)]
186 fn reset_value() -> Self::Ux {
187 0
188 }
189}