最近在stm32f429
discover板上驱动7寸屏(800X480),
stm32f429内部带屏的驱动器LTDC,之前在r板上运行网上的emwin很正常,但是屏幕是2.4寸的,现在改为7寸屏,可以显示但是显示的尺寸跟分辨率不对,
我的相关配置如下,这个问题让我纠结好久了,希望知道的大大给我指点一下,不胜感激,必有重谢!
另附图片
[mw_shl_code=c,true]#define LCD_PIXEL_WIDTH ((uint16_t)800)
#define LCD_PIXEL_HEIGHT ((uint16_t)480)
#define HSW ((uint16_t)48) /* Horizontal synchronization */
#define HBP ((uint16_t)40) /* Horizontal back porch */
#define HFP ((uint16_t)40) /* Horizontal front porch */
#define VSW ((uint16_t)3) /* Vertical synchronization */
#define VBP ((uint16_t)29) /* Vertical back porch */
#define VFP ((uint16_t)13) /* Vertical front porch */
#define HSTART (HBP)
#define HSTOP (LCD_PIXEL_WIDTH+HSTART)
#define VSTART (VBP)
#define VSTOP (LCD_PIXEL_HEIGHT+VSTART)
#define LCD_FRAME_BUFFER ((uint32_t)0xD0000000) //LCD?????????×???·?????·SDRAM
#define BUFFER_OFFSET ((uint32_t)0x60000)
void LCD_Init(void)函数中:
RCC_PLLSAIConfig(192, 7, 4);
RCC_LTDCCLKDivConfig(RCC_PLLSAIDivR_Div2);//RCC_PLLSAIDivR_Div8
/* Enable PLLSAI Clock */
RCC_PLLSAICmd(ENABLE);
/* Wait for PLLSAI activation */
while(RCC_GetFlagStatus(RCC_FLAG_PLLSAIRDY) == RESET)
{
}
//?±?ò?????????????ó????×???
/* Timing configuration */
/* Configure horizontal synchronization width */
LTDC_InitStruct.LTDC_HorizontalSync = HSW-1;
/* Configure vertical synchronization height */
LTDC_InitStruct.LTDC_VerticalSync = VSW-1;
/* Configure accumulated horizontal back porch */
LTDC_InitStruct.LTDC_AccumulatedHBP = HBP-1;
/* Configure accumulated vertical back porch */
LTDC_InitStruct.LTDC_AccumulatedVBP = VBP-1;
/* Configure accumulated active width */
LTDC_InitStruct.LTDC_AccumulatedActiveW = LCD_PIXEL_WIDTH + HBP-1;
/* Configure accumulated active height */
LTDC_InitStruct.LTDC_AccumulatedActiveH = LCD_PIXEL_HEIGHT + VBP-1;
/* Configure total width */
LTDC_InitStruct.LTDC_TotalWidth = LCD_PIXEL_WIDTH + HBP + HFP-1;
/* Configure total height */
LTDC_InitStruct.LTDC_TotalHeigh = LCD_PIXEL_HEIGHT + VBP + VFP-1;
LTDC_Init(<DC_InitStruct);
static void _LCD_InitController(int LayerIndex) 函数中:
xSize = LCD_GetXSizeEx(LayerIndex);
ySize = LCD_GetYSizeEx(LayerIndex);
LTDC_Layer_InitStruct.LTDC_HorizontalStart = HSTART;
LTDC_Layer_InitStruct.LTDC_HorizontalStop = (xSize + HSTART-1);
LTDC_Layer_InitStruct.LTDC_VerticalStart = VSTART;
LTDC_Layer_InitStruct.LTDC_VerticalStop = (ySize + VSTART-1);[/mw_shl_code]
[mw_shl_code=c,true]
[/mw_shl_code]
---------------------------------
我试过了272x480的屏,不加SDRAM ,可以将屏刷成单颜 {MOD},但是要移植个emwin就不知道怎么弄了
一周热门 更多>