/** * @brief LCD demo * @param None * @retval None */ void LCD_demo(void) { LCD_SetHint(); LCD_Feature = 0; LCD_Show_Feature (LCD_Feature); while (1) { if(CheckForUserInput() > 0) { if(++LCD_Feature < LCD_FEATURES_NUM) { LCD_Show_Feature (LCD_Feature); } else { return; } } HAL_Delay(100); } }
/** * @brief Show LCD Features * @param feature_index : feature index * @retval None */ static void LCD_Show_Feature(uint8_t feature_index) { uint8_t lcd_status = LCD_OK; if(feature_index < LCD_FEAT_NB_MAX) { LCD_SetHint(feature_index); BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); /* Clear in white the internal part of rectangle */ BSP_LCD_FillRect(12, 92, BSP_LCD_GetXSize() - 24, BSP_LCD_GetYSize() - 104); BSP_LCD_SetTextColor(LCD_COLOR_BLACK); switch(feature_index) { case LCD_FEAT_TEXT : /* Keep default LCD/DSI and LTDC Mode for this demo item */ LCD_Show_FeatureText(); break; case LCD_FEAT_SIMPLE_SHAPES : /* Keep default LCD/DSI and LTDC Mode for this demo item */ LCD_Show_FeatureSimpleShapes(); break; case LCD_FEAT_BASIC_BITMAP : /* Keep default LCD/DSI and LTDC Mode for this demo item */ LCD_Show_FeatureBasicBitmap(); break; case LCD_FEAT_ULPM_DATA_ONLY : BSP_LCD_SetFont(&Font16); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() / 2, (uint8_t *)"Only testable in mode Video Burst", CENTER_MODE); break; case LCD_FEAT_ULPM_DATA_AND_CLOCK : BSP_LCD_SetFont(&Font16); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() / 2, (uint8_t *)"Only testable in mode Video Burst", CENTER_MODE); break; default : break; } /* of switch(feature_index) */ } /* of if(feature_index < LCD_FEAT_NB_MAX) */ else if(feature_index == LCD_FEAT_NB_MAX) { /* Just after last index, restore the normal BSP LCD mode for following tests of the BSP display results */ /* Proceed to LTDC and DSI initialization with the configuration filled in above */ lcd_status = BSP_LCD_Init(); while(lcd_status != LCD_OK); /* Clear the LCD */ BSP_LCD_Clear(LCD_COLOR_WHITE); /* Print text to Describe the current LCD DSI configuration */ /* Print text to Describe the current LCD DSI configuration */ BSP_LCD_SetTextColor(LCD_COLOR_BLACK); BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetFont(&Font16); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() / 2 - 20, (uint8_t *)"Successfully restored", CENTER_MODE); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() / 2 - 0, (uint8_t *)"Default LCD Mode.", CENTER_MODE); BSP_LCD_DisplayStringAt(0, BSP_LCD_GetYSize() / 2 + 20, (uint8_t *)"Press on TAMPER button to switch to next demo", CENTER_MODE); } /* of else if(feature_index == LCD_FEAT_NB_MAX) */ }