comparison rvinterf/lowlevel/rviflcd.c @ 908:ed5dcc53e0b3

rvinterf: hook for fc-lcdemu implemented
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 07 Sep 2015 10:55:01 +0000
parents
children 16ed75e266f2
comparison
equal deleted inserted replaced
907:7a189b7bbd67 908:ed5dcc53e0b3
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
18 void
19 open_extlcd_pipe()
20 {
21 extlcd_pout = popen(extlcd_program, "w");
22 if (!extlcd_pout) {
23 perror(extlcd_program);
24 exit(1);
25 }
26 }
27
28 void
29 output_to_extlcd()
30 {
31 int i;
32
33 fprintf(extlcd_pout, "%u %u ", rxpkt[1], rxpkt[2]);
34 for (i = 3; i < rxpkt_len; i += 2)
35 fprintf(extlcd_pout, "%02X%02X", rxpkt[i+1], rxpkt[i]);
36 fputc('\n', extlcd_pout);
37 fflush(extlcd_pout);
38 }