/** * @brief Main program * @param None * @retval None */ int main(void) { uint32_t counter = 0, transparency = 0; uint8_t str[30]; /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup files (startup_stm32f429_439xx.s) before to branch to application main. */ /* TAMPER button will be used */ STM_EVAL_PBInit(BUTTON_TAMPER, BUTTON_MODE_GPIO); /* SysTick end of count event each 10ms */ SysTick_Config(SystemCoreClock / 1000); /* Configure LCD */ LCD_Config(); /* SD Card Configuration */ SDCard_Config(); /* Configure the File System */ FileSystem_Config(); /* Get the BMP file names on root directory */ ubNumberOfFiles = Storage_GetDirectoryBitmapFiles("/PICT", pDirectoryFiles); if (ubNumberOfFiles == 0) { for (counter = 0; counter < MAX_BMP_FILES; counter++) { free(pDirectoryFiles[counter]); } LCD_DisplayStringLine(LCD_LINE_8, (uint8_t*)" No Bitmap files... "); while(1) { } } while(1) { counter = 0; while ((counter) < ubNumberOfFiles) { /* Step1 : Display on Foreground layer -------------------------------*/ /* Format the string */ sprintf ((char*)str, "PICT/%-11.11s", pDirectoryFiles[counter]); if (Storage_CheckBitmapFile((const char*)str, &uwBmplen) == 0) { /* Format the string */ sprintf ((char*)str, "PICT/%-11.11s", pDirectoryFiles[counter]); /* Set LCD foreground Layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); /* Open a file and copy its content to an internal buffer */ Storage_OpenReadFile(uwInternelBuffer, (const char*)str); /* Write bmp file on LCD frame buffer */ LCD_WriteBMP(uwInternelBuffer); /* Configure the transparency for background layer : Increase the transparency */ for (transparency = 0; transparency < 255; (transparency++)) { LCD_SetTransparency(transparency); /* Insert a delay of display */ Delay(5); } /* Wait for tamper button pressed */ while (STM_EVAL_PBGetState(BUTTON_TAMPER) == Bit_SET) { } /* Configure the transparency for foreground layer : decrease the transparency */ for (transparency = 255; transparency > 0; transparency--) { LCD_SetTransparency(transparency); /* Insert a delay of display */ Delay(5); } /* Jump to the next image */ counter++; /* Step2 : Display on Background layer -----------------------------*/ /* Format the string */ sprintf ((char*)str, "PICT/%-11.11s", pDirectoryFiles[counter]); if ((Storage_CheckBitmapFile((const char*)str, &uwBmplen) == 0) || (counter < (ubNumberOfFiles))) { /* Connect the Output Buffer to LCD Background Layer */ LCD_SetLayer(LCD_BACKGROUND_LAYER); /* Format the string */ sprintf ((char*)str, "PICT/%-11.11s", pDirectoryFiles[counter]); /* Open a file and copy its content to an internal buffer */ Storage_OpenReadFile(uwInternelBuffer, (const char*)str); /* Write bmp file on LCD frame buffer */ LCD_WriteBMP(uwInternelBuffer); /* Configure the transparency for background layer : decrease the transparency */ for (transparency = 0; transparency < 255; (transparency++)) { LCD_SetTransparency(transparency); /* Insert a delay of display */ Delay(5); } /* wait for tamper button pressed */ while (STM_EVAL_PBGetState(BUTTON_TAMPER) == Bit_SET) { } /* Step3 : -------------------------------------------------------*/ /* Configure the transparency for background layer : Increase the transparency */ for (transparency = 255; transparency > 0; transparency--) { LCD_SetTransparency(transparency); /* Insert a delay of display */ Delay(5); } counter++; } else if (Storage_CheckBitmapFile((const char*)str, &uwBmplen) == 0) { /* Set the Text Color */ LCD_SetTextColor(LCD_COLOR_RED); LCD_DisplayStringLine(LCD_LINE_7, (uint8_t *) str); LCD_DisplayStringLine(LCD_LINE_8, (uint8_t*)" File type not supported. "); while(1) { } } } } } }
/** * @brief Main program * @param None * @retval None */ int main(void) { uint32_t counter = 0; uint8_t str[30]; /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup files (startup_stm32f429_439xx.s) before to branch to application main. */ /* Example resources configuration -----------------------------------------*/ /* Configure LCD */ LCD_Config(); /* Configure SD Card */ SDCard_Config(); /* Configure the File System */ FileSystem_Config(); /* Display Background picture ----------------------------------------------*/ /* Set Background Layer */ LCD_SetLayer(LCD_BACKGROUND_LAYER); /* Open directory */ if (f_opendir(&directory, "/BACK") != FR_OK) { /* Set the Text Color */ LCD_SetTextColor(LCD_COLOR_RED); LCD_DisplayStringLine(LCD_LINE_8, (uint8_t*)" Open directory.. fails"); while(1) { } } if (Storage_CheckBitmapFile("BACK/image.bmp", &uwBmplen) == 0) { /* Format the string */ Storage_OpenReadFile(uwInternelBuffer, "BACK/image.bmp"); /* Write bmp file on LCD frame buffer */ LCD_WriteBMP(uwInternelBuffer); } else { /* Set the Text Color */ LCD_SetTextColor(LCD_COLOR_RED); LCD_DisplayStringLine(LCD_LINE_8, (uint8_t*)" File type not supported. "); while(1) { } } /* Display Foreground pictures ---------------------------------------------*/ /* Set Foreground Layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); /* Decrease the foreground transprency */ LCD_SetTransparency(200); /* Get the BMP file names on root directory */ ubNumberOfFiles = Storage_GetDirectoryBitmapFiles("/TOP", pDirectoryFiles); if (ubNumberOfFiles == 0) { for (counter = 0; counter < MAX_BMP_FILES; counter++) { free(pDirectoryFiles[counter]); } /* Set the Text Color */ LCD_SetTextColor(LCD_COLOR_RED); LCD_DisplayStringLine(LCD_LINE_8, (uint8_t*)" No Bitmap files... "); while(1) { } } while(1) { counter = 0; while (counter < ubNumberOfFiles) { /* Format the string */ sprintf ((char*)str, "TOP/%-11.11s", pDirectoryFiles[counter]); if (Storage_CheckBitmapFile((const char*)str, &uwBmplen) == 0) { /* Format the string */ sprintf ((char*)str, "TOP/%-11.11s", pDirectoryFiles[counter]); /* Open a file and copy its content to a buffer */ Storage_OpenReadFile(uwInternelBuffer, (const char*)str); /* Write bmp file on LCD frame buffer */ LCD_WriteBMP(uwInternelBuffer); /* jump to next image */ counter++; } else { /* Set the Text Color */ LCD_SetTextColor(LCD_COLOR_RED); LCD_DisplayStringLine(LCD_LINE_7, (uint8_t *) str); LCD_DisplayStringLine(LCD_LINE_8, (uint8_t*)" File type not supported. "); while(1) { } } } } }