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