Skip to main content

atsamv71n21/isi/
isi_r2y_set1.rs

1#[doc = "Register `ISI_R2Y_SET1` reader"]
2pub struct R(crate::R<ISI_R2Y_SET1_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ISI_R2Y_SET1_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ISI_R2Y_SET1_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ISI_R2Y_SET1_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `ISI_R2Y_SET1` writer"]
17pub struct W(crate::W<ISI_R2Y_SET1_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ISI_R2Y_SET1_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<ISI_R2Y_SET1_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ISI_R2Y_SET1_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `C3` reader - Color Space Conversion Matrix Coefficient C3"]
38pub struct C3_R(crate::FieldReader<u8, u8>);
39impl C3_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: u8) -> Self {
42        C3_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for C3_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 `C3` writer - Color Space Conversion Matrix Coefficient C3"]
53pub struct C3_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> C3_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 & !0x7f) | (value as u32 & 0x7f);
61        self.w
62    }
63}
64#[doc = "Field `C4` reader - Color Space Conversion Matrix Coefficient C4"]
65pub struct C4_R(crate::FieldReader<u8, u8>);
66impl C4_R {
67    #[inline(always)]
68    pub(crate) fn new(bits: u8) -> Self {
69        C4_R(crate::FieldReader::new(bits))
70    }
71}
72impl core::ops::Deref for C4_R {
73    type Target = crate::FieldReader<u8, u8>;
74    #[inline(always)]
75    fn deref(&self) -> &Self::Target {
76        &self.0
77    }
78}
79#[doc = "Field `C4` writer - Color Space Conversion Matrix Coefficient C4"]
80pub struct C4_W<'a> {
81    w: &'a mut W,
82}
83impl<'a> C4_W<'a> {
84    #[doc = r"Writes raw bits to the field"]
85    #[inline(always)]
86    pub unsafe fn bits(self, value: u8) -> &'a mut W {
87        self.w.bits = (self.w.bits & !(0x7f << 8)) | ((value as u32 & 0x7f) << 8);
88        self.w
89    }
90}
91#[doc = "Field `C5` reader - Color Space Conversion Matrix Coefficient C5"]
92pub struct C5_R(crate::FieldReader<u8, u8>);
93impl C5_R {
94    #[inline(always)]
95    pub(crate) fn new(bits: u8) -> Self {
96        C5_R(crate::FieldReader::new(bits))
97    }
98}
99impl core::ops::Deref for C5_R {
100    type Target = crate::FieldReader<u8, u8>;
101    #[inline(always)]
102    fn deref(&self) -> &Self::Target {
103        &self.0
104    }
105}
106#[doc = "Field `C5` writer - Color Space Conversion Matrix Coefficient C5"]
107pub struct C5_W<'a> {
108    w: &'a mut W,
109}
110impl<'a> C5_W<'a> {
111    #[doc = r"Writes raw bits to the field"]
112    #[inline(always)]
113    pub unsafe fn bits(self, value: u8) -> &'a mut W {
114        self.w.bits = (self.w.bits & !(0x7f << 16)) | ((value as u32 & 0x7f) << 16);
115        self.w
116    }
117}
118#[doc = "Field `Goff` reader - Color Space Conversion Green Component Offset"]
119pub struct GOFF_R(crate::FieldReader<bool, bool>);
120impl GOFF_R {
121    #[inline(always)]
122    pub(crate) fn new(bits: bool) -> Self {
123        GOFF_R(crate::FieldReader::new(bits))
124    }
125}
126impl core::ops::Deref for GOFF_R {
127    type Target = crate::FieldReader<bool, bool>;
128    #[inline(always)]
129    fn deref(&self) -> &Self::Target {
130        &self.0
131    }
132}
133#[doc = "Field `Goff` writer - Color Space Conversion Green Component Offset"]
134pub struct GOFF_W<'a> {
135    w: &'a mut W,
136}
137impl<'a> GOFF_W<'a> {
138    #[doc = r"Sets the field bit"]
139    #[inline(always)]
140    pub fn set_bit(self) -> &'a mut W {
141        self.bit(true)
142    }
143    #[doc = r"Clears the field bit"]
144    #[inline(always)]
145    pub fn clear_bit(self) -> &'a mut W {
146        self.bit(false)
147    }
148    #[doc = r"Writes raw bits to the field"]
149    #[inline(always)]
150    pub fn bit(self, value: bool) -> &'a mut W {
151        self.w.bits = (self.w.bits & !(0x01 << 24)) | ((value as u32 & 0x01) << 24);
152        self.w
153    }
154}
155impl R {
156    #[doc = "Bits 0:6 - Color Space Conversion Matrix Coefficient C3"]
157    #[inline(always)]
158    pub fn c3(&self) -> C3_R {
159        C3_R::new((self.bits & 0x7f) as u8)
160    }
161    #[doc = "Bits 8:14 - Color Space Conversion Matrix Coefficient C4"]
162    #[inline(always)]
163    pub fn c4(&self) -> C4_R {
164        C4_R::new(((self.bits >> 8) & 0x7f) as u8)
165    }
166    #[doc = "Bits 16:22 - Color Space Conversion Matrix Coefficient C5"]
167    #[inline(always)]
168    pub fn c5(&self) -> C5_R {
169        C5_R::new(((self.bits >> 16) & 0x7f) as u8)
170    }
171    #[doc = "Bit 24 - Color Space Conversion Green Component Offset"]
172    #[inline(always)]
173    pub fn goff(&self) -> GOFF_R {
174        GOFF_R::new(((self.bits >> 24) & 0x01) != 0)
175    }
176}
177impl W {
178    #[doc = "Bits 0:6 - Color Space Conversion Matrix Coefficient C3"]
179    #[inline(always)]
180    pub fn c3(&mut self) -> C3_W {
181        C3_W { w: self }
182    }
183    #[doc = "Bits 8:14 - Color Space Conversion Matrix Coefficient C4"]
184    #[inline(always)]
185    pub fn c4(&mut self) -> C4_W {
186        C4_W { w: self }
187    }
188    #[doc = "Bits 16:22 - Color Space Conversion Matrix Coefficient C5"]
189    #[inline(always)]
190    pub fn c5(&mut self) -> C5_W {
191        C5_W { w: self }
192    }
193    #[doc = "Bit 24 - Color Space Conversion Green Component Offset"]
194    #[inline(always)]
195    pub fn goff(&mut self) -> GOFF_W {
196        GOFF_W { w: self }
197    }
198    #[doc = "Writes raw bits to the register."]
199    #[inline(always)]
200    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
201        self.0.bits(bits);
202        self
203    }
204}
205#[doc = "ISI Color Space Conversion RGB To YCrCb Set 1 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 [isi_r2y_set1](index.html) module"]
206pub struct ISI_R2Y_SET1_SPEC;
207impl crate::RegisterSpec for ISI_R2Y_SET1_SPEC {
208    type Ux = u32;
209}
210#[doc = "`read()` method returns [isi_r2y_set1::R](R) reader structure"]
211impl crate::Readable for ISI_R2Y_SET1_SPEC {
212    type Reader = R;
213}
214#[doc = "`write(|w| ..)` method takes [isi_r2y_set1::W](W) writer structure"]
215impl crate::Writable for ISI_R2Y_SET1_SPEC {
216    type Writer = W;
217}
218#[doc = "`reset()` method sets ISI_R2Y_SET1 to value 0"]
219impl crate::Resettable for ISI_R2Y_SET1_SPEC {
220    #[inline(always)]
221    fn reset_value() -> Self::Ux {
222        0
223    }
224}