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