void gfx_hx8347a_init(void)
{
	/* initialize globals */
	gfx_width = HX8347A_DEFAULT_WIDTH;
	gfx_height = HX8347A_DEFAULT_HEIGHT;

	hx8347a_init();
	hx8347a_backlight_on();

	/* Set clipping area to whole screen initially */
	gfx_set_clipping(0, 0, gfx_width, gfx_height);

	gfx_draw_filled_rect(0, 0, gfx_width, gfx_height,
			GFX_COLOR_BLACK);
}
Пример #2
0
/**
 * \brief The main application routine
 */
int main(void)
{
	board_init();

	sysclk_init();

	/* Make sure to initialize the display controller */
	hx8347a_init();

	/* Turn on the back light */
	hx8347a_backlight_on();

	/* Blank the screen by drawing a black background. Notice how the
	 * drawing boundaries/limits are set to the entire screen */
	hx8347a_set_top_left_limit(0, 0);
	hx8347a_set_bottom_right_limit(HX8347A_DEFAULT_WIDTH, HX8347A_DEFAULT_HEIGHT);

	hx8347a_duplicate_pixel(HX8347A_BLACK, TOTAL_PIXELS);

	/* Draw five squares in different colors to generate a test pattern for
	 * the screen */

	/* First draw a red square */
	hx8347a_set_top_left_limit(60, 204);
	hx8347a_set_bottom_right_limit(180, 294);

	hx8347a_duplicate_pixel(HX8347A_RED, 11040);

	/* Then draw a green square */
	hx8347a_set_top_left_limit(60, 204);
	hx8347a_set_top_left_limit(60, 114);
	hx8347a_set_bottom_right_limit(180, 194);

	hx8347a_duplicate_pixel(HX8347A_GREEN, 11040);

	/* Then draw a blue square */
	hx8347a_set_top_left_limit(60, 204);
	hx8347a_set_top_left_limit(60, 12);
	hx8347a_set_bottom_right_limit(180, 102);

	hx8347a_duplicate_pixel(HX8347A_BLUE, 11040);

	/* Then draw a white square */
	hx8347a_set_top_left_limit(60, 204);
	hx8347a_set_top_left_limit(15, 12);
	hx8347a_set_bottom_right_limit(45, 294);

	hx8347a_duplicate_pixel(HX8347A_WHITE, 11040);

	/* Then draw a gray square */
	hx8347a_set_top_left_limit(60, 204);
	hx8347a_set_top_left_limit(195, 12);
	hx8347a_set_bottom_right_limit(225, 294);

	hx8347a_duplicate_pixel(HX8347A_GRAY, 11040);

	/* Application end */
	while (true) {
		/* Do nothing */
	}
}