xref: /openbmc/u-boot/cmd/display.c (revision 20c700f8)
1 /*
2  * (C) Copyright 2005
3  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #include <common.h>
9 #include <command.h>
10 #include <led-display.h>
11 
12 #undef DEBUG_DISP
13 
14 int do_display (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
15 {
16 	int i;
17 
18 	/* Clear display */
19 	display_set(DISPLAY_CLEAR | DISPLAY_HOME);
20 
21 	if (argc < 2)
22 		return (0);
23 
24 	for (i = 1; i < argc; i++) {
25 		char *p = argv[i];
26 
27 		if (i > 1) { /* Insert a space between strings */
28 			display_putc(' ');
29 		}
30 
31 		while ((*p)) {
32 #ifdef DEBUG_DISP
33 			putc(*p);
34 #endif
35 			display_putc(*p++);
36 		}
37 	}
38 
39 #ifdef DEBUG_DISP
40 	putc('\n');
41 #endif
42 
43 	return (0);
44 }
45 
46 /***************************************************/
47 
48 U_BOOT_CMD(
49 	display,	CONFIG_SYS_MAXARGS,	1,	do_display,
50 	"display string on dot matrix display",
51 	"[<string>]\n"
52 	"    - with <string> argument: display <string> on dot matrix display\n"
53 	"    - without arguments: clear dot matrix display"
54 );
55