esp8266/slc/
slc_token0.rs

1#[doc = "Register `SLC_TOKEN0` reader"]
2pub struct R(crate::R<SLC_TOKEN0_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SLC_TOKEN0_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SLC_TOKEN0_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SLC_TOKEN0_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SLC_TOKEN0` writer"]
17pub struct W(crate::W<SLC_TOKEN0_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SLC_TOKEN0_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<SLC_TOKEN0_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SLC_TOKEN0_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SLC_TOKEN0` reader - "]
38pub struct SLC_TOKEN0_R(crate::FieldReader<u16, u16>);
39impl SLC_TOKEN0_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: u16) -> Self {
42        SLC_TOKEN0_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for SLC_TOKEN0_R {
46    type Target = crate::FieldReader<u16, u16>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `SLC_TOKEN0` writer - "]
53pub struct SLC_TOKEN0_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> SLC_TOKEN0_W<'a> {
57    #[doc = r"Writes raw bits to the field"]
58    #[inline(always)]
59    pub unsafe fn bits(self, value: u16) -> &'a mut W {
60        self.w.bits = (self.w.bits & !(0x0fff << 16)) | ((value as u32 & 0x0fff) << 16);
61        self.w
62    }
63}
64#[doc = "Field `SLC_TOKEN0_LOCAL_INC_MORE` reader - "]
65pub struct SLC_TOKEN0_LOCAL_INC_MORE_R(crate::FieldReader<bool, bool>);
66impl SLC_TOKEN0_LOCAL_INC_MORE_R {
67    #[inline(always)]
68    pub(crate) fn new(bits: bool) -> Self {
69        SLC_TOKEN0_LOCAL_INC_MORE_R(crate::FieldReader::new(bits))
70    }
71}
72impl core::ops::Deref for SLC_TOKEN0_LOCAL_INC_MORE_R {
73    type Target = crate::FieldReader<bool, bool>;
74    #[inline(always)]
75    fn deref(&self) -> &Self::Target {
76        &self.0
77    }
78}
79#[doc = "Field `SLC_TOKEN0_LOCAL_INC_MORE` writer - "]
80pub struct SLC_TOKEN0_LOCAL_INC_MORE_W<'a> {
81    w: &'a mut W,
82}
83impl<'a> SLC_TOKEN0_LOCAL_INC_MORE_W<'a> {
84    #[doc = r"Sets the field bit"]
85    #[inline(always)]
86    pub fn set_bit(self) -> &'a mut W {
87        self.bit(true)
88    }
89    #[doc = r"Clears the field bit"]
90    #[inline(always)]
91    pub fn clear_bit(self) -> &'a mut W {
92        self.bit(false)
93    }
94    #[doc = r"Writes raw bits to the field"]
95    #[inline(always)]
96    pub fn bit(self, value: bool) -> &'a mut W {
97        self.w.bits = (self.w.bits & !(1 << 14)) | ((value as u32 & 1) << 14);
98        self.w
99    }
100}
101#[doc = "Field `SLC_TOKEN0_LOCAL_INC` reader - "]
102pub struct SLC_TOKEN0_LOCAL_INC_R(crate::FieldReader<bool, bool>);
103impl SLC_TOKEN0_LOCAL_INC_R {
104    #[inline(always)]
105    pub(crate) fn new(bits: bool) -> Self {
106        SLC_TOKEN0_LOCAL_INC_R(crate::FieldReader::new(bits))
107    }
108}
109impl core::ops::Deref for SLC_TOKEN0_LOCAL_INC_R {
110    type Target = crate::FieldReader<bool, bool>;
111    #[inline(always)]
112    fn deref(&self) -> &Self::Target {
113        &self.0
114    }
115}
116#[doc = "Field `SLC_TOKEN0_LOCAL_INC` writer - "]
117pub struct SLC_TOKEN0_LOCAL_INC_W<'a> {
118    w: &'a mut W,
119}
120impl<'a> SLC_TOKEN0_LOCAL_INC_W<'a> {
121    #[doc = r"Sets the field bit"]
122    #[inline(always)]
123    pub fn set_bit(self) -> &'a mut W {
124        self.bit(true)
125    }
126    #[doc = r"Clears the field bit"]
127    #[inline(always)]
128    pub fn clear_bit(self) -> &'a mut W {
129        self.bit(false)
130    }
131    #[doc = r"Writes raw bits to the field"]
132    #[inline(always)]
133    pub fn bit(self, value: bool) -> &'a mut W {
134        self.w.bits = (self.w.bits & !(1 << 13)) | ((value as u32 & 1) << 13);
135        self.w
136    }
137}
138#[doc = "Field `SLC_TOKEN0_LOCAL_WR` reader - "]
139pub struct SLC_TOKEN0_LOCAL_WR_R(crate::FieldReader<bool, bool>);
140impl SLC_TOKEN0_LOCAL_WR_R {
141    #[inline(always)]
142    pub(crate) fn new(bits: bool) -> Self {
143        SLC_TOKEN0_LOCAL_WR_R(crate::FieldReader::new(bits))
144    }
145}
146impl core::ops::Deref for SLC_TOKEN0_LOCAL_WR_R {
147    type Target = crate::FieldReader<bool, bool>;
148    #[inline(always)]
149    fn deref(&self) -> &Self::Target {
150        &self.0
151    }
152}
153#[doc = "Field `SLC_TOKEN0_LOCAL_WR` writer - "]
154pub struct SLC_TOKEN0_LOCAL_WR_W<'a> {
155    w: &'a mut W,
156}
157impl<'a> SLC_TOKEN0_LOCAL_WR_W<'a> {
158    #[doc = r"Sets the field bit"]
159    #[inline(always)]
160    pub fn set_bit(self) -> &'a mut W {
161        self.bit(true)
162    }
163    #[doc = r"Clears the field bit"]
164    #[inline(always)]
165    pub fn clear_bit(self) -> &'a mut W {
166        self.bit(false)
167    }
168    #[doc = r"Writes raw bits to the field"]
169    #[inline(always)]
170    pub fn bit(self, value: bool) -> &'a mut W {
171        self.w.bits = (self.w.bits & !(1 << 12)) | ((value as u32 & 1) << 12);
172        self.w
173    }
174}
175#[doc = "Field `SLC_TOKEN0_LOCAL_WDATA` reader - "]
176pub struct SLC_TOKEN0_LOCAL_WDATA_R(crate::FieldReader<u16, u16>);
177impl SLC_TOKEN0_LOCAL_WDATA_R {
178    #[inline(always)]
179    pub(crate) fn new(bits: u16) -> Self {
180        SLC_TOKEN0_LOCAL_WDATA_R(crate::FieldReader::new(bits))
181    }
182}
183impl core::ops::Deref for SLC_TOKEN0_LOCAL_WDATA_R {
184    type Target = crate::FieldReader<u16, u16>;
185    #[inline(always)]
186    fn deref(&self) -> &Self::Target {
187        &self.0
188    }
189}
190#[doc = "Field `SLC_TOKEN0_LOCAL_WDATA` writer - "]
191pub struct SLC_TOKEN0_LOCAL_WDATA_W<'a> {
192    w: &'a mut W,
193}
194impl<'a> SLC_TOKEN0_LOCAL_WDATA_W<'a> {
195    #[doc = r"Writes raw bits to the field"]
196    #[inline(always)]
197    pub unsafe fn bits(self, value: u16) -> &'a mut W {
198        self.w.bits = (self.w.bits & !0x0fff) | (value as u32 & 0x0fff);
199        self.w
200    }
201}
202impl R {
203    #[doc = "Bits 16:27"]
204    #[inline(always)]
205    pub fn slc_token0(&self) -> SLC_TOKEN0_R {
206        SLC_TOKEN0_R::new(((self.bits >> 16) & 0x0fff) as u16)
207    }
208    #[doc = "Bit 14"]
209    #[inline(always)]
210    pub fn slc_token0_local_inc_more(&self) -> SLC_TOKEN0_LOCAL_INC_MORE_R {
211        SLC_TOKEN0_LOCAL_INC_MORE_R::new(((self.bits >> 14) & 1) != 0)
212    }
213    #[doc = "Bit 13"]
214    #[inline(always)]
215    pub fn slc_token0_local_inc(&self) -> SLC_TOKEN0_LOCAL_INC_R {
216        SLC_TOKEN0_LOCAL_INC_R::new(((self.bits >> 13) & 1) != 0)
217    }
218    #[doc = "Bit 12"]
219    #[inline(always)]
220    pub fn slc_token0_local_wr(&self) -> SLC_TOKEN0_LOCAL_WR_R {
221        SLC_TOKEN0_LOCAL_WR_R::new(((self.bits >> 12) & 1) != 0)
222    }
223    #[doc = "Bits 0:11"]
224    #[inline(always)]
225    pub fn slc_token0_local_wdata(&self) -> SLC_TOKEN0_LOCAL_WDATA_R {
226        SLC_TOKEN0_LOCAL_WDATA_R::new((self.bits & 0x0fff) as u16)
227    }
228}
229impl W {
230    #[doc = "Bits 16:27"]
231    #[inline(always)]
232    pub fn slc_token0(&mut self) -> SLC_TOKEN0_W {
233        SLC_TOKEN0_W { w: self }
234    }
235    #[doc = "Bit 14"]
236    #[inline(always)]
237    pub fn slc_token0_local_inc_more(&mut self) -> SLC_TOKEN0_LOCAL_INC_MORE_W {
238        SLC_TOKEN0_LOCAL_INC_MORE_W { w: self }
239    }
240    #[doc = "Bit 13"]
241    #[inline(always)]
242    pub fn slc_token0_local_inc(&mut self) -> SLC_TOKEN0_LOCAL_INC_W {
243        SLC_TOKEN0_LOCAL_INC_W { w: self }
244    }
245    #[doc = "Bit 12"]
246    #[inline(always)]
247    pub fn slc_token0_local_wr(&mut self) -> SLC_TOKEN0_LOCAL_WR_W {
248        SLC_TOKEN0_LOCAL_WR_W { w: self }
249    }
250    #[doc = "Bits 0:11"]
251    #[inline(always)]
252    pub fn slc_token0_local_wdata(&mut self) -> SLC_TOKEN0_LOCAL_WDATA_W {
253        SLC_TOKEN0_LOCAL_WDATA_W { w: self }
254    }
255    #[doc = "Writes raw bits to the register."]
256    #[inline(always)]
257    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
258        self.0.bits(bits);
259        self
260    }
261}
262#[doc = "SLC_TOKEN0\n\nThis register you can [`read`]
263(crate::generic::Reg::read), [`write_with_zero`]
264(crate::generic::Reg::write_with_zero), [`reset`]
265(crate::generic::Reg::reset), [`write`]
266(crate::generic::Reg::write), [`modify`]
267(crate::generic::Reg::modify). See [API]
268(https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [slc_token0]
269(index.html) module"]
270pub struct SLC_TOKEN0_SPEC;
271impl crate::RegisterSpec for SLC_TOKEN0_SPEC {
272    type Ux = u32;
273}
274#[doc = "`read()` method returns [slc_token0::R]
275(R) reader structure"]
276impl crate::Readable for SLC_TOKEN0_SPEC {
277    type Reader = R;
278}
279#[doc = "`write(|w| ..)` method takes [slc_token0::W]
280(W) writer structure"]
281impl crate::Writable for SLC_TOKEN0_SPEC {
282    type Writer = W;
283}
284#[doc = "`reset()` method sets SLC_TOKEN0 to value 0"]
285impl crate::Resettable for SLC_TOKEN0_SPEC {
286    #[inline(always)]
287    fn reset_value() -> Self::Ux {
288        0
289    }
290}