예제 #1
0
파일: main.c 프로젝트: Acse/stm32f429
int main(void) {
	/* Initialize system */
	SystemInit();
		
	/* Initialize ILI9341 */
	TM_ILI9341_Init();
	
	/* Rotate LCD for 90 degrees */
	TM_ILI9341_Rotate(TM_ILI9341_Orientation_Landscape_2);
	
	/* Fill lcd with color */
	TM_ILI9341_Fill(ILI9341_COLOR_MAGENTA);
	/* Draw white circle */
	TM_ILI9341_DrawCircle(60, 60, 40, ILI9341_COLOR_GREEN);
	/* Draw red filled circle */
	TM_ILI9341_DrawFilledCircle(60, 60, 35, ILI9341_COLOR_RED);
	/* Draw blue rectangle */
	TM_ILI9341_DrawRectangle(120, 20, 220, 100, ILI9341_COLOR_BLUE);
	/* Draw black filled circle */
	TM_ILI9341_DrawFilledRectangle(130, 30, 210, 90, ILI9341_COLOR_BLACK);
	/* Draw line with custom color 0x0005 */
	TM_ILI9341_DrawLine(10, 120, 310, 120, 0x0005);
	
	/* Put string with black foreground color and blue background with 11x18px font */
	TM_ILI9341_Puts(65, 130, "STM32F4 Discovery", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_BLUE2);
	/* Put string with black foreground color and blue background with 11x18px font */
	TM_ILI9341_Puts(60, 150, "ILI9341 LCD Module", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_BLUE2);
	/* Put string with black foreground color and red background with 11x18px font */
	TM_ILI9341_Puts(45, 229, "stm32f4-discovery.com", &TM_Font_7x10, ILI9341_COLOR_BLACK, ILI9341_COLOR_ORANGE);

	while (1) {
		
	}
}
예제 #2
0
void ekran(int nr){
	switch(nr){
	case 1:
		//Rotate LCD for 90 degrees
		TM_ILI9341_Rotate(TM_ILI9341_Orientation_Portrait_2);
		//FIll lcd with color
		TM_ILI9341_Fill(ILI9341_COLOR_ORANGE);
		//Draw white circle
		//TM_ILI9341_DrawCircle(0, 0, 10, ILI9341_COLOR_GREEN);
		//Draw red filled circle
		TM_ILI9341_DrawFilledCircle(60, 40, 35, ILI9341_COLOR_RED);
		//Draw blue rectangle
		//TM_ILI9341_DrawRectangle(120, 20, 220, 100, ILI9341_COLOR_BLUE);
		//Draw black filled rectangle
		TM_ILI9341_DrawFilledRectangle(70, 200, 160, 240, ILI9341_COLOR_RED);
		TM_ILI9341_Puts(85, 215, "START", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_RED);
		//Draw line with custom color 0x0005
		TM_ILI9341_DrawLine(20, 120, 220, 120, 0x0005);
		//Put string with black foreground color and blue background with 11x18px font
		TM_ILI9341_Puts(40, 110, " STEP DRIVER ", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_ORANGE);
		//Put string with black foreground color and blue background with 11x18px font
		TM_ILI9341_Puts(10, 140, "Press START to begin", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_ORANGE);
		//Put string with black foreground color and red background with 11x18px font
		TM_ILI9341_Puts(1, 310, "LB", &TM_Font_7x10, ILI9341_COLOR_BLACK, ILI9341_COLOR_ORANGE);
		return;
	case 2:
		//Rotate LCD for 90 degrees
		TM_ILI9341_Rotate(TM_ILI9341_Orientation_Portrait_2);
		//FIll lcd with color
		TM_ILI9341_Fill(ILI9341_COLOR_BLUE2);
		//Draw blue rectangle
		//TM_ILI9341_DrawRectangle(120, 20, 220, 100, ILI9341_COLOR_BLUE);
		//Draw black filled rectangle
		TM_ILI9341_DrawFilledRectangle(10, 10, 50, 210, ILI9341_COLOR_WHITE);
		TM_ILI9341_DrawFilledRectangle(70, 10, 110, 210, ILI9341_COLOR_WHITE);
		TM_ILI9341_DrawFilledRectangle(130, 10, 170, 210, ILI9341_COLOR_WHITE);
		TM_ILI9341_DrawFilledRectangle(10, 220, 50, 260, ILI9341_COLOR_RED);
		TM_ILI9341_Puts(15, 230, "STOP", &TM_Font_7x10, ILI9341_COLOR_BLACK, ILI9341_COLOR_RED);
		TM_ILI9341_DrawFilledRectangle(70, 220, 110, 260, ILI9341_COLOR_RED);
		TM_ILI9341_Puts(75, 230, "STOP", &TM_Font_7x10, ILI9341_COLOR_BLACK, ILI9341_COLOR_RED);
		TM_ILI9341_DrawFilledRectangle(130, 220, 170, 260, ILI9341_COLOR_RED);
		TM_ILI9341_Puts(135, 230, "STOP", &TM_Font_7x10, ILI9341_COLOR_BLACK, ILI9341_COLOR_RED);
		TM_ILI9341_DrawFilledRectangle(10, 270, 50, 310, ILI9341_COLOR_YELLOW);
		TM_ILI9341_Puts(15, 280, "CW", &TM_Font_7x10, ILI9341_COLOR_BLACK, ILI9341_COLOR_YELLOW);
		TM_ILI9341_DrawFilledRectangle(70, 270, 110, 310, ILI9341_COLOR_YELLOW);
		TM_ILI9341_Puts(75, 280, "CW", &TM_Font_7x10, ILI9341_COLOR_BLACK, ILI9341_COLOR_YELLOW);
		TM_ILI9341_DrawFilledRectangle(130, 270, 170, 310, ILI9341_COLOR_YELLOW);
		TM_ILI9341_Puts(135, 280, "CW", &TM_Font_7x10, ILI9341_COLOR_BLACK, ILI9341_COLOR_YELLOW);
		TM_ILI9341_DrawFilledRectangle(180, 100, 235, 125, ILI9341_COLOR_BLUE);
		TM_ILI9341_Puts(185, 105, "FULL", &TM_Font_11x18, ILI9341_COLOR_WHITE, ILI9341_COLOR_BLUE);
		TM_ILI9341_DrawFilledRectangle(180, 130, 235, 155, ILI9341_COLOR_WHITE);
		TM_ILI9341_Puts(185, 135, "1/2", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_WHITE);
		TM_ILI9341_DrawFilledRectangle(180, 160, 235, 185, ILI9341_COLOR_WHITE);
		TM_ILI9341_Puts(185, 165, "1/4", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_WHITE);
		TM_ILI9341_DrawFilledRectangle(180, 190, 235, 215, ILI9341_COLOR_WHITE);
		TM_ILI9341_Puts(185, 195, "1/8", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_WHITE);
		TM_ILI9341_DrawFilledRectangle(180, 220, 235, 245, ILI9341_COLOR_WHITE);
		TM_ILI9341_Puts(185, 225, "1/16", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_WHITE);
		TM_ILI9341_DrawFilledRectangle(180, 260, 235, 315, ILI9341_COLOR_MAGENTA);
		TM_ILI9341_Puts(185, 280, "DOWN", &TM_Font_11x18, ILI9341_COLOR_BLACK, ILI9341_COLOR_MAGENTA);
		return;
	default:
		//Rotate LCD for 90 degrees
		TM_ILI9341_Rotate(TM_ILI9341_Orientation_Portrait_2);
		//FIll lcd with color
		TM_ILI9341_Fill(ILI9341_COLOR_GREEN);
		//Draw white circle
		//TM_ILI9341_DrawCircle(0, 0, 10, ILI9341_COLOR_GREEN);
		//Draw red filled circle
		TM_ILI9341_DrawFilledCircle(60, 60, 35, ILI9341_COLOR_RED);
		//Draw blue rectangle
		//TM_ILI9341_DrawRectangle(120, 20, 220, 100, ILI9341_COLOR_BLUE);
		//Draw black filled rectangle
		TM_ILI9341_DrawFilledRectangle(120, 200, 220, 230, ILI9341_COLOR_RED);
		return;
	}
}