bl702_pac/qdec/
qdec_ctrl.rs1#[doc = "Register `qdec_ctrl` reader"]
2pub struct R(crate::R<QDEC_CTRL_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<QDEC_CTRL_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<QDEC_CTRL_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<QDEC_CTRL_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `qdec_ctrl` writer"]
17pub struct W(crate::W<QDEC_CTRL_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<QDEC_CTRL_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<QDEC_CTRL_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<QDEC_CTRL_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `qdec_en` reader - "]
38pub type QDEC_EN_R = crate::BitReader<bool>;
39#[doc = "Field `qdec_en` writer - "]
40pub type QDEC_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, QDEC_CTRL_SPEC, bool, O>;
41#[doc = "Field `led_en` reader - "]
42pub type LED_EN_R = crate::BitReader<bool>;
43#[doc = "Field `led_en` writer - "]
44pub type LED_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, QDEC_CTRL_SPEC, bool, O>;
45#[doc = "Field `led_pol` reader - "]
46pub type LED_POL_R = crate::BitReader<bool>;
47#[doc = "Field `led_pol` writer - "]
48pub type LED_POL_W<'a, const O: u8> = crate::BitWriter<'a, u32, QDEC_CTRL_SPEC, bool, O>;
49#[doc = "Field `deg_en` reader - "]
50pub type DEG_EN_R = crate::BitReader<bool>;
51#[doc = "Field `deg_en` writer - "]
52pub type DEG_EN_W<'a, const O: u8> = crate::BitWriter<'a, u32, QDEC_CTRL_SPEC, bool, O>;
53#[doc = "Field `deg_cnt` reader - "]
54pub type DEG_CNT_R = crate::FieldReader<u8, u8>;
55#[doc = "Field `deg_cnt` writer - "]
56pub type DEG_CNT_W<'a, const O: u8> = crate::FieldWriter<'a, u32, QDEC_CTRL_SPEC, u8, u8, 4, O>;
57#[doc = "Field `spl_period` reader - "]
58pub type SPL_PERIOD_R = crate::FieldReader<u8, u8>;
59#[doc = "Field `spl_period` writer - "]
60pub type SPL_PERIOD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, QDEC_CTRL_SPEC, u8, u8, 4, O>;
61#[doc = "Field `rpt_period` reader - "]
62pub type RPT_PERIOD_R = crate::FieldReader<u8, u8>;
63#[doc = "Field `rpt_period` writer - "]
64pub type RPT_PERIOD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, QDEC_CTRL_SPEC, u8, u8, 8, O>;
65#[doc = "Field `led_period` reader - "]
66pub type LED_PERIOD_R = crate::FieldReader<u16, u16>;
67#[doc = "Field `led_period` writer - "]
68pub type LED_PERIOD_W<'a, const O: u8> =
69 crate::FieldWriter<'a, u32, QDEC_CTRL_SPEC, u16, u16, 9, O>;
70#[doc = "Field `spl_mode` reader - "]
71pub type SPL_MODE_R = crate::BitReader<bool>;
72#[doc = "Field `spl_mode` writer - "]
73pub type SPL_MODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, QDEC_CTRL_SPEC, bool, O>;
74#[doc = "Field `rpt_mode` reader - "]
75pub type RPT_MODE_R = crate::BitReader<bool>;
76#[doc = "Field `rpt_mode` writer - "]
77pub type RPT_MODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, QDEC_CTRL_SPEC, bool, O>;
78#[doc = "Field `input_swap` reader - "]
79pub type INPUT_SWAP_R = crate::BitReader<bool>;
80#[doc = "Field `input_swap` writer - "]
81pub type INPUT_SWAP_W<'a, const O: u8> = crate::BitWriter<'a, u32, QDEC_CTRL_SPEC, bool, O>;
82impl R {
83 #[doc = "Bit 0"]
84 #[inline(always)]
85 pub fn qdec_en(&self) -> QDEC_EN_R {
86 QDEC_EN_R::new((self.bits & 1) != 0)
87 }
88 #[doc = "Bit 1"]
89 #[inline(always)]
90 pub fn led_en(&self) -> LED_EN_R {
91 LED_EN_R::new(((self.bits >> 1) & 1) != 0)
92 }
93 #[doc = "Bit 2"]
94 #[inline(always)]
95 pub fn led_pol(&self) -> LED_POL_R {
96 LED_POL_R::new(((self.bits >> 2) & 1) != 0)
97 }
98 #[doc = "Bit 3"]
99 #[inline(always)]
100 pub fn deg_en(&self) -> DEG_EN_R {
101 DEG_EN_R::new(((self.bits >> 3) & 1) != 0)
102 }
103 #[doc = "Bits 4:7"]
104 #[inline(always)]
105 pub fn deg_cnt(&self) -> DEG_CNT_R {
106 DEG_CNT_R::new(((self.bits >> 4) & 0x0f) as u8)
107 }
108 #[doc = "Bits 8:11"]
109 #[inline(always)]
110 pub fn spl_period(&self) -> SPL_PERIOD_R {
111 SPL_PERIOD_R::new(((self.bits >> 8) & 0x0f) as u8)
112 }
113 #[doc = "Bits 12:19"]
114 #[inline(always)]
115 pub fn rpt_period(&self) -> RPT_PERIOD_R {
116 RPT_PERIOD_R::new(((self.bits >> 12) & 0xff) as u8)
117 }
118 #[doc = "Bits 20:28"]
119 #[inline(always)]
120 pub fn led_period(&self) -> LED_PERIOD_R {
121 LED_PERIOD_R::new(((self.bits >> 20) & 0x01ff) as u16)
122 }
123 #[doc = "Bit 29"]
124 #[inline(always)]
125 pub fn spl_mode(&self) -> SPL_MODE_R {
126 SPL_MODE_R::new(((self.bits >> 29) & 1) != 0)
127 }
128 #[doc = "Bit 30"]
129 #[inline(always)]
130 pub fn rpt_mode(&self) -> RPT_MODE_R {
131 RPT_MODE_R::new(((self.bits >> 30) & 1) != 0)
132 }
133 #[doc = "Bit 31"]
134 #[inline(always)]
135 pub fn input_swap(&self) -> INPUT_SWAP_R {
136 INPUT_SWAP_R::new(((self.bits >> 31) & 1) != 0)
137 }
138}
139impl W {
140 #[doc = "Bit 0"]
141 #[inline(always)]
142 #[must_use]
143 pub fn qdec_en(&mut self) -> QDEC_EN_W<0> {
144 QDEC_EN_W::new(self)
145 }
146 #[doc = "Bit 1"]
147 #[inline(always)]
148 #[must_use]
149 pub fn led_en(&mut self) -> LED_EN_W<1> {
150 LED_EN_W::new(self)
151 }
152 #[doc = "Bit 2"]
153 #[inline(always)]
154 #[must_use]
155 pub fn led_pol(&mut self) -> LED_POL_W<2> {
156 LED_POL_W::new(self)
157 }
158 #[doc = "Bit 3"]
159 #[inline(always)]
160 #[must_use]
161 pub fn deg_en(&mut self) -> DEG_EN_W<3> {
162 DEG_EN_W::new(self)
163 }
164 #[doc = "Bits 4:7"]
165 #[inline(always)]
166 #[must_use]
167 pub fn deg_cnt(&mut self) -> DEG_CNT_W<4> {
168 DEG_CNT_W::new(self)
169 }
170 #[doc = "Bits 8:11"]
171 #[inline(always)]
172 #[must_use]
173 pub fn spl_period(&mut self) -> SPL_PERIOD_W<8> {
174 SPL_PERIOD_W::new(self)
175 }
176 #[doc = "Bits 12:19"]
177 #[inline(always)]
178 #[must_use]
179 pub fn rpt_period(&mut self) -> RPT_PERIOD_W<12> {
180 RPT_PERIOD_W::new(self)
181 }
182 #[doc = "Bits 20:28"]
183 #[inline(always)]
184 #[must_use]
185 pub fn led_period(&mut self) -> LED_PERIOD_W<20> {
186 LED_PERIOD_W::new(self)
187 }
188 #[doc = "Bit 29"]
189 #[inline(always)]
190 #[must_use]
191 pub fn spl_mode(&mut self) -> SPL_MODE_W<29> {
192 SPL_MODE_W::new(self)
193 }
194 #[doc = "Bit 30"]
195 #[inline(always)]
196 #[must_use]
197 pub fn rpt_mode(&mut self) -> RPT_MODE_W<30> {
198 RPT_MODE_W::new(self)
199 }
200 #[doc = "Bit 31"]
201 #[inline(always)]
202 #[must_use]
203 pub fn input_swap(&mut self) -> INPUT_SWAP_W<31> {
204 INPUT_SWAP_W::new(self)
205 }
206 #[doc = "Writes raw bits to the register."]
207 #[inline(always)]
208 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
209 self.0.bits(bits);
210 self
211 }
212}
213#[doc = "qdec_ctrl.\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 [qdec_ctrl](index.html) module"]
214pub struct QDEC_CTRL_SPEC;
215impl crate::RegisterSpec for QDEC_CTRL_SPEC {
216 type Ux = u32;
217}
218#[doc = "`read()` method returns [qdec_ctrl::R](R) reader structure"]
219impl crate::Readable for QDEC_CTRL_SPEC {
220 type Reader = R;
221}
222#[doc = "`write(|w| ..)` method takes [qdec_ctrl::W](W) writer structure"]
223impl crate::Writable for QDEC_CTRL_SPEC {
224 type Writer = W;
225 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
226 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
227}
228#[doc = "`reset()` method sets qdec_ctrl to value 0"]
229impl crate::Resettable for QDEC_CTRL_SPEC {
230 const RESET_VALUE: Self::Ux = 0;
231}