esp8266/dport/
spi_cache_target.rs

1#[doc = "Register `SPI_CACHE_TARGET` reader"]
2pub struct R(crate::R<SPI_CACHE_TARGET_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SPI_CACHE_TARGET_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SPI_CACHE_TARGET_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SPI_CACHE_TARGET_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SPI_CACHE_TARGET` writer"]
17pub struct W(crate::W<SPI_CACHE_TARGET_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SPI_CACHE_TARGET_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<SPI_CACHE_TARGET_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SPI_CACHE_TARGET_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `target1` reader - "]
38pub struct TARGET1_R(crate::FieldReader<bool, bool>);
39impl TARGET1_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: bool) -> Self {
42        TARGET1_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for TARGET1_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 `target1` writer - "]
53pub struct TARGET1_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> TARGET1_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 & !(1 << 3)) | ((value as u32 & 1) << 3);
71        self.w
72    }
73}
74#[doc = "Field `target2` reader - "]
75pub struct TARGET2_R(crate::FieldReader<bool, bool>);
76impl TARGET2_R {
77    #[inline(always)]
78    pub(crate) fn new(bits: bool) -> Self {
79        TARGET2_R(crate::FieldReader::new(bits))
80    }
81}
82impl core::ops::Deref for TARGET2_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 `target2` writer - "]
90pub struct TARGET2_W<'a> {
91    w: &'a mut W,
92}
93impl<'a> TARGET2_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 = (self.w.bits & !(1 << 4)) | ((value as u32 & 1) << 4);
108        self.w
109    }
110}
111impl R {
112    #[doc = "Bit 3"]
113    #[inline(always)]
114    pub fn target1(&self) -> TARGET1_R {
115        TARGET1_R::new(((self.bits >> 3) & 1) != 0)
116    }
117    #[doc = "Bit 4"]
118    #[inline(always)]
119    pub fn target2(&self) -> TARGET2_R {
120        TARGET2_R::new(((self.bits >> 4) & 1) != 0)
121    }
122}
123impl W {
124    #[doc = "Bit 3"]
125    #[inline(always)]
126    pub fn target1(&mut self) -> TARGET1_W {
127        TARGET1_W { w: self }
128    }
129    #[doc = "Bit 4"]
130    #[inline(always)]
131    pub fn target2(&mut self) -> TARGET2_W {
132        TARGET2_W { w: self }
133    }
134    #[doc = "Writes raw bits to the register."]
135    #[inline(always)]
136    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
137        self.0.bits(bits);
138        self
139    }
140}
141#[doc = "Control where the cache is mapped (unconfirmed)\n\nThis register you can [`read`]
142(crate::generic::Reg::read), [`write_with_zero`]
143(crate::generic::Reg::write_with_zero), [`reset`]
144(crate::generic::Reg::reset), [`write`]
145(crate::generic::Reg::write), [`modify`]
146(crate::generic::Reg::modify). See [API]
147(https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [spi_cache_target]
148(index.html) module"]
149pub struct SPI_CACHE_TARGET_SPEC;
150impl crate::RegisterSpec for SPI_CACHE_TARGET_SPEC {
151    type Ux = u32;
152}
153#[doc = "`read()` method returns [spi_cache_target::R]
154(R) reader structure"]
155impl crate::Readable for SPI_CACHE_TARGET_SPEC {
156    type Reader = R;
157}
158#[doc = "`write(|w| ..)` method takes [spi_cache_target::W]
159(W) writer structure"]
160impl crate::Writable for SPI_CACHE_TARGET_SPEC {
161    type Writer = W;
162}
163#[doc = "`reset()` method sets SPI_CACHE_TARGET to value 0"]
164impl crate::Resettable for SPI_CACHE_TARGET_SPEC {
165    #[inline(always)]
166    fn reset_value() -> Self::Ux {
167        0
168    }
169}