lpc82x_pac/spi0/
txctl.rs

1#[doc = "Register `TXCTL` reader"]
2pub struct R(crate::R<TXCTL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<TXCTL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<TXCTL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<TXCTL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `TXCTL` writer"]
17pub struct W(crate::W<TXCTL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<TXCTL_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<TXCTL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<TXCTL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `TXSSEL0_N` reader - Transmit Slave Select 0."]
38pub struct TXSSEL0_N_R(crate::FieldReader<bool, bool>);
39impl TXSSEL0_N_R {
40    pub(crate) fn new(bits: bool) -> Self {
41        TXSSEL0_N_R(crate::FieldReader::new(bits))
42    }
43}
44impl core::ops::Deref for TXSSEL0_N_R {
45    type Target = crate::FieldReader<bool, bool>;
46    #[inline(always)]
47    fn deref(&self) -> &Self::Target {
48        &self.0
49    }
50}
51#[doc = "Field `TXSSEL0_N` writer - Transmit Slave Select 0."]
52pub struct TXSSEL0_N_W<'a> {
53    w: &'a mut W,
54}
55impl<'a> TXSSEL0_N_W<'a> {
56    #[doc = r"Sets the field bit"]
57    #[inline(always)]
58    pub fn set_bit(self) -> &'a mut W {
59        self.bit(true)
60    }
61    #[doc = r"Clears the field bit"]
62    #[inline(always)]
63    pub fn clear_bit(self) -> &'a mut W {
64        self.bit(false)
65    }
66    #[doc = r"Writes raw bits to the field"]
67    #[inline(always)]
68    pub fn bit(self, value: bool) -> &'a mut W {
69        self.w.bits = (self.w.bits & !(0x01 << 16)) | ((value as u32 & 0x01) << 16);
70        self.w
71    }
72}
73#[doc = "Field `TXSSEL1_N` reader - Transmit Slave Select 1."]
74pub struct TXSSEL1_N_R(crate::FieldReader<bool, bool>);
75impl TXSSEL1_N_R {
76    pub(crate) fn new(bits: bool) -> Self {
77        TXSSEL1_N_R(crate::FieldReader::new(bits))
78    }
79}
80impl core::ops::Deref for TXSSEL1_N_R {
81    type Target = crate::FieldReader<bool, bool>;
82    #[inline(always)]
83    fn deref(&self) -> &Self::Target {
84        &self.0
85    }
86}
87#[doc = "Field `TXSSEL1_N` writer - Transmit Slave Select 1."]
88pub struct TXSSEL1_N_W<'a> {
89    w: &'a mut W,
90}
91impl<'a> TXSSEL1_N_W<'a> {
92    #[doc = r"Sets the field bit"]
93    #[inline(always)]
94    pub fn set_bit(self) -> &'a mut W {
95        self.bit(true)
96    }
97    #[doc = r"Clears the field bit"]
98    #[inline(always)]
99    pub fn clear_bit(self) -> &'a mut W {
100        self.bit(false)
101    }
102    #[doc = r"Writes raw bits to the field"]
103    #[inline(always)]
104    pub fn bit(self, value: bool) -> &'a mut W {
105        self.w.bits = (self.w.bits & !(0x01 << 17)) | ((value as u32 & 0x01) << 17);
106        self.w
107    }
108}
109#[doc = "Field `TXSSEL2_N` reader - Transmit Slave Select 2."]
110pub struct TXSSEL2_N_R(crate::FieldReader<bool, bool>);
111impl TXSSEL2_N_R {
112    pub(crate) fn new(bits: bool) -> Self {
113        TXSSEL2_N_R(crate::FieldReader::new(bits))
114    }
115}
116impl core::ops::Deref for TXSSEL2_N_R {
117    type Target = crate::FieldReader<bool, bool>;
118    #[inline(always)]
119    fn deref(&self) -> &Self::Target {
120        &self.0
121    }
122}
123#[doc = "Field `TXSSEL2_N` writer - Transmit Slave Select 2."]
124pub struct TXSSEL2_N_W<'a> {
125    w: &'a mut W,
126}
127impl<'a> TXSSEL2_N_W<'a> {
128    #[doc = r"Sets the field bit"]
129    #[inline(always)]
130    pub fn set_bit(self) -> &'a mut W {
131        self.bit(true)
132    }
133    #[doc = r"Clears the field bit"]
134    #[inline(always)]
135    pub fn clear_bit(self) -> &'a mut W {
136        self.bit(false)
137    }
138    #[doc = r"Writes raw bits to the field"]
139    #[inline(always)]
140    pub fn bit(self, value: bool) -> &'a mut W {
141        self.w.bits = (self.w.bits & !(0x01 << 18)) | ((value as u32 & 0x01) << 18);
142        self.w
143    }
144}
145#[doc = "Field `TXSSEL3_N` reader - Transmit Slave Select 3."]
146pub struct TXSSEL3_N_R(crate::FieldReader<bool, bool>);
147impl TXSSEL3_N_R {
148    pub(crate) fn new(bits: bool) -> Self {
149        TXSSEL3_N_R(crate::FieldReader::new(bits))
150    }
151}
152impl core::ops::Deref for TXSSEL3_N_R {
153    type Target = crate::FieldReader<bool, bool>;
154    #[inline(always)]
155    fn deref(&self) -> &Self::Target {
156        &self.0
157    }
158}
159#[doc = "Field `TXSSEL3_N` writer - Transmit Slave Select 3."]
160pub struct TXSSEL3_N_W<'a> {
161    w: &'a mut W,
162}
163impl<'a> TXSSEL3_N_W<'a> {
164    #[doc = r"Sets the field bit"]
165    #[inline(always)]
166    pub fn set_bit(self) -> &'a mut W {
167        self.bit(true)
168    }
169    #[doc = r"Clears the field bit"]
170    #[inline(always)]
171    pub fn clear_bit(self) -> &'a mut W {
172        self.bit(false)
173    }
174    #[doc = r"Writes raw bits to the field"]
175    #[inline(always)]
176    pub fn bit(self, value: bool) -> &'a mut W {
177        self.w.bits = (self.w.bits & !(0x01 << 19)) | ((value as u32 & 0x01) << 19);
178        self.w
179    }
180}
181#[doc = "Field `EOT` reader - End of Transfer."]
182pub struct EOT_R(crate::FieldReader<bool, bool>);
183impl EOT_R {
184    pub(crate) fn new(bits: bool) -> Self {
185        EOT_R(crate::FieldReader::new(bits))
186    }
187}
188impl core::ops::Deref for EOT_R {
189    type Target = crate::FieldReader<bool, bool>;
190    #[inline(always)]
191    fn deref(&self) -> &Self::Target {
192        &self.0
193    }
194}
195#[doc = "Field `EOT` writer - End of Transfer."]
196pub struct EOT_W<'a> {
197    w: &'a mut W,
198}
199impl<'a> EOT_W<'a> {
200    #[doc = r"Sets the field bit"]
201    #[inline(always)]
202    pub fn set_bit(self) -> &'a mut W {
203        self.bit(true)
204    }
205    #[doc = r"Clears the field bit"]
206    #[inline(always)]
207    pub fn clear_bit(self) -> &'a mut W {
208        self.bit(false)
209    }
210    #[doc = r"Writes raw bits to the field"]
211    #[inline(always)]
212    pub fn bit(self, value: bool) -> &'a mut W {
213        self.w.bits = (self.w.bits & !(0x01 << 20)) | ((value as u32 & 0x01) << 20);
214        self.w
215    }
216}
217#[doc = "Field `EOF` reader - End of Frame."]
218pub struct EOF_R(crate::FieldReader<bool, bool>);
219impl EOF_R {
220    pub(crate) fn new(bits: bool) -> Self {
221        EOF_R(crate::FieldReader::new(bits))
222    }
223}
224impl core::ops::Deref for EOF_R {
225    type Target = crate::FieldReader<bool, bool>;
226    #[inline(always)]
227    fn deref(&self) -> &Self::Target {
228        &self.0
229    }
230}
231#[doc = "Field `EOF` writer - End of Frame."]
232pub struct EOF_W<'a> {
233    w: &'a mut W,
234}
235impl<'a> EOF_W<'a> {
236    #[doc = r"Sets the field bit"]
237    #[inline(always)]
238    pub fn set_bit(self) -> &'a mut W {
239        self.bit(true)
240    }
241    #[doc = r"Clears the field bit"]
242    #[inline(always)]
243    pub fn clear_bit(self) -> &'a mut W {
244        self.bit(false)
245    }
246    #[doc = r"Writes raw bits to the field"]
247    #[inline(always)]
248    pub fn bit(self, value: bool) -> &'a mut W {
249        self.w.bits = (self.w.bits & !(0x01 << 21)) | ((value as u32 & 0x01) << 21);
250        self.w
251    }
252}
253#[doc = "Field `RXIGNORE` reader - Receive Ignore."]
254pub struct RXIGNORE_R(crate::FieldReader<bool, bool>);
255impl RXIGNORE_R {
256    pub(crate) fn new(bits: bool) -> Self {
257        RXIGNORE_R(crate::FieldReader::new(bits))
258    }
259}
260impl core::ops::Deref for RXIGNORE_R {
261    type Target = crate::FieldReader<bool, bool>;
262    #[inline(always)]
263    fn deref(&self) -> &Self::Target {
264        &self.0
265    }
266}
267#[doc = "Field `RXIGNORE` writer - Receive Ignore."]
268pub struct RXIGNORE_W<'a> {
269    w: &'a mut W,
270}
271impl<'a> RXIGNORE_W<'a> {
272    #[doc = r"Sets the field bit"]
273    #[inline(always)]
274    pub fn set_bit(self) -> &'a mut W {
275        self.bit(true)
276    }
277    #[doc = r"Clears the field bit"]
278    #[inline(always)]
279    pub fn clear_bit(self) -> &'a mut W {
280        self.bit(false)
281    }
282    #[doc = r"Writes raw bits to the field"]
283    #[inline(always)]
284    pub fn bit(self, value: bool) -> &'a mut W {
285        self.w.bits = (self.w.bits & !(0x01 << 22)) | ((value as u32 & 0x01) << 22);
286        self.w
287    }
288}
289#[doc = "Field `LEN` reader - Data transfer Length."]
290pub struct LEN_R(crate::FieldReader<u8, u8>);
291impl LEN_R {
292    pub(crate) fn new(bits: u8) -> Self {
293        LEN_R(crate::FieldReader::new(bits))
294    }
295}
296impl core::ops::Deref for LEN_R {
297    type Target = crate::FieldReader<u8, u8>;
298    #[inline(always)]
299    fn deref(&self) -> &Self::Target {
300        &self.0
301    }
302}
303#[doc = "Field `LEN` writer - Data transfer Length."]
304pub struct LEN_W<'a> {
305    w: &'a mut W,
306}
307impl<'a> LEN_W<'a> {
308    #[doc = r"Writes raw bits to the field"]
309    #[inline(always)]
310    pub unsafe fn bits(self, value: u8) -> &'a mut W {
311        self.w.bits = (self.w.bits & !(0x0f << 24)) | ((value as u32 & 0x0f) << 24);
312        self.w
313    }
314}
315impl R {
316    #[doc = "Bit 16 - Transmit Slave Select 0."]
317    #[inline(always)]
318    pub fn txssel0_n(&self) -> TXSSEL0_N_R {
319        TXSSEL0_N_R::new(((self.bits >> 16) & 0x01) != 0)
320    }
321    #[doc = "Bit 17 - Transmit Slave Select 1."]
322    #[inline(always)]
323    pub fn txssel1_n(&self) -> TXSSEL1_N_R {
324        TXSSEL1_N_R::new(((self.bits >> 17) & 0x01) != 0)
325    }
326    #[doc = "Bit 18 - Transmit Slave Select 2."]
327    #[inline(always)]
328    pub fn txssel2_n(&self) -> TXSSEL2_N_R {
329        TXSSEL2_N_R::new(((self.bits >> 18) & 0x01) != 0)
330    }
331    #[doc = "Bit 19 - Transmit Slave Select 3."]
332    #[inline(always)]
333    pub fn txssel3_n(&self) -> TXSSEL3_N_R {
334        TXSSEL3_N_R::new(((self.bits >> 19) & 0x01) != 0)
335    }
336    #[doc = "Bit 20 - End of Transfer."]
337    #[inline(always)]
338    pub fn eot(&self) -> EOT_R {
339        EOT_R::new(((self.bits >> 20) & 0x01) != 0)
340    }
341    #[doc = "Bit 21 - End of Frame."]
342    #[inline(always)]
343    pub fn eof(&self) -> EOF_R {
344        EOF_R::new(((self.bits >> 21) & 0x01) != 0)
345    }
346    #[doc = "Bit 22 - Receive Ignore."]
347    #[inline(always)]
348    pub fn rxignore(&self) -> RXIGNORE_R {
349        RXIGNORE_R::new(((self.bits >> 22) & 0x01) != 0)
350    }
351    #[doc = "Bits 24:27 - Data transfer Length."]
352    #[inline(always)]
353    pub fn len(&self) -> LEN_R {
354        LEN_R::new(((self.bits >> 24) & 0x0f) as u8)
355    }
356}
357impl W {
358    #[doc = "Bit 16 - Transmit Slave Select 0."]
359    #[inline(always)]
360    pub fn txssel0_n(&mut self) -> TXSSEL0_N_W {
361        TXSSEL0_N_W { w: self }
362    }
363    #[doc = "Bit 17 - Transmit Slave Select 1."]
364    #[inline(always)]
365    pub fn txssel1_n(&mut self) -> TXSSEL1_N_W {
366        TXSSEL1_N_W { w: self }
367    }
368    #[doc = "Bit 18 - Transmit Slave Select 2."]
369    #[inline(always)]
370    pub fn txssel2_n(&mut self) -> TXSSEL2_N_W {
371        TXSSEL2_N_W { w: self }
372    }
373    #[doc = "Bit 19 - Transmit Slave Select 3."]
374    #[inline(always)]
375    pub fn txssel3_n(&mut self) -> TXSSEL3_N_W {
376        TXSSEL3_N_W { w: self }
377    }
378    #[doc = "Bit 20 - End of Transfer."]
379    #[inline(always)]
380    pub fn eot(&mut self) -> EOT_W {
381        EOT_W { w: self }
382    }
383    #[doc = "Bit 21 - End of Frame."]
384    #[inline(always)]
385    pub fn eof(&mut self) -> EOF_W {
386        EOF_W { w: self }
387    }
388    #[doc = "Bit 22 - Receive Ignore."]
389    #[inline(always)]
390    pub fn rxignore(&mut self) -> RXIGNORE_W {
391        RXIGNORE_W { w: self }
392    }
393    #[doc = "Bits 24:27 - Data transfer Length."]
394    #[inline(always)]
395    pub fn len(&mut self) -> LEN_W {
396        LEN_W { w: self }
397    }
398    #[doc = "Writes raw bits to the register."]
399    #[inline(always)]
400    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
401        self.0.bits(bits);
402        self
403    }
404}
405#[doc = "SPI Transmit Control\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 [txctl](index.html) module"]
406pub struct TXCTL_SPEC;
407impl crate::RegisterSpec for TXCTL_SPEC {
408    type Ux = u32;
409}
410#[doc = "`read()` method returns [txctl::R](R) reader structure"]
411impl crate::Readable for TXCTL_SPEC {
412    type Reader = R;
413}
414#[doc = "`write(|w| ..)` method takes [txctl::W](W) writer structure"]
415impl crate::Writable for TXCTL_SPEC {
416    type Writer = W;
417}
418#[doc = "`reset()` method sets TXCTL to value 0"]
419impl crate::Resettable for TXCTL_SPEC {
420    #[inline(always)]
421    fn reset_value() -> Self::Ux {
422        0
423    }
424}