Esempio n. 1
0
int main(int argc, char **argv) {
	memset(LCD, 0xff, sizeof(LCD));
	//lcd_print(FONT_14, 0, 0, (uint8_t *)"abc一二三四@!好的这个是会自动换行的!满屏幕显示看看效果怎么样");
	lcd_print(FONT_12, 0, 0, (uint8_t *)"奥丽轩马蒙斯法定产区红葡萄酒");
	lcd_print(FONT_12, 0, 16, (uint8_t *)"法国");
	lcd_dump();
	return 0;
}
Esempio n. 2
0
int cmd_lcd(int argc, char **argv)
{
	int i;
	int ret;

	if (is_command(argc, argv, "init")) {
		printf("Initializing LCD... ");
		ret = lcd_init();
		if (ret)
			printf("failed: %d\n", ret);
		else
			printf("Ok\n");
	}
#ifdef LCD_DEBUG
	else if (is_command(argc, argv, "dump")) {
		lcd_dump();
	}
#endif
	else if (is_command(argc, argv, "run")) {
		printf("Running LCD... ");
		ret = lcd_run();
		if (ret)
			printf("failed: %d\n", ret);
		else
			printf("Ok\n");
	}
	else if (is_command(argc, argv, "stop")) {
		printf("Stopping LCD... ");
		ret = lcd_stop();
		if (ret)
			printf("failed: %d\n", ret);
		else
			printf("Ok\n");
	}
	else if (is_command(argc, argv, "tpp1")) {
		int w = lcd_width();
		int h = lcd_height();
		int total = w * h;

		for (i = 0; i < total; i++)
			lcd_addpixel(i);
	}
	else if (is_command(argc, argv, "tpp2")) {
		int x, y;

		i = 0;
		for (y = 0; y < lcd_height(); y++)
			for (x = 0; x < lcd_width(); x++)
				lcd_addpixel(rgb(i++, 0, 0));
	}
	else if (is_command(argc, argv, "tpd")) {
		static int step = 0;
		pixel_t *fb;
		int x, y;
		int w, h;

		fb = lcd_fb();

		h = lcd_height();
		w = lcd_width();

		/* Stupid clear-screen */
		memset(fb, 0, w * h * lcd_bpp());

		printf("Width: %d  Height: %d\n", w, h);

		i = step++;
		fb = lcd_fb();
		for (y = 0; y < h; y++) {
			for (x = 0; x < w; x++) {
				/* Swap axes, to verify X and Y work */
				if (step & 1)
					*fb++ = color_wheel(y + step);
				else
					*fb++ = color_wheel(x + step);
			}
		}
		lcd_run();
	}
	else {
		printf("lcd sub-commands (usage: lcd [subcmd]):\n");
		printf("\tinit    Initialize LCD registers\n");
		printf("\trun     Transfer one frame of the LCD\n");
		printf("\tstop    Stop and reset LCD auto-update\n");
#ifdef LCD_DEBUG
		printf("\tdump    Dump current register list\n");
#endif
		printf("\ttpp1    Display bitbanged, PIO 'test pattern 1'\n");
		printf("\ttpp2    Display bitbanged, PIO 'test pattern 2'\n");
		printf("\ttpd     DMA test pattern (flips on each iteration)\n");
	}

	return 0;
}