@@ -125,93 +125,45 @@ impl DisplayController for Ltdc {
125
125
. bit ( config. pixel_clock_pol )
126
126
} ) ;
127
127
128
- // TODO: remove when fixed upstream
129
- // unsafe: bit ranges not defined for fields
130
- #[ cfg( feature = "rm0399" ) ]
131
- unsafe {
132
- // Set synchronization pulse width
133
- self . ltdc . sscr . modify ( |_, w| {
134
- w. vsh ( )
135
- . bits ( config. v_sync - 1 )
136
- . hsw ( )
137
- . bits ( config. h_sync - 1 )
138
- } ) ;
139
-
140
- // Set accumulated back porch
141
- self . ltdc . bpcr . modify ( |_, w| {
142
- w. avbp ( )
143
- . bits ( config. v_sync + config. v_back_porch - 1 )
144
- . ahbp ( )
145
- . bits ( config. h_sync + config. h_back_porch - 1 )
146
- } ) ;
147
-
148
- // Set accumulated active width
149
- let aa_height =
150
- config. v_sync + config. v_back_porch + config. active_height - 1 ;
151
- let aa_width =
152
- config. h_sync + config. h_back_porch + config. active_width - 1 ;
153
- self . ltdc
154
- . awcr
155
- . modify ( |_, w| w. aah ( ) . bits ( aa_height) . aaw ( ) . bits ( aa_width) ) ;
156
-
157
- // Set total width and height
158
- let total_height: u16 = config. v_sync
159
- + config. v_back_porch
160
- + config. active_height
161
- + config. v_front_porch
162
- - 1 ;
163
- let total_width: u16 = config. h_sync
164
- + config. h_back_porch
165
- + config. active_width
166
- + config. h_front_porch
167
- - 1 ;
168
- self . ltdc . twcr . modify ( |_, w| {
169
- w. totalh ( ) . bits ( total_height) . totalw ( ) . bits ( total_width)
170
- } ) ;
171
- }
128
+ // Set synchronization pulse width
129
+ self . ltdc . sscr . modify ( |_, w| {
130
+ w. vsh ( )
131
+ . bits ( config. v_sync - 1 )
132
+ . hsw ( )
133
+ . bits ( config. h_sync - 1 )
134
+ } ) ;
172
135
173
- #[ cfg( not( feature = "rm0399" ) ) ]
174
- {
175
- // Set synchronization pulse width
176
- self . ltdc . sscr . modify ( |_, w| {
177
- w. vsh ( )
178
- . bits ( config. v_sync - 1 )
179
- . hsw ( )
180
- . bits ( config. h_sync - 1 )
181
- } ) ;
182
-
183
- // Set accumulated back porch
184
- self . ltdc . bpcr . modify ( |_, w| {
185
- w. avbp ( )
186
- . bits ( config. v_sync + config. v_back_porch - 1 )
187
- . ahbp ( )
188
- . bits ( config. h_sync + config. h_back_porch - 1 )
189
- } ) ;
190
-
191
- // Set accumulated active width
192
- let aa_height =
193
- config. v_sync + config. v_back_porch + config. active_height - 1 ;
194
- let aa_width =
195
- config. h_sync + config. h_back_porch + config. active_width - 1 ;
196
- self . ltdc
197
- . awcr
198
- . modify ( |_, w| w. aah ( ) . bits ( aa_height) . aaw ( ) . bits ( aa_width) ) ;
199
-
200
- // Set total width and height
201
- let total_height: u16 = config. v_sync
202
- + config. v_back_porch
203
- + config. active_height
204
- + config. v_front_porch
205
- - 1 ;
206
- let total_width: u16 = config. h_sync
207
- + config. h_back_porch
208
- + config. active_width
209
- + config. h_front_porch
210
- - 1 ;
211
- self . ltdc . twcr . modify ( |_, w| {
212
- w. totalh ( ) . bits ( total_height) . totalw ( ) . bits ( total_width)
213
- } ) ;
214
- }
136
+ // Set accumulated back porch
137
+ self . ltdc . bpcr . modify ( |_, w| {
138
+ w. avbp ( )
139
+ . bits ( config. v_sync + config. v_back_porch - 1 )
140
+ . ahbp ( )
141
+ . bits ( config. h_sync + config. h_back_porch - 1 )
142
+ } ) ;
143
+
144
+ // Set accumulated active width
145
+ let aa_height =
146
+ config. v_sync + config. v_back_porch + config. active_height - 1 ;
147
+ let aa_width =
148
+ config. h_sync + config. h_back_porch + config. active_width - 1 ;
149
+ self . ltdc
150
+ . awcr
151
+ . modify ( |_, w| w. aah ( ) . bits ( aa_height) . aaw ( ) . bits ( aa_width) ) ;
152
+
153
+ // Set total width and height
154
+ let total_height: u16 = config. v_sync
155
+ + config. v_back_porch
156
+ + config. active_height
157
+ + config. v_front_porch
158
+ - 1 ;
159
+ let total_width: u16 = config. h_sync
160
+ + config. h_back_porch
161
+ + config. active_width
162
+ + config. h_front_porch
163
+ - 1 ;
164
+ self . ltdc . twcr . modify ( |_, w| {
165
+ w. totalh ( ) . bits ( total_height) . totalw ( ) . bits ( total_width)
166
+ } ) ;
215
167
216
168
// Set the background color value
217
169
self . ltdc . bccr . reset ( ) ;
0 commit comments