Wolfgang Denk | 9f96ae4 | 2005-08-30 13:04:12 +0200 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2005 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Wolfgang Denk | 9f96ae4 | 2005-08-30 13:04:12 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <command.h> |
Ilya Yanok | 7f0d241 | 2010-09-09 23:03:32 +0200 | [diff] [blame] | 10 | #include <led-display.h> |
Wolfgang Denk | 9f96ae4 | 2005-08-30 13:04:12 +0200 | [diff] [blame] | 11 | |
Wolfgang Denk | 9f96ae4 | 2005-08-30 13:04:12 +0200 | [diff] [blame] | 12 | #undef DEBUG_DISP |
| 13 | |
Wolfgang Denk | 54841ab | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 14 | int do_display (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Wolfgang Denk | 9f96ae4 | 2005-08-30 13:04:12 +0200 | [diff] [blame] | 15 | { |
| 16 | int i; |
Wolfgang Denk | 9f96ae4 | 2005-08-30 13:04:12 +0200 | [diff] [blame] | 17 | |
| 18 | /* Clear display */ |
Ilya Yanok | 7f0d241 | 2010-09-09 23:03:32 +0200 | [diff] [blame] | 19 | display_set(DISPLAY_CLEAR | DISPLAY_HOME); |
Wolfgang Denk | 9f96ae4 | 2005-08-30 13:04:12 +0200 | [diff] [blame] | 20 | |
| 21 | if (argc < 2) |
| 22 | return (0); |
| 23 | |
Ilya Yanok | 7f0d241 | 2010-09-09 23:03:32 +0200 | [diff] [blame] | 24 | for (i = 1; i < argc; i++) { |
| 25 | char *p = argv[i]; |
Wolfgang Denk | 9f96ae4 | 2005-08-30 13:04:12 +0200 | [diff] [blame] | 26 | |
Ilya Yanok | 7f0d241 | 2010-09-09 23:03:32 +0200 | [diff] [blame] | 27 | if (i > 1) { /* Insert a space between strings */ |
| 28 | display_putc(' '); |
Wolfgang Denk | 9f96ae4 | 2005-08-30 13:04:12 +0200 | [diff] [blame] | 29 | } |
| 30 | |
Ilya Yanok | 7f0d241 | 2010-09-09 23:03:32 +0200 | [diff] [blame] | 31 | while ((*p)) { |
Wolfgang Denk | 9f96ae4 | 2005-08-30 13:04:12 +0200 | [diff] [blame] | 32 | #ifdef DEBUG_DISP |
Ilya Yanok | 7f0d241 | 2010-09-09 23:03:32 +0200 | [diff] [blame] | 33 | putc(*p); |
Wolfgang Denk | 9f96ae4 | 2005-08-30 13:04:12 +0200 | [diff] [blame] | 34 | #endif |
Ilya Yanok | 7f0d241 | 2010-09-09 23:03:32 +0200 | [diff] [blame] | 35 | display_putc(*p++); |
Wolfgang Denk | 9f96ae4 | 2005-08-30 13:04:12 +0200 | [diff] [blame] | 36 | } |
| 37 | } |
| 38 | |
| 39 | #ifdef DEBUG_DISP |
| 40 | putc('\n'); |
| 41 | #endif |
| 42 | |
| 43 | return (0); |
| 44 | } |
| 45 | |
| 46 | /***************************************************/ |
| 47 | |
| 48 | U_BOOT_CMD( |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 49 | display, CONFIG_SYS_MAXARGS, 1, do_display, |
Peter Tyser | 2fb2604 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 50 | "display string on dot matrix display", |
Wolfgang Denk | 9f96ae4 | 2005-08-30 13:04:12 +0200 | [diff] [blame] | 51 | "[<string>]\n" |
| 52 | " - with <string> argument: display <string> on dot matrix display\n" |
Wolfgang Denk | a89c33d | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 53 | " - without arguments: clear dot matrix display" |
Wolfgang Denk | 9f96ae4 | 2005-08-30 13:04:12 +0200 | [diff] [blame] | 54 | ); |