FreeCalypso > hg > freecalypso-sw
comparison target-utils/c139explore/lcd.c @ 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 | 9e1be763b626 |
comparison
equal
deleted
inserted
replaced
950:cd34e0d534b9 | 951:eb27543ce18e |
---|---|
4 static void | 4 static void |
5 send_cmd_data(cmdbyte, databyte) | 5 send_cmd_data(cmdbyte, databyte) |
6 { | 6 { |
7 send_via_uwire(cmdbyte); | 7 send_via_uwire(cmdbyte); |
8 send_via_uwire(databyte | 0x100); | 8 send_via_uwire(databyte | 0x100); |
9 } | |
10 | |
11 void | |
12 cmd_lcdcmd(argbulk) | |
13 char *argbulk; | |
14 { | |
15 char *argv[3]; | |
16 u_long cmd, data; | |
17 | |
18 if (parse_args(argbulk, 2, 2, argv, 0) < 0) | |
19 return; | |
20 if (parse_hexarg(argv[0], 2, &cmd) < 0) { | |
21 printf("ERROR: arg1 must be a valid 8-bit hex value\n"); | |
22 return; | |
23 } | |
24 if (parse_hexarg(argv[1], 2, &data) < 0) { | |
25 printf("ERROR: arg2 must be a valid 8-bit hex value\n"); | |
26 return; | |
27 } | |
28 send_cmd_data(cmd, data); | |
29 } | |
30 | |
31 static void | |
32 send_pixel_value(pix) | |
33 { | |
34 send_via_uwire((pix >> 8) | 0x100); | |
35 send_via_uwire((pix & 0xFF) | 0x100); | |
36 } | |
37 | |
38 void | |
39 cmd_lcdpix(argbulk) | |
40 char *argbulk; | |
41 { | |
42 char *argv[2]; | |
43 u_long pixval; | |
44 | |
45 if (parse_args(argbulk, 1, 1, argv, 0) < 0) | |
46 return; | |
47 if (parse_hexarg(argv[0], 4, &pixval) < 0) { | |
48 printf("ERROR: arg1 must be a valid 16-bit hex value\n"); | |
49 return; | |
50 } | |
51 send_pixel_value(pixval); | |
9 } | 52 } |
10 | 53 |
11 void | 54 void |
12 cmd_lcdinit() | 55 cmd_lcdinit() |
13 { | 56 { |
24 send_cmd_data(0x11, ystart); | 67 send_cmd_data(0x11, ystart); |
25 send_cmd_data(0x12, xend); | 68 send_cmd_data(0x12, xend); |
26 send_cmd_data(0x13, yend); | 69 send_cmd_data(0x13, yend); |
27 send_cmd_data(0x14, xstart); | 70 send_cmd_data(0x14, xstart); |
28 send_cmd_data(0x15, ystart); | 71 send_cmd_data(0x15, ystart); |
29 } | |
30 | |
31 static void | |
32 send_pixel_value(pix) | |
33 { | |
34 send_via_uwire((pix >> 8) | 0x100); | |
35 send_via_uwire((pix & 0xFF) | 0x100); | |
36 } | 72 } |
37 | 73 |
38 void | 74 void |
39 cmd_lcdfill(argbulk) | 75 cmd_lcdfill(argbulk) |
40 char *argbulk; | 76 char *argbulk; |