ra6m3/glcdc/
out_pdtha.rs

1#[doc = "Register `OUT_PDTHA` reader"]
2pub struct R(crate::R<OUT_PDTHA_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<OUT_PDTHA_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<OUT_PDTHA_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<OUT_PDTHA_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `OUT_PDTHA` writer"]
17pub struct W(crate::W<OUT_PDTHA_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<OUT_PDTHA_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<OUT_PDTHA_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<OUT_PDTHA_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `PD` reader - Pattern value (D) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
38pub type PD_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `PD` writer - Pattern value (D) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
40pub type PD_W<'a, const O: u8> = crate::FieldWriter<'a, u32, OUT_PDTHA_SPEC, u8, u8, 2, O>;
41#[doc = "Field `PC` reader - Pattern value (C) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
42pub type PC_R = crate::FieldReader<u8, u8>;
43#[doc = "Field `PC` writer - Pattern value (C) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
44pub type PC_W<'a, const O: u8> = crate::FieldWriter<'a, u32, OUT_PDTHA_SPEC, u8, u8, 2, O>;
45#[doc = "Field `PB` reader - Pattern value (B) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
46pub type PB_R = crate::FieldReader<u8, u8>;
47#[doc = "Field `PB` writer - Pattern value (B) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
48pub type PB_W<'a, const O: u8> = crate::FieldWriter<'a, u32, OUT_PDTHA_SPEC, u8, u8, 2, O>;
49#[doc = "Field `PA` reader - Pattern value (A) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
50pub type PA_R = crate::FieldReader<u8, u8>;
51#[doc = "Field `PA` writer - Pattern value (A) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
52pub type PA_W<'a, const O: u8> = crate::FieldWriter<'a, u32, OUT_PDTHA_SPEC, u8, u8, 2, O>;
53#[doc = "Field `FORM` reader - Output format select"]
54pub type FORM_R = crate::FieldReader<u8, FORM_A>;
55#[doc = "Output format select\n\nValue on reset: 0"]
56#[derive(Clone, Copy, Debug, PartialEq, Eq)]
57#[repr(u8)]
58pub enum FORM_A {
59    #[doc = "3: Setting prohibited"]
60    _11 = 3,
61    #[doc = "2: RGB565; select RGB565 as output interface format."]
62    _10 = 2,
63    #[doc = "1: RGB666; select RGB666 as output interface format."]
64    _01 = 1,
65    #[doc = "0: RGB888; select RGB888 or serial RGB as output interface format."]
66    _00 = 0,
67}
68impl From<FORM_A> for u8 {
69    #[inline(always)]
70    fn from(variant: FORM_A) -> Self {
71        variant as _
72    }
73}
74impl FORM_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub fn variant(&self) -> FORM_A {
78        match self.bits {
79            3 => FORM_A::_11,
80            2 => FORM_A::_10,
81            1 => FORM_A::_01,
82            0 => FORM_A::_00,
83            _ => unreachable!(),
84        }
85    }
86    #[doc = "Checks if the value of the field is `_11`"]
87    #[inline(always)]
88    pub fn is_11(&self) -> bool {
89        *self == FORM_A::_11
90    }
91    #[doc = "Checks if the value of the field is `_10`"]
92    #[inline(always)]
93    pub fn is_10(&self) -> bool {
94        *self == FORM_A::_10
95    }
96    #[doc = "Checks if the value of the field is `_01`"]
97    #[inline(always)]
98    pub fn is_01(&self) -> bool {
99        *self == FORM_A::_01
100    }
101    #[doc = "Checks if the value of the field is `_00`"]
102    #[inline(always)]
103    pub fn is_00(&self) -> bool {
104        *self == FORM_A::_00
105    }
106}
107#[doc = "Field `FORM` writer - Output format select"]
108pub type FORM_W<'a, const O: u8> =
109    crate::FieldWriterSafe<'a, u32, OUT_PDTHA_SPEC, u8, FORM_A, 2, O>;
110impl<'a, const O: u8> FORM_W<'a, O> {
111    #[doc = "Setting prohibited"]
112    #[inline(always)]
113    pub fn _11(self) -> &'a mut W {
114        self.variant(FORM_A::_11)
115    }
116    #[doc = "RGB565; select RGB565 as output interface format."]
117    #[inline(always)]
118    pub fn _10(self) -> &'a mut W {
119        self.variant(FORM_A::_10)
120    }
121    #[doc = "RGB666; select RGB666 as output interface format."]
122    #[inline(always)]
123    pub fn _01(self) -> &'a mut W {
124        self.variant(FORM_A::_01)
125    }
126    #[doc = "RGB888; select RGB888 or serial RGB as output interface format."]
127    #[inline(always)]
128    pub fn _00(self) -> &'a mut W {
129        self.variant(FORM_A::_00)
130    }
131}
132#[doc = "Field `SEL` reader - Operation mode"]
133pub type SEL_R = crate::FieldReader<u8, SEL_A>;
134#[doc = "Operation mode\n\nValue on reset: 0"]
135#[derive(Clone, Copy, Debug, PartialEq, Eq)]
136#[repr(u8)]
137pub enum SEL_A {
138    #[doc = "3: Setting prohibited"]
139    _11 = 3,
140    #[doc = "2: 2x2 pattern dither"]
141    _10 = 2,
142    #[doc = "1: Round-off"]
143    _01 = 1,
144    #[doc = "0: Truncate"]
145    _00 = 0,
146}
147impl From<SEL_A> for u8 {
148    #[inline(always)]
149    fn from(variant: SEL_A) -> Self {
150        variant as _
151    }
152}
153impl SEL_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> SEL_A {
157        match self.bits {
158            3 => SEL_A::_11,
159            2 => SEL_A::_10,
160            1 => SEL_A::_01,
161            0 => SEL_A::_00,
162            _ => unreachable!(),
163        }
164    }
165    #[doc = "Checks if the value of the field is `_11`"]
166    #[inline(always)]
167    pub fn is_11(&self) -> bool {
168        *self == SEL_A::_11
169    }
170    #[doc = "Checks if the value of the field is `_10`"]
171    #[inline(always)]
172    pub fn is_10(&self) -> bool {
173        *self == SEL_A::_10
174    }
175    #[doc = "Checks if the value of the field is `_01`"]
176    #[inline(always)]
177    pub fn is_01(&self) -> bool {
178        *self == SEL_A::_01
179    }
180    #[doc = "Checks if the value of the field is `_00`"]
181    #[inline(always)]
182    pub fn is_00(&self) -> bool {
183        *self == SEL_A::_00
184    }
185}
186#[doc = "Field `SEL` writer - Operation mode"]
187pub type SEL_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, OUT_PDTHA_SPEC, u8, SEL_A, 2, O>;
188impl<'a, const O: u8> SEL_W<'a, O> {
189    #[doc = "Setting prohibited"]
190    #[inline(always)]
191    pub fn _11(self) -> &'a mut W {
192        self.variant(SEL_A::_11)
193    }
194    #[doc = "2x2 pattern dither"]
195    #[inline(always)]
196    pub fn _10(self) -> &'a mut W {
197        self.variant(SEL_A::_10)
198    }
199    #[doc = "Round-off"]
200    #[inline(always)]
201    pub fn _01(self) -> &'a mut W {
202        self.variant(SEL_A::_01)
203    }
204    #[doc = "Truncate"]
205    #[inline(always)]
206    pub fn _00(self) -> &'a mut W {
207        self.variant(SEL_A::_00)
208    }
209}
210impl R {
211    #[doc = "Bits 0:1 - Pattern value (D) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
212    #[inline(always)]
213    pub fn pd(&self) -> PD_R {
214        PD_R::new((self.bits & 3) as u8)
215    }
216    #[doc = "Bits 4:5 - Pattern value (C) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
217    #[inline(always)]
218    pub fn pc(&self) -> PC_R {
219        PC_R::new(((self.bits >> 4) & 3) as u8)
220    }
221    #[doc = "Bits 8:9 - Pattern value (B) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
222    #[inline(always)]
223    pub fn pb(&self) -> PB_R {
224        PB_R::new(((self.bits >> 8) & 3) as u8)
225    }
226    #[doc = "Bits 12:13 - Pattern value (A) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
227    #[inline(always)]
228    pub fn pa(&self) -> PA_R {
229        PA_R::new(((self.bits >> 12) & 3) as u8)
230    }
231    #[doc = "Bits 16:17 - Output format select"]
232    #[inline(always)]
233    pub fn form(&self) -> FORM_R {
234        FORM_R::new(((self.bits >> 16) & 3) as u8)
235    }
236    #[doc = "Bits 20:21 - Operation mode"]
237    #[inline(always)]
238    pub fn sel(&self) -> SEL_R {
239        SEL_R::new(((self.bits >> 20) & 3) as u8)
240    }
241}
242impl W {
243    #[doc = "Bits 0:1 - Pattern value (D) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
244    #[inline(always)]
245    #[must_use]
246    pub fn pd(&mut self) -> PD_W<0> {
247        PD_W::new(self)
248    }
249    #[doc = "Bits 4:5 - Pattern value (C) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
250    #[inline(always)]
251    #[must_use]
252    pub fn pc(&mut self) -> PC_W<4> {
253        PC_W::new(self)
254    }
255    #[doc = "Bits 8:9 - Pattern value (B) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
256    #[inline(always)]
257    #[must_use]
258    pub fn pb(&mut self) -> PB_W<8> {
259        PB_W::new(self)
260    }
261    #[doc = "Bits 12:13 - Pattern value (A) of 2 x 2 pattern ditherUnsigned 2-bit integer"]
262    #[inline(always)]
263    #[must_use]
264    pub fn pa(&mut self) -> PA_W<12> {
265        PA_W::new(self)
266    }
267    #[doc = "Bits 16:17 - Output format select"]
268    #[inline(always)]
269    #[must_use]
270    pub fn form(&mut self) -> FORM_W<16> {
271        FORM_W::new(self)
272    }
273    #[doc = "Bits 20:21 - Operation mode"]
274    #[inline(always)]
275    #[must_use]
276    pub fn sel(&mut self) -> SEL_W<20> {
277        SEL_W::new(self)
278    }
279    #[doc = "Writes raw bits to the register."]
280    #[inline(always)]
281    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
282        self.0.bits(bits);
283        self
284    }
285}
286#[doc = "Output Control Block Panel Dither Correction 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 [out_pdtha](index.html) module"]
287pub struct OUT_PDTHA_SPEC;
288impl crate::RegisterSpec for OUT_PDTHA_SPEC {
289    type Ux = u32;
290}
291#[doc = "`read()` method returns [out_pdtha::R](R) reader structure"]
292impl crate::Readable for OUT_PDTHA_SPEC {
293    type Reader = R;
294}
295#[doc = "`write(|w| ..)` method takes [out_pdtha::W](W) writer structure"]
296impl crate::Writable for OUT_PDTHA_SPEC {
297    type Writer = W;
298    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
299    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
300}
301#[doc = "`reset()` method sets OUT_PDTHA to value 0"]
302impl crate::Resettable for OUT_PDTHA_SPEC {
303    const RESET_VALUE: Self::Ux = 0;
304}