int main(void) { /* Initialize system */ SystemInit(); /* Initialize delay */ TM_DELAY_Init(); /* Initialize ILI9341 with LTDC */ /* By default layer 1 is used */ TM_ILI9341_Init(); /* Rotate LCD for 90 degrees */ TM_ILI9341_Rotate(TM_ILI9341_Orientation_Landscape_2); TM_ILI9341_SetLayer1(); /* Fill data on layer 1 */ TM_ILI9341_Fill(ILI9341_COLOR_WHITE); /* Show text */ TM_ILI9341_Puts(65, 30, "Layer 1", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_BLUE2); TM_ILI9341_Puts(20, 130, "STM32F429 Discovery ONLY!", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_BLUE2); TM_ILI9341_Puts(60, 150, "ILI9341 LCD Module", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_BLUE2); TM_ILI9341_Puts(70, 170, "with LTDC support", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_BLUE2); TM_ILI9341_Puts(170, 230, "stm32f4-discovery.com", &TM_Font_7x10, ILI9341_COLOR_BLACK, ILI9341_COLOR_ORANGE); /* Go to layer 2 */ TM_ILI9341_SetLayer2(); /* Fill data on layer 2 */ TM_ILI9341_Fill(ILI9341_COLOR_GREEN2); /* Show text */ TM_ILI9341_Puts(65, 30, "Layer 2", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_BLUE); TM_ILI9341_Puts(20, 130, "STM32F429 Discovery ONLY!", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_RED); TM_ILI9341_Puts(60, 150, "ILI9341 LCD Module", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_BLUE2); TM_ILI9341_Puts(70, 170, "with LTDC support", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_BLUE2); TM_ILI9341_Puts(170, 230, "stm32f4-discovery.com", &TM_Font_7x10, ILI9341_COLOR_BLACK, ILI9341_COLOR_ORANGE); /* Draw circle on layer 2 */ TM_ILI9341_DrawCircle(150, 150, 140, ILI9341_COLOR_BLACK); while (1) { /* This will set opacity of one layer to 0, other to max (255) each time */ /* This is like toggle function */ TM_ILI9341_ChangeLayers(); Delayms(500); /* //Bottom code works the same as one before inside while loop //Turn on Layer1 and turn off Layer2 TM_ILI9341_SetLayer1Opacity(255); TM_ILI9341_SetLayer2Opacity(0); Delayms(500); //Turn on Layer2 and turn off Layer1 TM_ILI9341_SetLayer1Opacity(0); TM_ILI9341_SetLayer2Opacity(255); Delayms(500); */ } }
int main(void) { /* Set coordinates for poly line */ TM_DMA2DRAPHIC_Poly_t Coordinates[] = { {10, 10}, {15, 65}, {200, 200}, {150, 30}, {10, 10} }; /* Initialize system */ SystemInit(); /* Initialize delay functions */ TM_DELAY_Init(); /* Initialize ILI9341 with LTDC */ /* By default layer 1 is used */ TM_ILI9341_Init(); /* Initialize DMA2D GRAPHIC library */ TM_DMA2DGRAPHIC_Init(); /* Set ILI9341 Orientation */ TM_ILI9341_Rotate(TM_ILI9341_Orientation_Portrait_2); /* Set DMA2D GRAPHIC library Orientation */ TM_DMA2DGRAPHIC_SetOrientation((uint8_t)TM_ILI9341_Orientation_Portrait_2); /* Layer 1 */ /* Draw red rectangle at X = 10, Y = 10 position, width = 100 and height = 50px */ TM_DMA2DGRAPHIC_DrawRectangle(10, 10, 100, 50, GRAPHIC_COLOR_RED); /* Draw filled blue rectangle at X = 100, Y = 100 position, width = 100 and height = 50px */ TM_DMA2DGRAPHIC_DrawFilledRectangle(100, 100, 100, 50, GRAPHIC_COLOR_BLUE); /* Draw rounded rectangle */ TM_DMA2DGRAPHIC_DrawRoundedRectangle(110, 110, 80, 30, 10, GRAPHIC_COLOR_GREEN); /* Go to layer 2, set address offset in memory for LCD */ TM_DMA2DGRAPHIC_SetLayer(2); /* Fill layer 2 */ TM_DMA2DGRAPHIC_Fill(GRAPHIC_COLOR_YELLOW); /* Draw poly line */ TM_DMA2DGRAPHIC_DrawPolyLine(Coordinates, 5, GRAPHIC_COLOR_BLACK); /* Draw filled circle */ TM_DMA2DGRAPHIC_DrawFilledCircle(100, 170, 40, GRAPHIC_COLOR_CYAN); while (1) { /* Change display layer on LCD using LTDC transfer */ TM_ILI9341_ChangeLayers(); /* Delay */ Delayms(1000); } }