esp32p4/ppa/
sr_scal_rotate.rs1#[doc = "Register `SR_SCAL_ROTATE` reader"]
2pub type R = crate::R<SR_SCAL_ROTATE_SPEC>;
3#[doc = "Register `SR_SCAL_ROTATE` writer"]
4pub type W = crate::W<SR_SCAL_ROTATE_SPEC>;
5#[doc = "Field `SR_SCAL_X_INT` reader - The integrated part of scaling coefficient in X direction."]
6pub type SR_SCAL_X_INT_R = crate::FieldReader;
7#[doc = "Field `SR_SCAL_X_INT` writer - The integrated part of scaling coefficient in X direction."]
8pub type SR_SCAL_X_INT_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
9#[doc = "Field `SR_SCAL_X_FRAG` reader - The fragment part of scaling coefficient in X direction."]
10pub type SR_SCAL_X_FRAG_R = crate::FieldReader;
11#[doc = "Field `SR_SCAL_X_FRAG` writer - The fragment part of scaling coefficient in X direction."]
12pub type SR_SCAL_X_FRAG_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
13#[doc = "Field `SR_SCAL_Y_INT` reader - The integrated part of scaling coefficient in Y direction."]
14pub type SR_SCAL_Y_INT_R = crate::FieldReader;
15#[doc = "Field `SR_SCAL_Y_INT` writer - The integrated part of scaling coefficient in Y direction."]
16pub type SR_SCAL_Y_INT_W<'a, REG> = crate::FieldWriter<'a, REG, 8>;
17#[doc = "Field `SR_SCAL_Y_FRAG` reader - The fragment part of scaling coefficient in Y direction."]
18pub type SR_SCAL_Y_FRAG_R = crate::FieldReader;
19#[doc = "Field `SR_SCAL_Y_FRAG` writer - The fragment part of scaling coefficient in Y direction."]
20pub type SR_SCAL_Y_FRAG_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
21#[doc = "Field `SR_ROTATE_ANGLE` reader - The rotate angle. 0: 0 degree. 1: 90 degree. 2: 180 degree. 3: 270 degree."]
22pub type SR_ROTATE_ANGLE_R = crate::FieldReader;
23#[doc = "Field `SR_ROTATE_ANGLE` writer - The rotate angle. 0: 0 degree. 1: 90 degree. 2: 180 degree. 3: 270 degree."]
24pub type SR_ROTATE_ANGLE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>;
25#[doc = "Field `SCAL_ROTATE_RST` reader - Write 1 then write 0 to this bit to reset scaling and rotating engine."]
26pub type SCAL_ROTATE_RST_R = crate::BitReader;
27#[doc = "Field `SCAL_ROTATE_RST` writer - Write 1 then write 0 to this bit to reset scaling and rotating engine."]
28pub type SCAL_ROTATE_RST_W<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `SCAL_ROTATE_START` writer - Write 1 to enable scaling and rotating engine after parameter is configured."]
30pub type SCAL_ROTATE_START_W<'a, REG> = crate::BitWriter<'a, REG>;
31#[doc = "Field `SR_MIRROR_X` reader - Image mirror in X direction. 0: disable, 1: enable"]
32pub type SR_MIRROR_X_R = crate::BitReader;
33#[doc = "Field `SR_MIRROR_X` writer - Image mirror in X direction. 0: disable, 1: enable"]
34pub type SR_MIRROR_X_W<'a, REG> = crate::BitWriter<'a, REG>;
35#[doc = "Field `SR_MIRROR_Y` reader - Image mirror in Y direction. 0: disable, 1: enable"]
36pub type SR_MIRROR_Y_R = crate::BitReader;
37#[doc = "Field `SR_MIRROR_Y` writer - Image mirror in Y direction. 0: disable, 1: enable"]
38pub type SR_MIRROR_Y_W<'a, REG> = crate::BitWriter<'a, REG>;
39impl R {
40 #[doc = "Bits 0:7 - The integrated part of scaling coefficient in X direction."]
41 #[inline(always)]
42 pub fn sr_scal_x_int(&self) -> SR_SCAL_X_INT_R {
43 SR_SCAL_X_INT_R::new((self.bits & 0xff) as u8)
44 }
45 #[doc = "Bits 8:11 - The fragment part of scaling coefficient in X direction."]
46 #[inline(always)]
47 pub fn sr_scal_x_frag(&self) -> SR_SCAL_X_FRAG_R {
48 SR_SCAL_X_FRAG_R::new(((self.bits >> 8) & 0x0f) as u8)
49 }
50 #[doc = "Bits 12:19 - The integrated part of scaling coefficient in Y direction."]
51 #[inline(always)]
52 pub fn sr_scal_y_int(&self) -> SR_SCAL_Y_INT_R {
53 SR_SCAL_Y_INT_R::new(((self.bits >> 12) & 0xff) as u8)
54 }
55 #[doc = "Bits 20:23 - The fragment part of scaling coefficient in Y direction."]
56 #[inline(always)]
57 pub fn sr_scal_y_frag(&self) -> SR_SCAL_Y_FRAG_R {
58 SR_SCAL_Y_FRAG_R::new(((self.bits >> 20) & 0x0f) as u8)
59 }
60 #[doc = "Bits 24:25 - The rotate angle. 0: 0 degree. 1: 90 degree. 2: 180 degree. 3: 270 degree."]
61 #[inline(always)]
62 pub fn sr_rotate_angle(&self) -> SR_ROTATE_ANGLE_R {
63 SR_ROTATE_ANGLE_R::new(((self.bits >> 24) & 3) as u8)
64 }
65 #[doc = "Bit 26 - Write 1 then write 0 to this bit to reset scaling and rotating engine."]
66 #[inline(always)]
67 pub fn scal_rotate_rst(&self) -> SCAL_ROTATE_RST_R {
68 SCAL_ROTATE_RST_R::new(((self.bits >> 26) & 1) != 0)
69 }
70 #[doc = "Bit 28 - Image mirror in X direction. 0: disable, 1: enable"]
71 #[inline(always)]
72 pub fn sr_mirror_x(&self) -> SR_MIRROR_X_R {
73 SR_MIRROR_X_R::new(((self.bits >> 28) & 1) != 0)
74 }
75 #[doc = "Bit 29 - Image mirror in Y direction. 0: disable, 1: enable"]
76 #[inline(always)]
77 pub fn sr_mirror_y(&self) -> SR_MIRROR_Y_R {
78 SR_MIRROR_Y_R::new(((self.bits >> 29) & 1) != 0)
79 }
80}
81#[cfg(feature = "impl-register-debug")]
82impl core::fmt::Debug for R {
83 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
84 f.debug_struct("SR_SCAL_ROTATE")
85 .field(
86 "sr_scal_x_int",
87 &format_args!("{}", self.sr_scal_x_int().bits()),
88 )
89 .field(
90 "sr_scal_x_frag",
91 &format_args!("{}", self.sr_scal_x_frag().bits()),
92 )
93 .field(
94 "sr_scal_y_int",
95 &format_args!("{}", self.sr_scal_y_int().bits()),
96 )
97 .field(
98 "sr_scal_y_frag",
99 &format_args!("{}", self.sr_scal_y_frag().bits()),
100 )
101 .field(
102 "sr_rotate_angle",
103 &format_args!("{}", self.sr_rotate_angle().bits()),
104 )
105 .field(
106 "scal_rotate_rst",
107 &format_args!("{}", self.scal_rotate_rst().bit()),
108 )
109 .field("sr_mirror_x", &format_args!("{}", self.sr_mirror_x().bit()))
110 .field("sr_mirror_y", &format_args!("{}", self.sr_mirror_y().bit()))
111 .finish()
112 }
113}
114#[cfg(feature = "impl-register-debug")]
115impl core::fmt::Debug for crate::generic::Reg<SR_SCAL_ROTATE_SPEC> {
116 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
117 core::fmt::Debug::fmt(&self.read(), f)
118 }
119}
120impl W {
121 #[doc = "Bits 0:7 - The integrated part of scaling coefficient in X direction."]
122 #[inline(always)]
123 #[must_use]
124 pub fn sr_scal_x_int(&mut self) -> SR_SCAL_X_INT_W<SR_SCAL_ROTATE_SPEC> {
125 SR_SCAL_X_INT_W::new(self, 0)
126 }
127 #[doc = "Bits 8:11 - The fragment part of scaling coefficient in X direction."]
128 #[inline(always)]
129 #[must_use]
130 pub fn sr_scal_x_frag(&mut self) -> SR_SCAL_X_FRAG_W<SR_SCAL_ROTATE_SPEC> {
131 SR_SCAL_X_FRAG_W::new(self, 8)
132 }
133 #[doc = "Bits 12:19 - The integrated part of scaling coefficient in Y direction."]
134 #[inline(always)]
135 #[must_use]
136 pub fn sr_scal_y_int(&mut self) -> SR_SCAL_Y_INT_W<SR_SCAL_ROTATE_SPEC> {
137 SR_SCAL_Y_INT_W::new(self, 12)
138 }
139 #[doc = "Bits 20:23 - The fragment part of scaling coefficient in Y direction."]
140 #[inline(always)]
141 #[must_use]
142 pub fn sr_scal_y_frag(&mut self) -> SR_SCAL_Y_FRAG_W<SR_SCAL_ROTATE_SPEC> {
143 SR_SCAL_Y_FRAG_W::new(self, 20)
144 }
145 #[doc = "Bits 24:25 - The rotate angle. 0: 0 degree. 1: 90 degree. 2: 180 degree. 3: 270 degree."]
146 #[inline(always)]
147 #[must_use]
148 pub fn sr_rotate_angle(&mut self) -> SR_ROTATE_ANGLE_W<SR_SCAL_ROTATE_SPEC> {
149 SR_ROTATE_ANGLE_W::new(self, 24)
150 }
151 #[doc = "Bit 26 - Write 1 then write 0 to this bit to reset scaling and rotating engine."]
152 #[inline(always)]
153 #[must_use]
154 pub fn scal_rotate_rst(&mut self) -> SCAL_ROTATE_RST_W<SR_SCAL_ROTATE_SPEC> {
155 SCAL_ROTATE_RST_W::new(self, 26)
156 }
157 #[doc = "Bit 27 - Write 1 to enable scaling and rotating engine after parameter is configured."]
158 #[inline(always)]
159 #[must_use]
160 pub fn scal_rotate_start(&mut self) -> SCAL_ROTATE_START_W<SR_SCAL_ROTATE_SPEC> {
161 SCAL_ROTATE_START_W::new(self, 27)
162 }
163 #[doc = "Bit 28 - Image mirror in X direction. 0: disable, 1: enable"]
164 #[inline(always)]
165 #[must_use]
166 pub fn sr_mirror_x(&mut self) -> SR_MIRROR_X_W<SR_SCAL_ROTATE_SPEC> {
167 SR_MIRROR_X_W::new(self, 28)
168 }
169 #[doc = "Bit 29 - Image mirror in Y direction. 0: disable, 1: enable"]
170 #[inline(always)]
171 #[must_use]
172 pub fn sr_mirror_y(&mut self) -> SR_MIRROR_Y_W<SR_SCAL_ROTATE_SPEC> {
173 SR_MIRROR_Y_W::new(self, 29)
174 }
175}
176#[doc = "Scaling and rotating coefficient register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`sr_scal_rotate::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`sr_scal_rotate::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
177pub struct SR_SCAL_ROTATE_SPEC;
178impl crate::RegisterSpec for SR_SCAL_ROTATE_SPEC {
179 type Ux = u32;
180}
181#[doc = "`read()` method returns [`sr_scal_rotate::R`](R) reader structure"]
182impl crate::Readable for SR_SCAL_ROTATE_SPEC {}
183#[doc = "`write(|w| ..)` method takes [`sr_scal_rotate::W`](W) writer structure"]
184impl crate::Writable for SR_SCAL_ROTATE_SPEC {
185 type Safety = crate::Unsafe;
186 const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
187 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
188}
189#[doc = "`reset()` method sets SR_SCAL_ROTATE to value 0x1001"]
190impl crate::Resettable for SR_SCAL_ROTATE_SPEC {
191 const RESET_VALUE: u32 = 0x1001;
192}