diff mbox

[U-Boot,v2,02/24] common/lcd: Add command for setting cursor within lcd-console

Message ID 1422966166-3973-2-git-send-email-oe5hpm@oevsv.at
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Hannes Schmelzer Feb. 3, 2015, 12:22 p.m. UTC
Sometimes we do not want redirect u-boot's console to screen but anyway we want
write out some status information out of a u-boot script to the display.

To define the specific position of the string to be written, we have to set
the cursor with "setcurs" before writing.

Signed-off-by: Hannes Petermaier <oe5hpm@oevsv.at>

---
Changes for V2:
  - more understandable commit-message
  - moved code from lcd.c into lcd_console.c
---
 common/lcd_console.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Tom Rini March 6, 2015, 3:44 p.m. UTC | #1
On Tue, Feb 03, 2015 at 01:22:24PM +0100, Hannes Petermaier wrote:

> Sometimes we do not want redirect u-boot's console to screen but anyway we want
> write out some status information out of a u-boot script to the display.
> 
> To define the specific position of the string to be written, we have to set
> the cursor with "setcurs" before writing.
> 
> Signed-off-by: Hannes Petermaier <oe5hpm@oevsv.at>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/common/lcd_console.c b/common/lcd_console.c
index 74c388a..5363232 100644
--- a/common/lcd_console.c
+++ b/common/lcd_console.c
@@ -209,3 +209,24 @@  void lcd_printf(const char *fmt, ...)
 
 	lcd_puts(buf);
 }
+
+static int do_lcd_setcursor(cmd_tbl_t *cmdtp, int flag, int argc,
+			    char *const argv[])
+{
+	unsigned int col, row;
+
+	if (argc != 3)
+		return CMD_RET_USAGE;
+
+	col = simple_strtoul(argv[1], NULL, 10);
+	row = simple_strtoul(argv[2], NULL, 10);
+	lcd_position_cursor(col, row);
+
+	return 0;
+}
+
+U_BOOT_CMD(
+	setcurs, 3,	1,	do_lcd_setcursor,
+	"set cursor position within screen",
+	"    <col> <row> in character"
+);