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); }
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); /* Configure the window size and position */ LCD_SetDisplayWindow(90, 137, 120, 300); /* Configure the LCD frame Buffer Address */ LCD_SetAddress((uint32_t)&aBufferResult); /* Configure the LCD Pixel Format */ LCD_SetPixelFormat(LTDC_Pixelformat_ARGB4444); /* Set the Background as active Layer */ LCD_SetLayer(LCD_BACKGROUND_LAYER); /* Configure the window size and position */ LCD_SetDisplayWindow(90, 15, 120, 300); /* Configure the LCD frame Buffer Address */ LCD_SetAddress((uint32_t)&ARGB8888_300x120); /* Configure the LCD Pixel Format */ LCD_SetPixelFormat(LTDC_Pixelformat_ARGB8888); }
/** * @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); }
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); }
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 */ 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); }
/** * @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); }
/* * Main function: initializes all system values and components, then starts * operation of the two threads. * * @author HP Truong, Jacob Barnett * * @param void * @return void */ int main (void) { CC2500_LowLevel_Init(); CC2500_Reset(); osKernelInitialize (); // initialize CMSIS-RTOS // initialize peripherals here /* LCD initiatization */ LCD_Init(); /* LCD Layer initiatization */ LCD_LayerInit(); /* Enable the LTDC controler */ LTDC_Cmd(ENABLE); /* Set LCD foreground layer as the current layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); LCD_SetFont(&Font16x24); LCD_Clear(LCD_COLOR_WHITE); receive_and_plot_thread = osThreadCreate(osThread(receive_and_plot), NULL); print_lcd_debug_thread = osThreadCreate(osThread(print_lcd_debug), NULL); osKernelStart (); // start thread execution }
/** * @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" ); } }
void prvInit() { //LCD init LCD_Init(); IOE_Config(); LTDC_Cmd( ENABLE ); LCD_LayerInit(); LCD_SetLayer( LCD_BACKGROUND_LAYER ); LCD_Clear( LCD_COLOR_BLACK ); LCD_SetLayer( LCD_FOREGROUND_LAYER ); LCD_Clear( LCD_COLOR_BLACK ); LCD_SetTextColor( LCD_COLOR_WHITE ); //Button STM_EVAL_PBInit( BUTTON_USER, BUTTON_MODE_GPIO ); }
/*===========================================================================*/ static inline void init_board(GDisplay *g) { g->board = 0; /* Init LCD and LTCD. Enable layer1 only. */ LCD_Init(); LCD_LayerInit(); LTDC_LayerCmd(LTDC_Layer1, ENABLE); LTDC_LayerCmd(LTDC_Layer2, DISABLE); LTDC_ReloadConfig(LTDC_IMReload); LTDC_Cmd(ENABLE); LCD_SetLayer(LCD_BACKGROUND_LAYER); }
void ui_swap_layer() { LTDC_LayerAlpha(layer_buffers[hidden_layer].LTDC_Layer, 0xff); LTDC_LayerAlpha(layer_buffers[show_layer].LTDC_Layer, 0x00); LCD_SetLayer(layer_buffers[show_layer].LCD_Layer); LTDC_ReloadConfig(LTDC_IMReload); LCD_Clear(LCD_COLOR_WHITE); show_layer = !show_layer; hidden_layer = !hidden_layer; }
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); }
/** * @brief Main Function * @param * @retval int 0 */ int main (void) { osKernelInitialize (); // initialize CMSIS-RTOS wireless_init(); //Initialize wireless LCD_Init(); //Initialize LCD LCD_LayerInit(); //Initialize Layer /* Enable the LTDC controler */ LTDC_Cmd(ENABLE); /* Set LCD foreground layer as the current layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); DisplayLCD_thread = osThreadCreate(osThread(DisplayLCD), NULL); Rx_thread = osThreadCreate(osThread(RxPacket), NULL); osKernelStart(); }
void ILI9341_Configuration() { /** * @brief ILI9341 Configuration * Do not change the following except you had known all * configurations. */ LCD_Init(); LTDC_Cmd( ENABLE ); LCD_LayerInit(); LCD_SetLayer(LCD_FOREGROUND_LAYER ); LCD_Clear(LCD_COLOR_BLACK ); LCD_SetTextColor(LCD_COLOR_BLACK ); }
void r3dfb_swap_buffers(void) { uint32_t tmp = r3dfb_front_buffer; r3dfb_front_buffer = r3dfb_back_buffer; r3dfb_back_buffer = tmp; // hack for font rendering LCD_SetLayer(r3dfb_back_buffer == R3DFB_BUFFER0 ? LCD_BACKGROUND_LAYER : LCD_FOREGROUND_LAYER); LTDC_Cmd(DISABLE); LTDC_LayerAddress(LTDC_Layer1, r3dfb_front_buffer); LTDC_ReloadConfig(LTDC_IMReload); LTDC_Cmd(ENABLE); }
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) { /*!< 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. To reconfigure the default setting of SystemInit() function, refer to system_stm32f4xx.c file */ /* SysTick end of count event each 10ms */ RCC_GetClocksFreq(&RCC_Clocks); SysTick_Config(RCC_Clocks.HCLK_Frequency / 100); /* Initialize the LCD */ LCD_Init(); /* Initialize the LCD Layers*/ LCD_LayerInit(); /* Enable the LTDC */ LTDC_Cmd(ENABLE); /* Set LCD Background Layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); /* Clear the Background Layer */ LCD_Clear(LCD_COLOR_WHITE); /* Gyroscope configuration */ Demo_GyroConfig(); /* Gyroscope calibration */ Gyro_SimpleCalibration(Gyro); /* Infinite loop */ while (1) { Demo_MEMS(); } }
void ui_task() { LCD_SetLayer(layer_buffers[hidden_layer].LCD_Layer); ui_swap_layer(); TP_Config(); //test code , wait for real value hz = 33; while(1){ if(mode == TUNER_MODE){ ui_start_tuner(); } if(mode == METRONOME_MODE){ ui_start_metronome(); } SLEEP(10); hz++; } }
static void LCD_Config(void) { /* Initialise the LCD */ LCD_Init(); /* Initialise the LCD Layers */ LCD_LayerInit(); /* Clear the Hole LCD */ LCD_Clear(LCD_COLOR_WHITE); /* Set the Foreground as active Layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); /* Configure the window size and position */ LCD_SetDisplayWindow(0, 0, 100, 100); /* Configure the LCD frame Buffer Address */ LCD_SetAddress((uint32_t)&aBufferResult); /* Configure the LCD Pixel Format */ LCD_SetPixelFormat(LTDC_Pixelformat_ARGB4444); }
/** * @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) { } } } } }
static void DrawText(uint8_t* text) { /* Windowing configuration */ /* In this case all the active display area is used to display a picture then : Horizontal start = horizontal synchronization + Horizontal back porch = 30 Horizontal stop = Horizontal start + window width -1 = 30 + 240 -1 Vertical start = vertical synchronization + vertical back porch = 4 Vertical stop = Vertical start + window height -1 = 4 + 320 -1 */ LTDC_Layer_InitStruct.LTDC_HorizontalStart = 30; LTDC_Layer_InitStruct.LTDC_HorizontalStop = (LCD_PIXEL_WIDTH + 30 - 1); LTDC_Layer_InitStruct.LTDC_VerticalStart = 4 + 10; LTDC_Layer_InitStruct.LTDC_VerticalStop = (ImageSTLogo_height + 4 + 10 + LOGO_OFFSET_LINES - 1); /* Pixel Format configuration*/ LTDC_Layer_InitStruct.LTDC_PixelFormat = LTDC_Pixelformat_RGB565; /* Alpha constant (255 totally opaque) */ LTDC_Layer_InitStruct.LTDC_ConstantAlpha = 255; /* Default Color configuration (configure A,R,G,B component values) */ LTDC_Layer_InitStruct.LTDC_DefaultColorBlue = 0; LTDC_Layer_InitStruct.LTDC_DefaultColorGreen = 0; LTDC_Layer_InitStruct.LTDC_DefaultColorRed = 0; LTDC_Layer_InitStruct.LTDC_DefaultColorAlpha = 0; /* 0 = transparent */ /* the length of one line of pixels in bytes + 3 then : Line Lenth = Active high width x number of bytes per pixel + 3 Active high width = LCD_PIXEL_WIDTH number of bytes per pixel = 2 (pixel_format : RGB565) */ LTDC_Layer_InitStruct.LTDC_CFBLineLength = ((LCD_PIXEL_WIDTH * 2) + 3); /* the pitch is the increment from the start of one line of pixels to the start of the next line in bytes, then : Pitch = Active high width x number of bytes per pixel */ LTDC_Layer_InitStruct.LTDC_CFBPitch = (LCD_PIXEL_WIDTH * 2); /* Configure the number of lines */ LTDC_Layer_InitStruct.LTDC_CFBLineNumber = LCD_PIXEL_HEIGHT; /* Configure Layer2 */ /* Start Address configuration : the LCD Frame buffer is defined on SDRAM w/ Offset */ LTDC_Layer_InitStruct.LTDC_CFBStartAdress = LCD_FRAME_BUFFER + BUFFER_OFFSET; /* Configure blending factors */ LTDC_Layer_InitStruct.LTDC_BlendingFactor_1 = LTDC_BlendingFactor1_PAxCA; LTDC_Layer_InitStruct.LTDC_BlendingFactor_2 = LTDC_BlendingFactor2_PAxCA; /* Initialize LTDC layer 2 */ LTDC_LayerInit(LTDC_Layer2, <DC_Layer_InitStruct); /* LTDC configuration reload */ LTDC_ReloadConfig(LTDC_IMReload); /* Enable foreground & background Layers */ LTDC_LayerCmd(LTDC_Layer2, ENABLE); /* Set default font */ LCD_SetFont(&LCD_DEFAULT_FONT); /* Set LCD foreground layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); /* LCD display message */ LCD_Clear(LCD_COLOR_WHITE); LCD_SetFont(&Font12x12); LCD_SetTextColor(LCD_COLOR_RED); LCD_SetBackColor(LCD_COLOR_WHITE); LCD_DisplayStringLine(LCD_LINE_1,(uint8_t*)text); }
/** * @brief Main program * @param None * @retval None */ int main(void) { uint16_t linenum = 0; static TP_STATE* TP_State; /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f429_439xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f4xx.c file */ /* LCD initialization */ LCD_Init(); /* LCD Layer initialization */ LCD_LayerInit(); /* Enable the LTDC */ LTDC_Cmd(ENABLE); /* Set LCD foreground layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); /* Touch Panel configuration */ TP_Config(); while (1) { TP_State = IOE_TP_GetState(); if((TP_State->TouchDetected) && ((TP_State->Y < 245) && (TP_State->Y >= 3))) { if((TP_State->X >= 237) || (TP_State->X < 3)) {} else { LCD_DrawFullCircle(TP_State->X, TP_State->Y, 3); } } else if ((TP_State->TouchDetected) && (TP_State->Y <= 280) && (TP_State->Y >= 250) && (TP_State->X >= 5) && (TP_State->X <= 35)) { LCD_SetTextColor(LCD_COLOR_BLUE2); } else if ((TP_State->TouchDetected) && (TP_State->Y <= 280) && (TP_State->Y >= 250) && (TP_State->X >= 40) && (TP_State->X <= 70)) { LCD_SetTextColor(LCD_COLOR_CYAN); } else if ((TP_State->TouchDetected) && (TP_State->Y <= 280) && (TP_State->Y >= 250) && (TP_State->X >= 75) && (TP_State->X <= 105)) { LCD_SetTextColor(LCD_COLOR_YELLOW); } else if ((TP_State->TouchDetected) && (TP_State->Y <= 318) && (TP_State->Y >= 288) && (TP_State->X >= 5) && (TP_State->X <= 35)) { LCD_SetTextColor(LCD_COLOR_RED); } else if ((TP_State->TouchDetected) && (TP_State->Y <= 318) && (TP_State->Y >= 288) && (TP_State->X >= 40) && (TP_State->X <= 70)) { LCD_SetTextColor(LCD_COLOR_BLUE); } else if ((TP_State->TouchDetected) && (TP_State->Y <= 318) && (TP_State->Y >= 288) && (TP_State->X >= 75) && (TP_State->X <= 105)) { LCD_SetTextColor(LCD_COLOR_GREEN); } else if ((TP_State->TouchDetected) && (TP_State->Y <= 318) && (TP_State->Y >= 288) && (TP_State->X >= 110) && (TP_State->X <= 140)) { LCD_SetTextColor(LCD_COLOR_BLACK); } else if ((TP_State->TouchDetected) && (TP_State->Y <= 318) && (TP_State->Y >= 288) && (TP_State->X >= 145) && (TP_State->X <= 175)) { LCD_SetTextColor(LCD_COLOR_MAGENTA); } else if ((TP_State->TouchDetected) && (TP_State->Y <= 318) && (TP_State->Y >= 270) && (TP_State->X >= 180) && (TP_State->X <= 230)) { LCD_SetFont(&Font8x8); for(linenum = 0; linenum < 31; linenum++) { LCD_ClearLine(LINE(linenum)); } } else { } } }
/** * @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 }
/** * @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) { } } } } } }
int main(void) { /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f4xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f4xx.c file */ //initiate user button PB_Config(); //initiate LEDs and turn them on LED_Config(); /* ----------------------------------------------------------------------- TIM3 Configuration: Output Compare Timing Mode: In this example TIM3 input clock (TIM3CLK) is set to 2 * APB1 clock (PCLK1), since APB1 prescaler is different from 1. TIM3CLK = 2 * PCLK1 PCLK1 = HCLK / 4 => TIM3CLK = HCLK / 2 = SystemCoreClock /2 To get TIM3 counter clock at 50 MHz, the prescaler is computed as follows: Prescaler = (TIM3CLK / TIM3 counter clock) - 1 Prescaler = ((SystemCoreClock /2) /0.5 MHz) - 1 CC1 update rate = TIM3 counter clock / CCR1_Val = 10.0 Hz ==> Toggling frequency = 5 Hz Note: SystemCoreClock variable holds HCLK frequency and is defined in system_stm32f4xx.c file. Each time the core clock (HCLK) changes, user had to call SystemCoreClockUpdate() function to update SystemCoreClock variable value. Otherwise, any configuration based on this variable will be incorrect. ----------------------------------------------------------------------- */ //=======================Configure and init Timer====================== /* Compute the prescaler value */ PrescalerValue = (uint16_t) ((SystemCoreClock / 2) / 500000) - 1; /* TIM Configuration */ TIM3_Config(); // configure the output compare TIM3_OCConfig(); /* TIM Interrupts enable */ TIM_ITConfig(TIM3, TIM_IT_CC1, ENABLE); /* TIM3 enable counter */ TIM_Cmd(TIM3, ENABLE); //======================================configure and init LCD ====================== /* LCD initiatization */ LCD_Init(); /* LCD Layer initiatization */ LCD_LayerInit(); /* Enable the LTDC */ LTDC_Cmd(ENABLE); /* Set LCD foreground layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); //================EEPROM init==================================== /* Unlock the Flash Program Erase controller */ FLASH_Unlock(); /* EEPROM Init */ EE_Init(); //============ Set up for random number generation============== RNG_Config(); //with the default font, LCD can display 12 lines of chars, they are LINE(0), LINE(1)...LINE(11) //with the default font, LCD can display 15 columns, they are COLUMN(0)....COLUMN(14) LCD_Clear(LCD_COLOR_WHITE); LCD_DisplayStringLine(LINE(0), (uint8_t *) "Attempt"); LCD_DisplayStringLine(LINE(2), (uint8_t *) "Record"); EE_WriteVariable(VirtAddVarTab[0],VarValue); EE_ReadVariable(VirtAddVarTab[0], &VarDataTab[0]); sprintf(str, "%d", VarDataTab[0]); //LCD_DisplayStringLine(LINE(3), (uint8_t *) str); //randomNumber = RNG_GetRandomNumber()/100000; //sprintf(str, "%d", randomNumber()); //LCD_DisplayStringLine(LINE(5), (uint8_t *) str); resetTimer(); /*the following while loop is where the main part of the code is * it currently uses the userbutton on board since Mario forgot to bring along his * jumper cables to test out the push button part */ //if toggle = 0 lights are blinking //if toggle = 1 2 second wait //if toggle = 2 LED toggle off, the lights stay on //@TODO add external push button to code externalButton(); while (1){ int num = TIM_GetCounter(TIM3); //This is for the start of the procedure if(toggle==0){ if(num == 3000){ STM_EVAL_LEDOn(LED3); STM_EVAL_LEDOn(LED4); } else if(num == 6000){ STM_EVAL_LEDOff(LED3); STM_EVAL_LEDOff(LED4); resetTimer(); } } //if the user button has been pressed and the lights are blinking if (UBPressed==1 && toggle==0) { STM_EVAL_LEDOff(LED3); STM_EVAL_LEDOff(LED4); UBPressed=0; PB_Config(); resetTimerLong(); toggle = 1; rand = randomNumber();//generate a random number } //this is the to get the wait time for the reaction test. if(toggle==1){ if(num == rand){ //if num is equal to the ramdom gened number turn on the LEDs and reset the timer STM_EVAL_LEDOn(LED3); STM_EVAL_LEDOn(LED4); resetTimerLong(); } } //this is the code for when the reaction timer has gone off if (UBPressed==1 && toggle==1) { //this if statement is to prevent cheating //if the number = 0 it means that the user cheated as someone should not be able to get 0 if(num == 0){ ExtButtonPressed=0; PB_Config(); externalButton(); resetTimer(); toggle = 0; }else{ sprintf(str, "%d", num); //this block of code writes to the LCD the lastest user reaction time. LCD_DisplayStringLine(LINE(1), (uint8_t *) " "); LCD_DisplayStringLine(LINE(1), (uint8_t *) str); EE_ReadVariable(VirtAddVarTab[0], &VarDataTab[0]); //this if statement determines wheter the user has beat their best reaction time if(num < VarDataTab[0]){ VarValue = num; EE_WriteVariable(VirtAddVarTab[0],VarValue); } /*the following block of code writes to the LCD the record reaction time*/ EE_ReadVariable(VirtAddVarTab[0], &VarDataTab[0]); sprintf(str, "%d", VarDataTab[0]); LCD_DisplayStringLine(LINE(3), (uint8_t *) " "); LCD_DisplayStringLine(LINE(3), (uint8_t *) str); UBPressed=0; PB_Config(); resetTimerLong(); toggle = 2; } } //the user needs to press the button to get the reaction time game going again. //to reset the reaction timer if (ExtButtonPressed==1) { ExtButtonPressed=0; PB_Config(); externalButton(); resetTimer(); toggle = 0; } } }
void GAME_Update() { //char str[5]; if( demoMode == 0 ){ me1[0].centerX += gyro_Mapping(axes[1])*1.5; if(shoot==1){ if(standby>0){ for(int i=0; i<3; i++) { if(my_bullet[0].bullet[i].ballIsRun==0) { my_bullet[0].bullet[i].ballIsRun=1; standby--; shoot=0; break; } } } } if( me1[0].centerX <= 30 ) me1[0].centerX = 30; else if( me1[0].centerX >= LCD_PIXEL_WIDTH -30) me1[0].centerX = LCD_PIXEL_WIDTH - 30; boss1[0].centerX+=bossVX; if(boss1[0].centerX<=20){ boss1[0].centerX=20; bossVX*=-1; } else if(boss1[0].centerX>=LCD_PIXEL_WIDTH -20){ boss1[0].centerX=LCD_PIXEL_WIDTH -20; bossVX*=-1; } //draw bullet black //boss bullet //move bullet for(int i=0; i<3; i++) { if(boss1[0].gun[i]==1) { if(boss_bullet[0].bullet[i].ballY<=0) { boss_bullet_init(); break; } else{ boss_bullet[0].bullet[i].ballY-=5; } } } //my bullet for(int i=0; i<3; i++) { if(my_bullet[0].bullet[i].ballIsRun==1) { if(my_bullet[0].bullet[i].ballY>=LCD_PIXEL_HEIGHT - 20) { standby++; my_bullet[0].bullet[i].ballIsRun=0; my_bullet[0].bullet[i].ballX = me1[0].centerX; my_bullet[0].bullet[i].ballY = me1[0].centerY; continue; } else{ my_bullet[0].bullet[i].ballY+=5; } } } //PONG! me for(int i=0; i<3; i++) { if(boss1[0].gun[i]==1) { if(boss_bullet[0].bullet[i].ballY<=me1[0].centerY){ if(boss_bullet[0].bullet[i].ballX<=me1[0].centerX+10&&boss_bullet[0].bullet[i].ballX>=me1[0].centerX-10) { me1[0].LifePoint--; } else{ boss_bullet_init(); } } } } //PONG! boss for(int i=0; i<3; i++){ if(my_bullet[0].bullet[i].ballIsRun){ if(my_bullet[0].bullet[i].ballY>=boss1[0].centerY) { if(my_bullet[0].bullet[i].ballX<=boss1[0].centerX+20&&my_bullet[0].bullet[i].ballX<=boss1[0].centerX-20){ if(boss1[0].gunCount==3){ LCD_SetLayer(LCD_BACKGROUND_LAYER); LCD_SetTextColor( LCD_COLOR_BLACK ); draw_bossbullet(boss_bullet[1]); LCD_SetLayer(LCD_FOREGROUND_LAYER); boss1[0].gun[2]=0; boss1[1].gun[2]=0; boss1[0].gunCount--; } else if(boss1[0].gunCount==2){ LCD_SetLayer(LCD_BACKGROUND_LAYER); LCD_SetTextColor( LCD_COLOR_BLACK ); draw_bossbullet(boss_bullet[1]); LCD_SetLayer(LCD_FOREGROUND_LAYER); boss1[0].gun[0]=0; boss1[1].gun[0]=0; boss1[0].gunCount--; } boss1[0].LifePoint--; standby++; my_bullet[0].bullet[i].ballIsRun=0; my_bullet[0].bullet[i].ballX = me1[0].centerX; my_bullet[0].bullet[i].ballY = me1[0].centerY; } } } } } }
/** * @brief Main program * @param None * @retval None */ int main(void) { /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup files (startup_stm32f40_41xxx.s/startup_stm32f427_437xx.s/startup_stm32f429_439xx.s) before to branch to application main. */ /* SysTick end of count event each 10ms */ RCC_GetClocksFreq(&RCC_Clocks); SysTick_Config(RCC_Clocks.HCLK_Frequency / 100); /* Initialize LEDs mounted on EVAL board */ STM_EVAL_LEDInit(LED1); STM_EVAL_LEDInit(LED2); STM_EVAL_LEDInit(LED3); STM_EVAL_LEDInit(LED4); /* Select the Button test mode (polling or interrupt) BUTTON_MODE in main.h */ STM_EVAL_PBInit(BUTTON_WAKEUP, BUTTON_MODE); STM_EVAL_PBInit(BUTTON_TAMPER, BUTTON_MODE); /* Initialize the LCD */ LCD_Init(); /* Initialize the LCD Layers */ LCD_LayerInit(); /* Enable LCD display */ LCD_DisplayOn(); /* Set foreground layer */ LCD_SetLayer(LCD_FOREGROUND_LAYER); /* Clear the LCD */ LCD_Clear(White); /* Set the LCD Back Color */ LCD_SetBackColor(White); /* Set the LCD Text Color */ LCD_SetTextColor(Blue); LCD_DisplayStringLine(LCD_LINE_0, (uint8_t *)" STM324x9I-EVAL "); LCD_DisplayStringLine(LCD_LINE_1, (uint8_t *)" Example on how to "); LCD_DisplayStringLine(LCD_LINE_2, (uint8_t *)" use the IO Expander "); /* Configure the IO Expander */ if (IOE_Config() == IOE_OK && IOE16_Config() == IOE16_OK) { LCD_DisplayStringLine(LCD_LINE_3, (uint8_t *)" IO Expander OK "); } else { LCD_DisplayStringLine(LCD_LINE_4, (uint8_t *)"IO Expander FAILED "); LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)" Please Reset the "); LCD_DisplayStringLine(LCD_LINE_6, (uint8_t *)" board and start "); LCD_DisplayStringLine(LCD_LINE_7, (uint8_t *)" again "); while(1); } /* LEDs Control blocks */ LCD_SetTextColor(Blue); LCD_DrawRect(310, 180, 40, 60); LCD_SetTextColor(Red); LCD_DrawRect(230, 180, 40, 60); LCD_SetTextColor(Yellow); LCD_DrawRect(150, 180, 40, 60); LCD_SetTextColor(Green); LCD_DrawRect(70, 180, 40, 60); #ifdef IOE_INTERRUPT_MODE /* Configure motherboard interrupt source IO_EXP4 */ IOE16_IOPinConfig(IOE16_TS_IT,Direction_IN); IOE16_ITConfig(IOE16_TS_IT); /* Enable joystick interrupt */ IOE16_ITConfig(JOY_IO16_PINS); /* Enable the Touch Screen interrupt */ IOE_TSITConfig(); /* Read IOs state to let IO interrupt occur */ IOE16_I2C_ReadDeviceRegister(IOE16_REG_GPMR_LSB); IOE16_I2C_ReadDeviceRegister(IOE16_REG_GPMR_MSB); #endif /* IOE_INTERRUPT_MODE */ while(1) { #ifdef IOE_POLLING_MODE static JOY_State_TypeDef JoyState = JOY_NONE; static TS_STATE* TS_State; /* Get the Joystick State */ JoyState = IOE16_JoyStickGetState(); /* Set the LCD Text Color */ LCD_SetTextColor(Blue); switch (JoyState) { case JOY_NONE: LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)"JOY: ---- "); break; case JOY_UP: LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)"JOY: UP "); break; case JOY_DOWN: LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)"JOY: DOWN "); break; case JOY_LEFT: LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)"JOY: LEFT "); break; case JOY_RIGHT: LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)"JOY: RIGHT "); break; case JOY_CENTER: LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)"JOY: CENTER "); break; default: LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)"JOY: ERROR "); break; } /* Update the structure with the current position */ TS_State = IOE_TS_GetState(); if ((TS_State->TouchDetected) && (TS_State->Y < 92) && (TS_State->Y > 52)) { if ((TS_State->X > 60) && (TS_State->X < 120)) { LCD_SetTextColor(LCD_COLOR_GREEN); LCD_DisplayStringLine(LCD_LINE_10, (uint8_t *)" LD1 "); STM_EVAL_LEDOn(LED1); } else if ((TS_State->X > 140) && (TS_State->X < 200)) { LCD_SetTextColor(LCD_COLOR_YELLOW); LCD_DisplayStringLine(LCD_LINE_10, (uint8_t *)" LD2 "); STM_EVAL_LEDOn(LED2); } else if ((TS_State->X > 220) && (TS_State->X < 280)) { LCD_SetTextColor(LCD_COLOR_RED); LCD_DisplayStringLine(LCD_LINE_10, (uint8_t *)" LD3 "); STM_EVAL_LEDOn(LED3); } else if ((TS_State->X > 300) && (TS_State->X < 360)) { LCD_SetTextColor(LCD_COLOR_BLUE); LCD_DisplayStringLine(LCD_LINE_10, (uint8_t *)" LD4 "); STM_EVAL_LEDOn(LED4); } } else { STM_EVAL_LEDOff(LED1); STM_EVAL_LEDOff(LED2); STM_EVAL_LEDOff(LED3); STM_EVAL_LEDOff(LED4); } #endif /* IOE_POLLING_MODE */ #ifdef BUTTON_POLLING_MODE /* Insert 10 ms delay */ Delay(1); /* Set the LCD Text Color */ LCD_SetTextColor(Blue); if (STM_EVAL_PBGetState(BUTTON_TAMPER) == 0) { /* Toggle LD2 */ STM_EVAL_LEDToggle(LED2); LCD_DisplayStringLine(LCD_LINE_4, (uint8_t *)"Pol: TAMPER/KEY Pressed "); } if (STM_EVAL_PBGetState(BUTTON_WAKEUP) != 0) { /* Toggle LD3 */ STM_EVAL_LEDToggle(LED3); LCD_DisplayStringLine(LCD_LINE_4, (uint8_t *)"Pol: WAKEUP Pressed "); } #endif } }
void GAME_Render() { LCD_SetTextColor( LCD_COLOR_WHITE ); draw_me(me1[0]); draw_boss(boss1[0]); LCD_SetTextColor( LCD_COLOR_RED ); draw_bossbullet(boss_bullet[0]); draw_gun(boss1[0]); LCD_SetTextColor( LCD_COLOR_BLUE ); draw_mybullet(my_bullet[0]); LTDC_LayerAlpha(LTDC_Layer1, SHOW); LTDC_LayerAlpha(LTDC_Layer2, HIDE); LTDC_ReloadConfig(LTDC_VBReload); vTaskDelay( 2.5 ); LCD_SetLayer(LCD_BACKGROUND_LAYER); LCD_SetTextColor( LCD_COLOR_BLACK ); draw_me(me1[1]); draw_boss(boss1[1]); draw_gun(boss1[1]); draw_mybullet(my_bullet[1]); draw_bossbullet(boss_bullet[1]); LCD_SetTextColor( LCD_COLOR_WHITE ); draw_me(me1[0]); draw_boss(boss1[0]); LCD_SetTextColor( LCD_COLOR_RED ); draw_bossbullet(boss_bullet[0]); draw_gun(boss1[0]); LCD_SetTextColor( LCD_COLOR_BLUE ); draw_mybullet(my_bullet[0]); LTDC_LayerAlpha(LTDC_Layer2, SHOW); LTDC_LayerAlpha(LTDC_Layer1, HIDE); LTDC_ReloadConfig(LTDC_VBReload); vTaskDelay( 2.5 ); LCD_SetLayer(LCD_FOREGROUND_LAYER); LCD_SetTextColor( LCD_COLOR_BLACK ); draw_me(me1[0]); draw_boss(boss1[0]); draw_gun(boss1[0]); draw_mybullet(my_bullet[0]); draw_bossbullet(boss_bullet[0]); boss_bullet[1]=boss_bullet[0]; my_bullet[1]=my_bullet[0]; me1[1]=me1[0]; boss1[1]=boss1[0]; }