esp8266/spi1/
spi_user2.rs1#[doc = "Register `SPI_USER2` reader"]
2pub struct R(crate::R<SPI_USER2_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<SPI_USER2_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<SPI_USER2_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<SPI_USER2_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `SPI_USER2` writer"]
17pub struct W(crate::W<SPI_USER2_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<SPI_USER2_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_USER2_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<SPI_USER2_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `reg_usr_command_bitlen` reader - The length in bits of \"command\" phase. The register value shall be (bit_num-1)"]
38pub struct REG_USR_COMMAND_BITLEN_R(crate::FieldReader<u8, u8>);
39impl REG_USR_COMMAND_BITLEN_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: u8) -> Self {
42 REG_USR_COMMAND_BITLEN_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for REG_USR_COMMAND_BITLEN_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 `reg_usr_command_bitlen` writer - The length in bits of \"command\" phase. The register value shall be (bit_num-1)"]
53pub struct REG_USR_COMMAND_BITLEN_W<'a> {
54 w: &'a mut W,
55}
56impl<'a> REG_USR_COMMAND_BITLEN_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 & !(0x0f << 28)) | ((value as u32 & 0x0f) << 28);
61 self.w
62 }
63}
64#[doc = "Field `reg_usr_command_value` reader - The value of \"command\" phase"]
65pub struct REG_USR_COMMAND_VALUE_R(crate::FieldReader<u16, u16>);
66impl REG_USR_COMMAND_VALUE_R {
67 #[inline(always)]
68 pub(crate) fn new(bits: u16) -> Self {
69 REG_USR_COMMAND_VALUE_R(crate::FieldReader::new(bits))
70 }
71}
72impl core::ops::Deref for REG_USR_COMMAND_VALUE_R {
73 type Target = crate::FieldReader<u16, u16>;
74 #[inline(always)]
75 fn deref(&self) -> &Self::Target {
76 &self.0
77 }
78}
79#[doc = "Field `reg_usr_command_value` writer - The value of \"command\" phase"]
80pub struct REG_USR_COMMAND_VALUE_W<'a> {
81 w: &'a mut W,
82}
83impl<'a> REG_USR_COMMAND_VALUE_W<'a> {
84 #[doc = r"Writes raw bits to the field"]
85 #[inline(always)]
86 pub unsafe fn bits(self, value: u16) -> &'a mut W {
87 self.w.bits = (self.w.bits & !0xffff) | (value as u32 & 0xffff);
88 self.w
89 }
90}
91impl R {
92 #[doc = "Bits 28:31 - The length in bits of \"command\" phase. The register value shall be (bit_num-1)"]
93 #[inline(always)]
94 pub fn reg_usr_command_bitlen(&self) -> REG_USR_COMMAND_BITLEN_R {
95 REG_USR_COMMAND_BITLEN_R::new(((self.bits >> 28) & 0x0f) as u8)
96 }
97 #[doc = "Bits 0:15 - The value of \"command\" phase"]
98 #[inline(always)]
99 pub fn reg_usr_command_value(&self) -> REG_USR_COMMAND_VALUE_R {
100 REG_USR_COMMAND_VALUE_R::new((self.bits & 0xffff) as u16)
101 }
102}
103impl W {
104 #[doc = "Bits 28:31 - The length in bits of \"command\" phase. The register value shall be (bit_num-1)"]
105 #[inline(always)]
106 pub fn reg_usr_command_bitlen(&mut self) -> REG_USR_COMMAND_BITLEN_W {
107 REG_USR_COMMAND_BITLEN_W { w: self }
108 }
109 #[doc = "Bits 0:15 - The value of \"command\" phase"]
110 #[inline(always)]
111 pub fn reg_usr_command_value(&mut self) -> REG_USR_COMMAND_VALUE_W {
112 REG_USR_COMMAND_VALUE_W { w: self }
113 }
114 #[doc = "Writes raw bits to the register."]
115 #[inline(always)]
116 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
117 self.0.bits(bits);
118 self
119 }
120}
121#[doc = "The length in bits of \"command\" phase. The register value shall be (bit_num-1)\n\nThis register you can [`read`]
122(crate::generic::Reg::read), [`write_with_zero`]
123(crate::generic::Reg::write_with_zero), [`reset`]
124(crate::generic::Reg::reset), [`write`]
125(crate::generic::Reg::write), [`modify`]
126(crate::generic::Reg::modify). See [API]
127(https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [spi_user2]
128(index.html) module"]
129pub struct SPI_USER2_SPEC;
130impl crate::RegisterSpec for SPI_USER2_SPEC {
131 type Ux = u32;
132}
133#[doc = "`read()` method returns [spi_user2::R]
134(R) reader structure"]
135impl crate::Readable for SPI_USER2_SPEC {
136 type Reader = R;
137}
138#[doc = "`write(|w| ..)` method takes [spi_user2::W]
139(W) writer structure"]
140impl crate::Writable for SPI_USER2_SPEC {
141 type Writer = W;
142}
143#[doc = "`reset()` method sets SPI_USER2 to value 0"]
144impl crate::Resettable for SPI_USER2_SPEC {
145 #[inline(always)]
146 fn reset_value() -> Self::Ux {
147 0
148 }
149}