Skip to content

Commit

Permalink
wip copied dsi config from functional st example
Browse files Browse the repository at this point in the history
  • Loading branch information
hshose committed May 15, 2023
1 parent 3fede39 commit 31e1ab3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion examples/stm32f469_discovery/display/project.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<library>
<extends>modm:disco-f469ni</extends>
<extends>modm:disco-f469ni:b-08</extends>
<options>
<option name="modm:build:build.path">../../../build/stm32f469_discovery/display</option>
</options>
Expand Down
30 changes: 17 additions & 13 deletions src/modm/board/disco_f469ni/board_dsi_nt35510.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,41 +142,43 @@ board_initialize_display(uint8_t ColorCoding)
{
// HAL_LTDC_Init(&hltdc_eval);
// Configures the HS, VS, DE and PC polarity
LTDC->GCR = 0;
// sets HS Polarity and VS Polarity to active high (LTDC_HSPOLARITY_AH, LTDC_VSPOLARITY_AH)
LTDC->GCR = (1 << 31) | (1 << 30);
// Sets Synchronization size
LTDC->SSCR = ((HSA - 1) << 16) | (VSA - 1);
LTDC->SSCR = (1 << 16) | (1);
// Sets Accumulated Back porch
LTDC->BPCR = ((HSA + HBP - 1) << 16) | (VSA + VBP - 1);
LTDC->BPCR = (2 << 16) | (2);
// Sets Accumulated Active Width
LTDC->AWCR = ((HACT + HSA + HBP - 1) << 16) | (VACT + VSA + VBP - 1);
LTDC->AWCR = (202 << 16) | (482);
// Sets Total Width and Height
LTDC->TWCR = ((HACT + HSA + HBP + HFP - 1) << 16) | (VACT + VSA + VBP + VFP - 1);
LTDC->TWCR = (203 << 16) | (483);
// Sets the background color value
LTDC->BCCR = 0;
// Enable LTDC by setting LTDCEN bit
LTDC->GCR |= LTDC_GCR_LTDCEN;
}

nt35510_init(ColorCoding);

{
// HAL_LTDC_ConfigLayer()
// Configures the horizontal start and stop position
LTDC_Layer1->WHPCR = ((HACT + HSA + HBP - 1) << 16) | (HSA + HBP);
LTDC_Layer1->WHPCR =
(0 + ((LTDC->BPCR & LTDC_BPCR_AHBP) >> 16) + 1)
| ((200 + ((LTDC->BPCR & LTDC_BPCR_AHBP) >> 16)) << 16); // tmp
// Configures the vertical start and stop position
LTDC_Layer1->WVPCR = ((VACT + VSA + VBP - 1) << 16) | (VSA + VBP);
LTDC_Layer1->WVPCR = (0 + (LTDC->BPCR & LTDC_BPCR_AVBP) + 1)
| ((480 + (LTDC->BPCR & LTDC_BPCR_AVBP)) << 16);
// Specifies the pixel format
LTDC_Layer1->PFCR = ColorCoding;
// Configures the default color values
LTDC_Layer1->DCCR = 0xff000000;
LTDC_Layer1->DCCR = 0x00000000;
// Specifies the constant alpha value
LTDC_Layer1->CACR = 0xff;
// Specifies the blending factors
LTDC_Layer1->BFCR = 0x607;
LTDC_Layer1->BFCR = 0x00000005U | 0x00000400U;
// Configures the color frame buffer pitch in byte
LTDC_Layer1->CFBLR = ((HACT * pixel_size) << 16) | ((HACT * pixel_size) + 3);
LTDC_Layer1->CFBLR = ((800 * pixel_size) << 16) | ((800 * pixel_size) + 3);
// Configures the frame buffer line number
LTDC_Layer1->CFBLNR = VACT;
LTDC_Layer1->CFBLNR = 480;

/* Configured in display.cpp
// Configures the color frame buffer start address
Expand All @@ -187,4 +189,6 @@ board_initialize_display(uint8_t ColorCoding)
LTDC->SRCR = LTDC_SRCR_IMR;
*/
}

nt35510_init(ColorCoding);
}
5 changes: 1 addition & 4 deletions src/modm/board/disco_f469ni/board_nt35510.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,7 @@ uint8_t nt35510_init(uint8_t ColorCoding)
/* Set Pixel color format to RGB565 */
dsi_write_command(1, nt35510_reg36);
break;
case NT35510_FORMAT_RGB888 :
/* Set Pixel color format to RGB888 */
dsi_write_command(1, nt35510_reg37);
break;
case NT35510_FORMAT_RGB888:
default :
/* Set Pixel color format to RGB888 */
dsi_write_command(1, nt35510_reg37);
Expand Down

0 comments on commit 31e1ab3

Please sign in to comment.