blob: fbe5514a707619684b9a28dfe3f4717255a379de [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Wolfgang Denkf8f77072005-08-30 13:04:12 +02002/*
3 * (C) Copyright 2005
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Wolfgang Denkf8f77072005-08-30 13:04:12 +02005 */
6
7#include <common.h>
8#include <command.h>
Ilya Yanok435a63d2010-09-09 23:03:32 +02009#include <led-display.h>
Wolfgang Denkf8f77072005-08-30 13:04:12 +020010
Wolfgang Denkf8f77072005-08-30 13:04:12 +020011#undef DEBUG_DISP
12
Wolfgang Denk6262d0212010-06-28 22:00:46 +020013int do_display (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Wolfgang Denkf8f77072005-08-30 13:04:12 +020014{
15 int i;
Wolfgang Denkf8f77072005-08-30 13:04:12 +020016
17 /* Clear display */
Ilya Yanok435a63d2010-09-09 23:03:32 +020018 display_set(DISPLAY_CLEAR | DISPLAY_HOME);
Wolfgang Denkf8f77072005-08-30 13:04:12 +020019
20 if (argc < 2)
21 return (0);
22
Ilya Yanok435a63d2010-09-09 23:03:32 +020023 for (i = 1; i < argc; i++) {
24 char *p = argv[i];
Wolfgang Denkf8f77072005-08-30 13:04:12 +020025
Ilya Yanok435a63d2010-09-09 23:03:32 +020026 if (i > 1) { /* Insert a space between strings */
27 display_putc(' ');
Wolfgang Denkf8f77072005-08-30 13:04:12 +020028 }
29
Ilya Yanok435a63d2010-09-09 23:03:32 +020030 while ((*p)) {
Wolfgang Denkf8f77072005-08-30 13:04:12 +020031#ifdef DEBUG_DISP
Ilya Yanok435a63d2010-09-09 23:03:32 +020032 putc(*p);
Wolfgang Denkf8f77072005-08-30 13:04:12 +020033#endif
Ilya Yanok435a63d2010-09-09 23:03:32 +020034 display_putc(*p++);
Wolfgang Denkf8f77072005-08-30 13:04:12 +020035 }
36 }
37
38#ifdef DEBUG_DISP
39 putc('\n');
40#endif
41
42 return (0);
43}
44
45/***************************************************/
46
47U_BOOT_CMD(
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020048 display, CONFIG_SYS_MAXARGS, 1, do_display,
Peter Tyserdfb72b82009-01-27 18:03:12 -060049 "display string on dot matrix display",
Wolfgang Denkf8f77072005-08-30 13:04:12 +020050 "[<string>]\n"
51 " - with <string> argument: display <string> on dot matrix display\n"
Wolfgang Denkc54781c2009-05-24 17:06:54 +020052 " - without arguments: clear dot matrix display"
Wolfgang Denkf8f77072005-08-30 13:04:12 +020053);