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