FreeCalypso > hg > freecalypso-sw
changeset 951:eb27543ce18e
c139explore: elementary operation commands lcdcmd and lcdpix added
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Wed, 04 Nov 2015 03:03:38 +0000 |
parents | cd34e0d534b9 |
children | 15b1b396ad23 |
files | target-utils/c139explore/cmdtab.c target-utils/c139explore/lcd.c target-utils/c139explore/main.c |
diffstat | 3 files changed, 49 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/target-utils/c139explore/cmdtab.c Wed Nov 04 01:43:44 2015 +0000 +++ b/target-utils/c139explore/cmdtab.c Wed Nov 04 03:03:38 2015 +0000 @@ -4,8 +4,10 @@ extern void cmd_abbw(); extern void cmd_dbl(); extern void cmd_kpbl(); +extern void cmd_lcdcmd(); extern void cmd_lcdfill(); extern void cmd_lcdinit(); +extern void cmd_lcdpix(); extern void cmd_r8(); extern void cmd_r16(); extern void cmd_r32(); @@ -22,8 +24,10 @@ {"abbw", cmd_abbw}, {"dbl", cmd_dbl}, {"kpbl", cmd_kpbl}, + {"lcdcmd", cmd_lcdcmd}, {"lcdfill", cmd_lcdfill}, {"lcdinit", cmd_lcdinit}, + {"lcdpix", cmd_lcdpix}, {"poweroff", abb_power_off}, {"r8", cmd_r8}, {"r16", cmd_r16},
--- a/target-utils/c139explore/lcd.c Wed Nov 04 01:43:44 2015 +0000 +++ b/target-utils/c139explore/lcd.c Wed Nov 04 03:03:38 2015 +0000 @@ -9,6 +9,49 @@ } void +cmd_lcdcmd(argbulk) + char *argbulk; +{ + char *argv[3]; + u_long cmd, data; + + if (parse_args(argbulk, 2, 2, argv, 0) < 0) + return; + if (parse_hexarg(argv[0], 2, &cmd) < 0) { + printf("ERROR: arg1 must be a valid 8-bit hex value\n"); + return; + } + if (parse_hexarg(argv[1], 2, &data) < 0) { + printf("ERROR: arg2 must be a valid 8-bit hex value\n"); + return; + } + send_cmd_data(cmd, data); +} + +static void +send_pixel_value(pix) +{ + send_via_uwire((pix >> 8) | 0x100); + send_via_uwire((pix & 0xFF) | 0x100); +} + +void +cmd_lcdpix(argbulk) + char *argbulk; +{ + char *argv[2]; + u_long pixval; + + if (parse_args(argbulk, 1, 1, argv, 0) < 0) + return; + if (parse_hexarg(argv[0], 4, &pixval) < 0) { + printf("ERROR: arg1 must be a valid 16-bit hex value\n"); + return; + } + send_pixel_value(pixval); +} + +void cmd_lcdinit() { /* from OsmocomBB */ @@ -28,13 +71,6 @@ send_cmd_data(0x15, ystart); } -static void -send_pixel_value(pix) -{ - send_via_uwire((pix >> 8) | 0x100); - send_via_uwire((pix & 0xFF) | 0x100); -} - void cmd_lcdfill(argbulk) char *argbulk;
--- a/target-utils/c139explore/main.c Wed Nov 04 01:43:44 2015 +0000 +++ b/target-utils/c139explore/main.c Wed Nov 04 03:03:38 2015 +0000 @@ -12,6 +12,8 @@ /* GPIO init */ *(volatile u16 *)0xfffe4802 = 0x0002; *(volatile u16 *)0xfffe4804 = 0xFFF5; + /* take peripherals out of reset */ + *(volatile u16 *)0xfffffd04 = 0xFFF3; abb_init(); uwire_init(); for (;;) {