ra6t1/spi0/
spscr.rs

1#[doc = "Register `SPSCR` reader"]
2pub struct R(crate::R<SPSCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SPSCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SPSCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SPSCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SPSCR` writer"]
17pub struct W(crate::W<SPSCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SPSCR_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<SPSCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SPSCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SPSLN` reader - RSPI Sequence Length SpecificationThe order in which the SPCMD0 to SPCMD07 registers are to be referenced is changed in accordance with the sequence length that is set in these bits. The relationship among the setting of these bits, sequence length, and SPCMD0 to SPCMD7 registers referenced by the RSPI is shown above. However, the RSPI in slave mode always references SPCMD0."]
38pub type SPSLN_R = crate::FieldReader<u8, SPSLN_A>;
39#[doc = "RSPI Sequence Length SpecificationThe order in which the SPCMD0 to SPCMD07 registers are to be referenced is changed in accordance with the sequence length that is set in these bits. The relationship among the setting of these bits, sequence length, and SPCMD0 to SPCMD7 registers referenced by the RSPI is shown above. However, the RSPI in slave mode always references SPCMD0.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum SPSLN_A {
43    #[doc = "0: Length 1 SPDMDx x = 0->0->..."]
44    _000 = 0,
45    #[doc = "1: Length 2 SPDMDx x = 0->1->0->..."]
46    _001 = 1,
47    #[doc = "2: Length 3 SPDMDx x = 0->1->2->0->..."]
48    _010 = 2,
49    #[doc = "3: Length 4 SPDMDx x = 0->1->2->3->0->..."]
50    _011 = 3,
51    #[doc = "4: Length 5 SPDMDx x = 0->1->2->3->4->0->..."]
52    _100 = 4,
53    #[doc = "5: Length 6 SPDMDx x = 0->1->2->3->4->5->0->..."]
54    _101 = 5,
55    #[doc = "6: Length 7 SPDMDx x = 0->1->2->3->4->5->6->0->..."]
56    _110 = 6,
57    #[doc = "7: Length 8 SPDMDx x = 0->1->2->3->4->5->6->7->0->..."]
58    _111 = 7,
59}
60impl From<SPSLN_A> for u8 {
61    #[inline(always)]
62    fn from(variant: SPSLN_A) -> Self {
63        variant as _
64    }
65}
66impl SPSLN_R {
67    #[doc = "Get enumerated values variant"]
68    #[inline(always)]
69    pub fn variant(&self) -> SPSLN_A {
70        match self.bits {
71            0 => SPSLN_A::_000,
72            1 => SPSLN_A::_001,
73            2 => SPSLN_A::_010,
74            3 => SPSLN_A::_011,
75            4 => SPSLN_A::_100,
76            5 => SPSLN_A::_101,
77            6 => SPSLN_A::_110,
78            7 => SPSLN_A::_111,
79            _ => unreachable!(),
80        }
81    }
82    #[doc = "Checks if the value of the field is `_000`"]
83    #[inline(always)]
84    pub fn is_000(&self) -> bool {
85        *self == SPSLN_A::_000
86    }
87    #[doc = "Checks if the value of the field is `_001`"]
88    #[inline(always)]
89    pub fn is_001(&self) -> bool {
90        *self == SPSLN_A::_001
91    }
92    #[doc = "Checks if the value of the field is `_010`"]
93    #[inline(always)]
94    pub fn is_010(&self) -> bool {
95        *self == SPSLN_A::_010
96    }
97    #[doc = "Checks if the value of the field is `_011`"]
98    #[inline(always)]
99    pub fn is_011(&self) -> bool {
100        *self == SPSLN_A::_011
101    }
102    #[doc = "Checks if the value of the field is `_100`"]
103    #[inline(always)]
104    pub fn is_100(&self) -> bool {
105        *self == SPSLN_A::_100
106    }
107    #[doc = "Checks if the value of the field is `_101`"]
108    #[inline(always)]
109    pub fn is_101(&self) -> bool {
110        *self == SPSLN_A::_101
111    }
112    #[doc = "Checks if the value of the field is `_110`"]
113    #[inline(always)]
114    pub fn is_110(&self) -> bool {
115        *self == SPSLN_A::_110
116    }
117    #[doc = "Checks if the value of the field is `_111`"]
118    #[inline(always)]
119    pub fn is_111(&self) -> bool {
120        *self == SPSLN_A::_111
121    }
122}
123#[doc = "Field `SPSLN` writer - RSPI Sequence Length SpecificationThe order in which the SPCMD0 to SPCMD07 registers are to be referenced is changed in accordance with the sequence length that is set in these bits. The relationship among the setting of these bits, sequence length, and SPCMD0 to SPCMD7 registers referenced by the RSPI is shown above. However, the RSPI in slave mode always references SPCMD0."]
124pub type SPSLN_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, SPSCR_SPEC, u8, SPSLN_A, 3, O>;
125impl<'a, const O: u8> SPSLN_W<'a, O> {
126    #[doc = "Length 1 SPDMDx x = 0->0->..."]
127    #[inline(always)]
128    pub fn _000(self) -> &'a mut W {
129        self.variant(SPSLN_A::_000)
130    }
131    #[doc = "Length 2 SPDMDx x = 0->1->0->..."]
132    #[inline(always)]
133    pub fn _001(self) -> &'a mut W {
134        self.variant(SPSLN_A::_001)
135    }
136    #[doc = "Length 3 SPDMDx x = 0->1->2->0->..."]
137    #[inline(always)]
138    pub fn _010(self) -> &'a mut W {
139        self.variant(SPSLN_A::_010)
140    }
141    #[doc = "Length 4 SPDMDx x = 0->1->2->3->0->..."]
142    #[inline(always)]
143    pub fn _011(self) -> &'a mut W {
144        self.variant(SPSLN_A::_011)
145    }
146    #[doc = "Length 5 SPDMDx x = 0->1->2->3->4->0->..."]
147    #[inline(always)]
148    pub fn _100(self) -> &'a mut W {
149        self.variant(SPSLN_A::_100)
150    }
151    #[doc = "Length 6 SPDMDx x = 0->1->2->3->4->5->0->..."]
152    #[inline(always)]
153    pub fn _101(self) -> &'a mut W {
154        self.variant(SPSLN_A::_101)
155    }
156    #[doc = "Length 7 SPDMDx x = 0->1->2->3->4->5->6->0->..."]
157    #[inline(always)]
158    pub fn _110(self) -> &'a mut W {
159        self.variant(SPSLN_A::_110)
160    }
161    #[doc = "Length 8 SPDMDx x = 0->1->2->3->4->5->6->7->0->..."]
162    #[inline(always)]
163    pub fn _111(self) -> &'a mut W {
164        self.variant(SPSLN_A::_111)
165    }
166}
167impl R {
168    #[doc = "Bits 0:2 - RSPI Sequence Length SpecificationThe order in which the SPCMD0 to SPCMD07 registers are to be referenced is changed in accordance with the sequence length that is set in these bits. The relationship among the setting of these bits, sequence length, and SPCMD0 to SPCMD7 registers referenced by the RSPI is shown above. However, the RSPI in slave mode always references SPCMD0."]
169    #[inline(always)]
170    pub fn spsln(&self) -> SPSLN_R {
171        SPSLN_R::new(self.bits & 7)
172    }
173}
174impl W {
175    #[doc = "Bits 0:2 - RSPI Sequence Length SpecificationThe order in which the SPCMD0 to SPCMD07 registers are to be referenced is changed in accordance with the sequence length that is set in these bits. The relationship among the setting of these bits, sequence length, and SPCMD0 to SPCMD7 registers referenced by the RSPI is shown above. However, the RSPI in slave mode always references SPCMD0."]
176    #[inline(always)]
177    #[must_use]
178    pub fn spsln(&mut self) -> SPSLN_W<0> {
179        SPSLN_W::new(self)
180    }
181    #[doc = "Writes raw bits to the register."]
182    #[inline(always)]
183    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
184        self.0.bits(bits);
185        self
186    }
187}
188#[doc = "SPI Sequence Control Register\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 [spscr](index.html) module"]
189pub struct SPSCR_SPEC;
190impl crate::RegisterSpec for SPSCR_SPEC {
191    type Ux = u8;
192}
193#[doc = "`read()` method returns [spscr::R](R) reader structure"]
194impl crate::Readable for SPSCR_SPEC {
195    type Reader = R;
196}
197#[doc = "`write(|w| ..)` method takes [spscr::W](W) writer structure"]
198impl crate::Writable for SPSCR_SPEC {
199    type Writer = W;
200    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
201    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
202}
203#[doc = "`reset()` method sets SPSCR to value 0"]
204impl crate::Resettable for SPSCR_SPEC {
205    const RESET_VALUE: Self::Ux = 0;
206}