diff --git a/platform/stm32f429/init_lcd.c b/platform/stm32f429/init_lcd.c index 235c37d91..e3058e4db 100644 --- a/platform/stm32f429/init_lcd.c +++ b/platform/stm32f429/init_lcd.c @@ -208,15 +208,13 @@ static void init_rgb_timings() { LTDC_AVBP(lcd_panel_vsync+lcd_panel_vbp-1) | LTDC_AHBP(lcd_panel_hsync+lcd_panel_hbp-1); -#if 0 /*– Active Width and Active Height: The Active Width and Active Height are configured by programming the accumulated value HSYNC Width + HBP + Active Width - 1 and the accumulated value VSYNC Width + VBP + Active Height - 1 in the LTDC_AWCR register (only up to 1024x768 is supported). */ - long * LTDC_AWCR = (long *)(LCD_TFT_BASE + 0x10); - set_ltdc_register(LTDC_AWCR, - lcd_panel_hsync+lcd_panel_hbp+lcd_panel_hadr-1, - lcd_panel_vsync+lcd_panel_vbp+lcd_panel_vadr-1); + LTDC_AWCR = + LTDC_AAH(lcd_panel_vsync+lcd_panel_vbp+lcd_panel_vadr-1) | + LTDC_AAW(lcd_panel_hsync+lcd_panel_hbp+lcd_panel_hadr-1); /*– Total Width: The Total width is configured by programming the accumulated value HSYNC Width + HBP + Active Width + HFP - 1 in the LTDC_TWCR register. @@ -225,12 +223,12 @@ static void init_rgb_timings() { value VSYNC Height + VBP + Active Height + VFP - 1 in the LTDC_TWCR register. The VFP is the Vertical front porch period */ - long * LTDC_TWCR = (long *)(LCD_TFT_BASE + 0x14); - set_ltdc_register(LTDC_TWCR, - lcd_panel_hsync+lcd_panel_hbp+lcd_panel_hadr+lcd_panel_hfp-1, - lcd_panel_vsync+lcd_panel_vbp+lcd_panel_vadr+lcd_panel_vfp-1); + LTDC_TWCR = + LTDC_TOTALH(lcd_panel_vsync+lcd_panel_vbp+lcd_panel_vadr+lcd_panel_vfp-1) | + LTDC_TOTALW(lcd_panel_hsync+lcd_panel_hbp+lcd_panel_hadr+lcd_panel_hfp-1); +#if 0 /* STEP 4 : Configure the synchronous signals and clock polarity in the LTDC_GCR register */ diff --git a/platform/stm32f429/registers/ltdc.h b/platform/stm32f429/registers/ltdc.h index fd9b42a60..875e44266 100644 --- a/platform/stm32f429/registers/ltdc.h +++ b/platform/stm32f429/registers/ltdc.h @@ -7,48 +7,51 @@ #define LTDC_REGISTER_AT(offset) (*(volatile uint32_t *)(LTDC_BASE+offset)) -// LTDC Synchronization size configuration register +// LTDC synchronization size configuration register #define LTDC_SSCR LTDC_REGISTER_AT(0x08) #define LOW_BIT_VSH 0 #define HIGH_BIT_VSH 10 #define LTDC_VSH(v) REGISTER_FIELD_VALUE(VSH, v) -#define LOW_BIT_HSW 15 +#define LOW_BIT_HSW 16 #define HIGH_BIT_HSW 27 #define LTDC_HSW(v) REGISTER_FIELD_VALUE(HSW, v) -// LTDC Back porch configuration register +// LTDC back porch configuration register #define LTDC_BPCR LTDC_REGISTER_AT(0x0C) #define LOW_BIT_AVBP 0 #define HIGH_BIT_AVBP 10 #define LTDC_AVBP(v) REGISTER_FIELD_VALUE(AVBP, v) -#define LOW_BIT_AHBP 15 +#define LOW_BIT_AHBP 16 #define HIGH_BIT_AHBP 27 #define LTDC_AHBP(v) REGISTER_FIELD_VALUE(AHBP, v) +// LTDC active width configuration register + +#define LTDC_AWCR LTDC_REGISTER_AT(0x10) + +#define LOW_BIT_AAH 0 +#define HIGH_BIT_AAH 10 +#define LTDC_AAH(v) REGISTER_FIELD_VALUE(AAH, v) +#define LOW_BIT_AAW 16 +#define HIGH_BIT_AAW 27 +#define LTDC_AAW(v) REGISTER_FIELD_VALUE(AAW, v) + +// LTDC total width configuration register + +#define LTDC_TWCR LTDC_REGISTER_AT(0x14) + +#define LOW_BIT_TOTALH 0 +#define HIGH_BIT_TOTALH 10 +#define LTDC_TOTALH(v) REGISTER_FIELD_VALUE(TOTALH, v) +#define LOW_BIT_TOTALW 16 +#define HIGH_BIT_TOTALW 27 +#define LTDC_TOTALW(v) REGISTER_FIELD_VALUE(TOTALW, v) + #if 0 -extern LTDC_BPCR_t * LTDC_BPCR; - -typedef struct { - unsigned int AAH:11; - unsigned int :5; - unsigned int AAW:12; - unsigned int :4; -} LTDC_AWCR_t; - -extern LTDC_AWCR_t * LTDC_AWCR; - -typedef struct { - unsigned int TOTALH:11; - unsigned int :5; - unsigned int TOTALW:12; - unsigned int :4; -} LTDC_TWCR_t; - -extern LTDC_TWCR_t * LTDC_TWCR; typedef struct { unsigned int LTDCEN:1;