static void LCD_Config(void) { /* LCD Initialization */ LCD_Init(); /* LCD Initialization */ LCD_LayerInit(); /* Enable the LCD */ LCD_DisplayOn(); /* Connect the Output Buffer to LCD Background Layer */ LCD_SetLayer(LCD_BACKGROUND_LAYER); /* Clear the Background Layer */ LCD_Clear(LCD_COLOR_BLACK); /* Configure the transparency for background : Increase the transparency */ LCD_SetTransparency(0); /* Connect the Output Buffer to LCD Foreground Layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); /* Clear the Background Layer */ LCD_Clear(LCD_COLOR_BLACK); /* Configure the transparency for foreground : Increase the transparency */ LCD_SetTransparency(100); }
/** * @brief Display Init (LCD) * @param None * @retval None */ static void Display_Init(void) { /* Initialize the LCD */ LCD_Init(); LCD_LayerInit(); /* Enable the LTDC */ LTDC_Cmd(ENABLE); /* Set LCD Background Layer */ LCD_SetLayer(LCD_BACKGROUND_LAYER); /* Clear the Background Layer */ LCD_Clear(LCD_COLOR_WHITE); /* Configure the transparency for background */ LCD_SetTransparency(0); /* Set LCD Foreground Layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); /* Configure the transparency for foreground */ LCD_SetTransparency(200); /* Clear the Foreground Layer */ LCD_Clear(LCD_COLOR_WHITE); /* Set the LCD Back Color and Text Color*/ LCD_SetBackColor(LCD_COLOR_BLUE); LCD_SetTextColor(LCD_COLOR_WHITE); /* Set the LCD Text size */ LCD_SetFont(&FONTSIZE); /* Set the LCD Back Color and Text Color*/ LCD_SetBackColor(LCD_COLOR_BLUE); LCD_SetTextColor(LCD_COLOR_WHITE); LCD_DisplayStringLine(LINE(LINENUM), (uint8_t*)MESSAGE1); LCD_DisplayStringLine(LINE(LINENUM + 1), (uint8_t*)MESSAGE1_1); LCD_DisplayStringLine(LINE(0x17), (uint8_t*)" "); /* Set the LCD Text size */ LCD_SetFont(&Font16x24); LCD_DisplayStringLine(LCD_LINE_0, (uint8_t*)MESSAGE2); LCD_DisplayStringLine(LCD_LINE_1, (uint8_t*)MESSAGE2_1); /* Set the LCD Back Color and Text Color*/ LCD_SetBackColor(LCD_COLOR_WHITE); LCD_SetTextColor(LCD_COLOR_BLUE); }
static void LCD_Config(void) { /* LCD Initialization */ LCD_Init(); /* LCD Layers Initialization */ LCD_LayerInit(); /* Enable the LCD */ LCD_DisplayOn(); /* Set LCD Background Layer */ LCD_SetLayer(LCD_BACKGROUND_LAYER); /* Clear the Background Layer */ LCD_Clear(LCD_COLOR_WHITE); /* Set LCD Foreground Layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); /* Clear the Foreground Layer */ LCD_Clear(LCD_COLOR_WHITE); /* Configure and enable the Color Keying feature */ LCD_SetColorKeying(0); /* Configure the transparency for foreground : Increase the transprency */ LCD_SetTransparency(100); }
/** * @brief LCD configuration. * @note This function Configure tha LTDC peripheral : * 1) Configure the Pixel Clock for the LCD * 2) Configure the LTDC Timing and Polarity * 3) Configure the LTDC Layer 1 : * - ARGB4444 as pixel format * - The frame buffer is located at internal RAM : The output of DMA2D transfer * - The Layer size configuration : 150x150 * @retval * None */ static void LCD_Config(void) { /* Initialize the LCD */ LCD_Init(); /* Initialize the LCD Layers */ LCD_LayerInit(); /* Set the Foreground as active Layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); LCD_SetTransparency(0); /* Set the Background as active Layer */ LCD_SetLayer(LCD_BACKGROUND_LAYER); /* Configure the window size and position */ LCD_SetDisplayWindow(165, 61, 150, 150); /* Configure the LCD Pixel Format */ LCD_SetPixelFormat(LTDC_Pixelformat_ARGB4444); /* Configure the LCD frame Buffer Address */ LCD_SetAddress((uint32_t)&aBufferResult); }
int main(void) { LCD_Init(); LCD_LayerInit(); /* LTDC reload configuration */ LTDC_ReloadConfig(LTDC_IMReload); /* Enable the LTDC */ LTDC_Cmd(ENABLE); /* Set LCD foreground layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); LCD_SetTransparency(0); /* Set LCD background layer */ LCD_SetLayer(LCD_BACKGROUND_LAYER); /* LCD display message */ LCD_Clear(LCD_COLOR_RED); LCD_SetTextColor(LCD_COLOR_BLACK); LCD_DisplayStringLine(LCD_LINE_2,(uint8_t*)" YOU'LL "); LCD_DisplayStringLine(LCD_LINE_4,(uint8_t*)" NEVER "); LCD_DisplayStringLine(LCD_LINE_6,(uint8_t*)" TAKE "); LCD_DisplayStringLine(LCD_LINE_8,(uint8_t*)" ME "); LCD_DisplayStringLine(LCD_LINE_10,(uint8_t*)" ALIVE "); while(1) { } }
void LCDinit(){ LCD_Init(); LCD_LayerInit(); LCD_SetLayer(LCD_BACKGROUND_LAYER); LCD_SetTransparency(0); LCD_SetLayer(LCD_FOREGROUND_LAYER); LTDC_ReloadConfig(LTDC_IMReload); LTDC_Cmd(ENABLE); LCD_Clear(LCD_COLOR_BLACK); }
/** * @brief Display Init (LCD) * @param None * @retval None */ void Display_Init(void) { /* Initialize the LCD */ LCD_Init(); /* Display message on LCD ***************************************************/ #if defined (USE_STM324x9I_EVAL) /* Initialize the LCD Layers */ LCD_LayerInit(); /* Enable The Display */ LCD_DisplayOn(); /* Set LCD Background Layer */ LCD_SetLayer(LCD_BACKGROUND_LAYER); /* Clear the Background Layer */ LCD_Clear(LCD_COLOR_WHITE); /* Set LCD Foreground Layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); /* Configure the transparency for foreground */ LCD_SetTransparency(100); #endif /* USE_STM324x9I_EVAL */ /* Clear the LCD */ LCD_Clear(White); /* Set the LCD Text size */ LCD_SetFont(&FONTSIZE); /* Set the LCD Back Color and Text Color*/ LCD_SetBackColor(Blue); LCD_SetTextColor(White); LCD_DisplayStringLine(LINE(LINENUM), (uint8_t*)MESSAGE1); LCD_DisplayStringLine(LINE(0x16), (uint8_t*)" "); /* Set the LCD Text size */ LCD_SetFont(&Font16x24); LCD_DisplayStringLine(LCD_LINE_0, (uint8_t*)MESSAGE2); /* Set the LCD Back Color and Text Color*/ LCD_SetBackColor(White); LCD_SetTextColor(Blue); LCD_DisplayStringLine(LCD_LINE_2, (uint8_t*)MESSAGE3); LCD_DisplayStringLine(LCD_LINE_4, (uint8_t*)MESSAGE4); }
/** * @brief USBH_USR_Init * Displays the message on LCD for host lib initialization * @param None * @retval None */ void USBH_USR_Init(void) { static uint8_t startup = 0; if(startup == 0 ) { startup = 1; /* Configure the LEDs */ STM_EVAL_LEDInit(LED3); STM_EVAL_LEDInit(LED4); STM_EVAL_PBInit(BUTTON_USER, BUTTON_MODE_GPIO); /* Initialize the LCD */ LCD_Init(); LCD_LayerInit(); /* Set LCD background layer */ LCD_SetLayer(LCD_BACKGROUND_LAYER); /* Set LCD transparency */ LCD_SetTransparency(0); /* Set LCD foreground layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); /* LTDC reload configuration */ LTDC_ReloadConfig(LTDC_IMReload); /* Enable the LTDC */ LTDC_Cmd(ENABLE); /* LCD Log initialization */ LCD_LOG_Init(); #ifdef USE_USB_OTG_HS LCD_LOG_SetHeader("PDF Create"); #else LCD_LOG_SetHeader(" USB OTG FS MSC Host"); #endif LCD_UsrLog("> USB Host library started.\n"); LCD_LOG_SetFooter (" USB Host Library v2.1.0" ); } }
static void LCD_Config(void) { /* Initialise the LCD */ LCD_Init(); /* Initialise the LCD Layers */ LCD_LayerInit(); /* Set the Foreground as active Layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); LCD_SetTransparency(0); /* Set the Background as active Layer */ LCD_SetLayer(LCD_BACKGROUND_LAYER); /* Configure the window size and position */ LCD_SetDisplayWindow(120, 70, 130, 240); /* Configure the LCD frame Buffer Address */ LCD_SetAddress((uint32_t)&aBlendedImage); }
void lcd_init(void) { LCD_Init(); LCD_LayerInit(); SysTick_init (); pushbutton_init(); /* Enable the LTDC */ LTDC_Cmd(ENABLE); /* Set LCD foreground layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); LCD_SetTransparency(0); /* Set LCD background layer */ LCD_SetLayer(LCD_BACKGROUND_LAYER); /* LCD display message */ LCD_Clear(LCD_COLOR_BLACK); LCD_SetBackColor(LCD_COLOR_BLACK); LCD_SetTextColor(LCD_COLOR_WHITE); }
/** * @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) { } } } } }
/** * @brief Display Init (LCD or/and USART) * @param None * @retval None */ static void Display_Init(void) { #ifdef PRINT_ON_USART USART_InitTypeDef USART_InitStructure; /* USARTx configured as follows: - BaudRate = 115200 baud - Word Length = 8 Bits - One Stop Bit - No parity - Hardware flow control disabled (RTS and CTS signals) - Receive and transmit enabled */ USART_InitStructure.USART_BaudRate = 115200; USART_InitStructure.USART_WordLength = USART_WordLength_8b; USART_InitStructure.USART_StopBits = USART_StopBits_1; USART_InitStructure.USART_Parity = USART_Parity_No; USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; STM_EVAL_COMInit(COM1, &USART_InitStructure); printf("\n\r ========================================\n"); printf("\n\r ==== Multiple RNG Generator Example ====\n"); printf("\n\r ======================================== \n\n\r"); printf("\n\r Press key button to generate 8 x 32bit random number\n"); #endif #ifdef PRINT_ON_LCD /* Initialize the LCD */ LCD_Init(); /* Display message on LCD ***************************************************/ #if defined (USE_STM324x9I_EVAL) /* Initialize the LCD Layers */ LCD_LayerInit(); /* Enable The Display */ LCD_DisplayOn(); /* Set LCD Background Layer */ LCD_SetLayer(LCD_BACKGROUND_LAYER); /* Clear the Background Layer */ LCD_Clear(LCD_COLOR_WHITE); /* Set LCD Foreground Layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); /* Configure the transparency for foreground */ LCD_SetTransparency(100); #endif /* USE_STM324x9I_EVAL */ /* Clear the LCD */ LCD_Clear(White); /* Set the LCD Text size */ LCD_SetFont(&FONTSIZE); /* Set the LCD Back Color and Text Color*/ LCD_SetBackColor(Blue); LCD_SetTextColor(White); LCD_DisplayStringLine(LINE(LINENUM), (uint8_t*)MESSAGE1); LCD_DisplayStringLine(LINE(0x16), (uint8_t*)" "); /* Set the LCD Text size */ LCD_SetFont(&Font16x24); LCD_DisplayStringLine(LINE(0), (uint8_t*)MESSAGE2); /* Set the LCD Back Color and Text Color*/ LCD_SetBackColor(White); LCD_SetTextColor(Blue); LCD_DisplayStringLine(LINE(3), (uint8_t*)MESSAGE3); LCD_DisplayStringLine(LINE(5), (uint8_t*)MESSAGE4); #endif }
static inline void set_backlight(GDisplay *g, uint8_t percent) { (void) g; uint16_t i = (percent * 0xFF) / 100; LCD_SetTransparency((uint8_t)i); }
int main(void) { LCD_Init(); LCD_LayerInit(); SysTick_init (); pushbutton_init(); /* Enable the LTDC */ LTDC_Cmd(ENABLE); /* Set LCD foreground layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); LCD_SetTransparency(0); /* Set LCD background layer */ LCD_SetLayer(LCD_BACKGROUND_LAYER); /* LCD display message */ LCD_Clear(LCD_COLOR_BLUE); LCD_SetBackColor(LCD_COLOR_BLUE); LCD_SetTextColor(LCD_COLOR_WHITE); std::stringstream output; std::string outputstring; const char * chararray; Timer mytimerobject(12,34,56); LCD_DisplayStringLine(LCD_LINE_0,(uint8_t*)"h_da "); LCD_DisplayStringLine(LCD_LINE_1,(uint8_t*)"RZS "); LCD_DisplayStringLine(LCD_LINE_2,(uint8_t*)"WS 15/16 "); STM_EVAL_LEDInit(LED3); STM_EVAL_LEDInit(LED4); // Super loop while(1) { switch(get_event()){ case TICK: if(mystate==RUNNING) systick_count++; output.str(std::string()); mytimerobject.setMin(systick_count/100/60); mytimerobject.setSec(systick_count/100); mytimerobject.setHun(systick_count/1); output << "Time " << mytimerobject.printtime(); outputstring = ""; outputstring = output.str(); chararray = ""; chararray = outputstring.c_str(); LCD_DisplayStringLine(LCD_LINE_3,(uint8_t*) chararray); LCD_ClearLine(LCD_LINE_4); break; case START_STOP: LCD_DisplayStringLine(LCD_LINE_4,(uint8_t*) "START_STOP"); if(mystate == RUNNING) { mystate = HALTED; LCD_ClearLine(LCD_LINE_5); LCD_DisplayStringLine(LCD_LINE_5,(uint8_t*) "HALTED"); } else if(mystate == HALTED) { mystate = RUNNING; LCD_DisplayStringLine(LCD_LINE_5,(uint8_t*) "RUNNING"); } break; default: break; } } }