diff lcdtest/showppm.c @ 21:1d8c499711f1

lcdtest PPM display: sending the picture all at once is much faster
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 11 Apr 2018 00:09:50 +0000
parents f3671d3ad953
children
line wrap: on
line diff
--- a/lcdtest/showppm.c	Tue Apr 10 23:55:42 2018 +0000
+++ b/lcdtest/showppm.c	Wed Apr 11 00:09:50 2018 +0000
@@ -139,6 +139,7 @@
 {
 	int rc;
 	unsigned n;
+	u_char ftbuf[176*220*6+3], *dp;
 
 	ppm_filename = argv[1];
 	ppmfile = fopen(ppm_filename, "r");
@@ -156,15 +157,28 @@
 	write_ir(0x21);
 	write_dr(0);
 	write_ir(0x22);
+	/* GPIO setup */
+	dp = ftbuf;
+	*dp++ = 0x82;
+	*dp++ = 0x03;
+	*dp++ = 0x03;
 	for (n = 0; n < 176*220; n++) {
 		rc = ppm_get_rgb();
 		if (rc < 0) {
 			fclose(ppmfile);
 			return(-1);
 		}
-		write_dr(rc);
+		/* upper byte */
+		*dp++ = 0x92;
+		*dp++ = 0;	/* dummy addr */
+		*dp++ = rc >> 8;
+		/* lower byte */
+		*dp++ = 0x92;
+		*dp++ = 0;	/* dummy addr */
+		*dp++ = rc;
 	}
 	fclose(ppmfile);
+	do_ftdi_write(ftbuf, sizeof ftbuf);
 	return(0);
 }