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