Skip to content

Commit 31e1ab3

Browse files
committed
wip copied dsi config from functional st example
1 parent 3fede39 commit 31e1ab3

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

examples/stm32f469_discovery/display/project.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<library>
2-
<extends>modm:disco-f469ni</extends>
2+
<extends>modm:disco-f469ni:b-08</extends>
33
<options>
44
<option name="modm:build:build.path">../../../build/stm32f469_discovery/display</option>
55
</options>

src/modm/board/disco_f469ni/board_dsi_nt35510.cpp

+17-13
Original file line numberDiff line numberDiff line change
@@ -142,41 +142,43 @@ board_initialize_display(uint8_t ColorCoding)
142142
{
143143
// HAL_LTDC_Init(&hltdc_eval);
144144
// Configures the HS, VS, DE and PC polarity
145-
LTDC->GCR = 0;
145+
// sets HS Polarity and VS Polarity to active high (LTDC_HSPOLARITY_AH, LTDC_VSPOLARITY_AH)
146+
LTDC->GCR = (1 << 31) | (1 << 30);
146147
// Sets Synchronization size
147-
LTDC->SSCR = ((HSA - 1) << 16) | (VSA - 1);
148+
LTDC->SSCR = (1 << 16) | (1);
148149
// Sets Accumulated Back porch
149-
LTDC->BPCR = ((HSA + HBP - 1) << 16) | (VSA + VBP - 1);
150+
LTDC->BPCR = (2 << 16) | (2);
150151
// Sets Accumulated Active Width
151-
LTDC->AWCR = ((HACT + HSA + HBP - 1) << 16) | (VACT + VSA + VBP - 1);
152+
LTDC->AWCR = (202 << 16) | (482);
152153
// Sets Total Width and Height
153-
LTDC->TWCR = ((HACT + HSA + HBP + HFP - 1) << 16) | (VACT + VSA + VBP + VFP - 1);
154+
LTDC->TWCR = (203 << 16) | (483);
154155
// Sets the background color value
155156
LTDC->BCCR = 0;
156157
// Enable LTDC by setting LTDCEN bit
157158
LTDC->GCR |= LTDC_GCR_LTDCEN;
158159
}
159160

160-
nt35510_init(ColorCoding);
161-
162161
{
163162
// HAL_LTDC_ConfigLayer()
164163
// Configures the horizontal start and stop position
165-
LTDC_Layer1->WHPCR = ((HACT + HSA + HBP - 1) << 16) | (HSA + HBP);
164+
LTDC_Layer1->WHPCR =
165+
(0 + ((LTDC->BPCR & LTDC_BPCR_AHBP) >> 16) + 1)
166+
| ((200 + ((LTDC->BPCR & LTDC_BPCR_AHBP) >> 16)) << 16); // tmp
166167
// Configures the vertical start and stop position
167-
LTDC_Layer1->WVPCR = ((VACT + VSA + VBP - 1) << 16) | (VSA + VBP);
168+
LTDC_Layer1->WVPCR = (0 + (LTDC->BPCR & LTDC_BPCR_AVBP) + 1)
169+
| ((480 + (LTDC->BPCR & LTDC_BPCR_AVBP)) << 16);
168170
// Specifies the pixel format
169171
LTDC_Layer1->PFCR = ColorCoding;
170172
// Configures the default color values
171-
LTDC_Layer1->DCCR = 0xff000000;
173+
LTDC_Layer1->DCCR = 0x00000000;
172174
// Specifies the constant alpha value
173175
LTDC_Layer1->CACR = 0xff;
174176
// Specifies the blending factors
175-
LTDC_Layer1->BFCR = 0x607;
177+
LTDC_Layer1->BFCR = 0x00000005U | 0x00000400U;
176178
// Configures the color frame buffer pitch in byte
177-
LTDC_Layer1->CFBLR = ((HACT * pixel_size) << 16) | ((HACT * pixel_size) + 3);
179+
LTDC_Layer1->CFBLR = ((800 * pixel_size) << 16) | ((800 * pixel_size) + 3);
178180
// Configures the frame buffer line number
179-
LTDC_Layer1->CFBLNR = VACT;
181+
LTDC_Layer1->CFBLNR = 480;
180182

181183
/* Configured in display.cpp
182184
// Configures the color frame buffer start address
@@ -187,4 +189,6 @@ board_initialize_display(uint8_t ColorCoding)
187189
LTDC->SRCR = LTDC_SRCR_IMR;
188190
*/
189191
}
192+
193+
nt35510_init(ColorCoding);
190194
}

src/modm/board/disco_f469ni/board_nt35510.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,7 @@ uint8_t nt35510_init(uint8_t ColorCoding)
327327
/* Set Pixel color format to RGB565 */
328328
dsi_write_command(1, nt35510_reg36);
329329
break;
330-
case NT35510_FORMAT_RGB888 :
331-
/* Set Pixel color format to RGB888 */
332-
dsi_write_command(1, nt35510_reg37);
333-
break;
330+
case NT35510_FORMAT_RGB888:
334331
default :
335332
/* Set Pixel color format to RGB888 */
336333
dsi_write_command(1, nt35510_reg37);

0 commit comments

Comments
 (0)