blob: bc1b1ebb8f46248622ababd874127d6bcceb14fa [file] [log] [blame]
Wolfgang Denkf8f77072005-08-30 13:04:12 +02001/*
2 * (C) Copyright 2005
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Wolfgang Denkf8f77072005-08-30 13:04:12 +02006 */
7
8#include <common.h>
9#include <command.h>
Ilya Yanok435a63d2010-09-09 23:03:32 +020010#include <led-display.h>
Wolfgang Denkf8f77072005-08-30 13:04:12 +020011
Wolfgang Denkf8f77072005-08-30 13:04:12 +020012#undef DEBUG_DISP
13
Wolfgang Denk6262d0212010-06-28 22:00:46 +020014int do_display (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Wolfgang Denkf8f77072005-08-30 13:04:12 +020015{
16 int i;
Wolfgang Denkf8f77072005-08-30 13:04:12 +020017
18 /* Clear display */
Ilya Yanok435a63d2010-09-09 23:03:32 +020019 display_set(DISPLAY_CLEAR | DISPLAY_HOME);
Wolfgang Denkf8f77072005-08-30 13:04:12 +020020
21 if (argc < 2)
22 return (0);
23
Ilya Yanok435a63d2010-09-09 23:03:32 +020024 for (i = 1; i < argc; i++) {
25 char *p = argv[i];
Wolfgang Denkf8f77072005-08-30 13:04:12 +020026
Ilya Yanok435a63d2010-09-09 23:03:32 +020027 if (i > 1) { /* Insert a space between strings */
28 display_putc(' ');
Wolfgang Denkf8f77072005-08-30 13:04:12 +020029 }
30
Ilya Yanok435a63d2010-09-09 23:03:32 +020031 while ((*p)) {
Wolfgang Denkf8f77072005-08-30 13:04:12 +020032#ifdef DEBUG_DISP
Ilya Yanok435a63d2010-09-09 23:03:32 +020033 putc(*p);
Wolfgang Denkf8f77072005-08-30 13:04:12 +020034#endif
Ilya Yanok435a63d2010-09-09 23:03:32 +020035 display_putc(*p++);
Wolfgang Denkf8f77072005-08-30 13:04:12 +020036 }
37 }
38
39#ifdef DEBUG_DISP
40 putc('\n');
41#endif
42
43 return (0);
44}
45
46/***************************************************/
47
48U_BOOT_CMD(
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020049 display, CONFIG_SYS_MAXARGS, 1, do_display,
Peter Tyserdfb72b82009-01-27 18:03:12 -060050 "display string on dot matrix display",
Wolfgang Denkf8f77072005-08-30 13:04:12 +020051 "[<string>]\n"
52 " - with <string> argument: display <string> on dot matrix display\n"
Wolfgang Denkc54781c2009-05-24 17:06:54 +020053 " - without arguments: clear dot matrix display"
Wolfgang Denkf8f77072005-08-30 13:04:12 +020054);