comparison rvinterf/lowlevel/rviflcd.c @ 0:e7502631a0f9

initial import from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 11 Jun 2016 00:13:35 +0000
parents
children a626f0ef542a
comparison
equal deleted inserted replaced
-1:000000000000 0:e7502631a0f9
1 /*
2 * This rvinterf module implements the piping of LCD output to fc-lcdemu
3 */
4
5 #include <sys/types.h>
6 #include <stdio.h>
7 #include <string.h>
8 #include <strings.h>
9 #include <stdlib.h>
10 #include <unistd.h>
11
12 extern u_char rxpkt[];
13 extern size_t rxpkt_len;
14
15 char *extlcd_program;
16 FILE *extlcd_pout;
17 u_char extlcd_invert;
18
19 void
20 open_extlcd_pipe()
21 {
22 extlcd_pout = popen(extlcd_program, "w");
23 if (!extlcd_pout) {
24 perror(extlcd_program);
25 exit(1);
26 }
27 }
28
29 void
30 output_to_extlcd()
31 {
32 int i;
33
34 fprintf(extlcd_pout, "%u %u ", rxpkt[1], rxpkt[2]);
35 for (i = 3; i < rxpkt_len; i += 2)
36 fprintf(extlcd_pout, "%02X%02X", rxpkt[i+1] ^ extlcd_invert,
37 rxpkt[i] ^ extlcd_invert);
38 fputc('\n', extlcd_pout);
39 fflush(extlcd_pout);
40 }