Skip to main content

atsamv71n21/qspi/
qspi_cr.rs

1#[doc = "Register `QSPI_CR` writer"]
2pub struct W(crate::W<QSPI_CR_SPEC>);
3impl core::ops::Deref for W {
4    type Target = crate::W<QSPI_CR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl core::ops::DerefMut for W {
11    #[inline(always)]
12    fn deref_mut(&mut self) -> &mut Self::Target {
13        &mut self.0
14    }
15}
16impl From<crate::W<QSPI_CR_SPEC>> for W {
17    #[inline(always)]
18    fn from(writer: crate::W<QSPI_CR_SPEC>) -> Self {
19        W(writer)
20    }
21}
22#[doc = "Field `QSPIEN` writer - QSPI Enable"]
23pub struct QSPIEN_W<'a> {
24    w: &'a mut W,
25}
26impl<'a> QSPIEN_W<'a> {
27    #[doc = r"Sets the field bit"]
28    #[inline(always)]
29    pub fn set_bit(self) -> &'a mut W {
30        self.bit(true)
31    }
32    #[doc = r"Clears the field bit"]
33    #[inline(always)]
34    pub fn clear_bit(self) -> &'a mut W {
35        self.bit(false)
36    }
37    #[doc = r"Writes raw bits to the field"]
38    #[inline(always)]
39    pub fn bit(self, value: bool) -> &'a mut W {
40        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
41        self.w
42    }
43}
44#[doc = "Field `QSPIDIS` writer - QSPI Disable"]
45pub struct QSPIDIS_W<'a> {
46    w: &'a mut W,
47}
48impl<'a> QSPIDIS_W<'a> {
49    #[doc = r"Sets the field bit"]
50    #[inline(always)]
51    pub fn set_bit(self) -> &'a mut W {
52        self.bit(true)
53    }
54    #[doc = r"Clears the field bit"]
55    #[inline(always)]
56    pub fn clear_bit(self) -> &'a mut W {
57        self.bit(false)
58    }
59    #[doc = r"Writes raw bits to the field"]
60    #[inline(always)]
61    pub fn bit(self, value: bool) -> &'a mut W {
62        self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
63        self.w
64    }
65}
66#[doc = "Field `SWRST` writer - QSPI Software Reset"]
67pub struct SWRST_W<'a> {
68    w: &'a mut W,
69}
70impl<'a> SWRST_W<'a> {
71    #[doc = r"Sets the field bit"]
72    #[inline(always)]
73    pub fn set_bit(self) -> &'a mut W {
74        self.bit(true)
75    }
76    #[doc = r"Clears the field bit"]
77    #[inline(always)]
78    pub fn clear_bit(self) -> &'a mut W {
79        self.bit(false)
80    }
81    #[doc = r"Writes raw bits to the field"]
82    #[inline(always)]
83    pub fn bit(self, value: bool) -> &'a mut W {
84        self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
85        self.w
86    }
87}
88#[doc = "Field `LASTXFER` writer - Last Transfer"]
89pub struct LASTXFER_W<'a> {
90    w: &'a mut W,
91}
92impl<'a> LASTXFER_W<'a> {
93    #[doc = r"Sets the field bit"]
94    #[inline(always)]
95    pub fn set_bit(self) -> &'a mut W {
96        self.bit(true)
97    }
98    #[doc = r"Clears the field bit"]
99    #[inline(always)]
100    pub fn clear_bit(self) -> &'a mut W {
101        self.bit(false)
102    }
103    #[doc = r"Writes raw bits to the field"]
104    #[inline(always)]
105    pub fn bit(self, value: bool) -> &'a mut W {
106        self.w.bits = (self.w.bits & !(0x01 << 24)) | ((value as u32 & 0x01) << 24);
107        self.w
108    }
109}
110impl W {
111    #[doc = "Bit 0 - QSPI Enable"]
112    #[inline(always)]
113    pub fn qspien(&mut self) -> QSPIEN_W {
114        QSPIEN_W { w: self }
115    }
116    #[doc = "Bit 1 - QSPI Disable"]
117    #[inline(always)]
118    pub fn qspidis(&mut self) -> QSPIDIS_W {
119        QSPIDIS_W { w: self }
120    }
121    #[doc = "Bit 7 - QSPI Software Reset"]
122    #[inline(always)]
123    pub fn swrst(&mut self) -> SWRST_W {
124        SWRST_W { w: self }
125    }
126    #[doc = "Bit 24 - Last Transfer"]
127    #[inline(always)]
128    pub fn lastxfer(&mut self) -> LASTXFER_W {
129        LASTXFER_W { w: self }
130    }
131    #[doc = "Writes raw bits to the register."]
132    #[inline(always)]
133    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
134        self.0.bits(bits);
135        self
136    }
137}
138#[doc = "Control Register\n\nThis register you can [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [qspi_cr](index.html) module"]
139pub struct QSPI_CR_SPEC;
140impl crate::RegisterSpec for QSPI_CR_SPEC {
141    type Ux = u32;
142}
143#[doc = "`write(|w| ..)` method takes [qspi_cr::W](W) writer structure"]
144impl crate::Writable for QSPI_CR_SPEC {
145    type Writer = W;
146}
147#[doc = "`reset()` method sets QSPI_CR to value 0"]
148impl crate::Resettable for QSPI_CR_SPEC {
149    #[inline(always)]
150    fn reset_value() -> Self::Ux {
151        0
152    }
153}