各位好,
想与各位请教,我现在尝试建立FatFS的方式读取SDCard中的 JPG,想以硬体解码的方式透过DMA2D显示于屏幕上。
已参考过官方例子,但似乎在某些部分有点问题(STM32CubeMX 中 JPEG_DecodingUsingFs_DMA )
以下为移植后程序,进入#8(do..while)后却无法结束void HWJPEG(void)
{
FRESULT ret;
uint32_t xPos = 0, yPos = 0;
ret = f_mount(&SDFatFS,SDPath,0);
if(ret != FR_OK)
{
printf("Mount Failed!\r\n");
}
printf("Mount Success!\r\n");
//Cause of too quick and not get
HAL_Delay(60);
ret = f_open(&SDFile,IMAGE_FILE,FA_READ);
if(ret != FR_OK)
{
printf("Open Failed!\r\n");
}
else
{
printf("Open Success!\r\n");
/*##-7- JPEG decoding with DMA (Not Blocking ) Method ################*/
JPEG_Decode_DMA(&hjpeg, &SDFile, JPEG_OUTPUT_DATA_BUFFER);
/*##-8- Wait till end of JPEG decoding and perfom Input Processing in BackGround #*/
do
{
JpegProcessing_End = JPEG_InputHandler(&hjpeg);
}while(JpegProcessing_End == 0);
/*##-9- Get JPEG Info ###############################################*/
HAL_JPEG_GetInfo(&hjpeg, &JPEG_Info);
/*##-10- Copy RGB decoded Data to the display FrameBuffer ############*/
xPos = (BSP_LCD_GetXSize() - JPEG_Info.ImageWidth)/2;
yPos = (BSP_LCD_GetYSize() - JPEG_Info.ImageHeight)/2;
DMA2D_CopyBuffer((uint32_t *)JPEG_OUTPUT_DATA_BUFFER, (uint32_t *)LCD_FRAME_BUFFER, xPos , yPos, JPEG_Info.ImageWidth, JPEG_Info.ImageHeight, JPEG_Info.ChromaSubsampling);
}
f_close(&SDFile);
}复制代码
不知板上各位是否有此相关的经验可以给予参考呢?
感谢!! |