changeset 195:4d9f24c501f3

bwsplash: simple splash screen for FreeCalypso Lite (smallbw)
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 28 Mar 2021 21:36:48 +0000
parents 0983c77b8f54
children 86375353219d
files .hgignore bwsplash/Makefile bwsplash/README bwsplash/bwsplash.pbm bwsplash/pbm2c.c
diffstat 5 files changed, 182 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sun Mar 28 18:16:13 2021 +0000
+++ b/.hgignore	Sun Mar 28 21:36:48 2021 +0000
@@ -2,6 +2,9 @@
 
 ^build-
 
+^bwsplash/bwsplash.c$
+^bwsplash/pbm2c$
+
 ^helpers/build-date$
 ^helpers/cfg-hdr-gen$
 ^helpers/makeline$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bwsplash/Makefile	Sun Mar 28 21:36:48 2021 +0000
@@ -0,0 +1,13 @@
+CC=	gcc
+CFLAGS=	-O2
+
+all:	bwsplash.c
+
+pbm2c:	pbm2c.c
+	${CC} ${CFLAGS} -o $@ $@.c
+
+bwsplash.c:	bwsplash.pbm pbm2c
+	./pbm2c bwsplash.pbm $@
+
+clean:
+	rm -f pbm2c bwsplash.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bwsplash/README	Sun Mar 28 21:36:48 2021 +0000
@@ -0,0 +1,18 @@
+When TI's original version of small B&W UI firmware boots or shuts down, the
+splash screen it displays consists of a 56x38 pixel B&W TI logo centered in the
+middle of the LCD.  (Back when this code was owned by Condat rather than TI,
+this splash screen was an animated Condat logo of approximately the same size -
+it is still present in the code, conditioned out.)  Because we are FreeCalypso
+and not TI or Condat, we need our own logo or at least our own splash screen to
+replace those other company logos.
+
+A bona fide FreeCalypso logo does not exist yet as of this writing (2021-03),
+and while we (Falconia family that owns FC) do have some logo ideas in the
+works, the 96x64 pixel B&W (1bpp) framebuffer in the FreeCalypso Lite config is
+far too limited compared to other media - hence we are currently going for a
+simple splash screen that merely consists of the words "FreeCalypso Lite".
+
+The current version of our minimal-effort splash screen is 80x30 pixels, to be
+centered in the middle of the 96x64 pixel LCD.  The bitmap drawing is given in
+bwsplash.pbm, which is a Plain PBM file, making the pixel image directly
+viewable and editable in vi.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bwsplash/bwsplash.pbm	Sun Mar 28 21:36:48 2021 +0000
@@ -0,0 +1,32 @@
+P1
+80 30
+11111110000000000000000000000111111000000000011000000000000000000000000000000000
+11111110000000000000000000000111011100000000011000000000000000000000000000000000
+11000000110100011000000110001100001100011100011011000011011011000011100000111000
+11000000111101111110011111101100000000111111011001100110011111100111111011111100
+11111110110001100110011001101100000000110011011001100110011000110110011011000110
+11111110110011000110110001101100000000000111011001100100011000110111100011000110
+11000000110011111110111111101100000110111111011000111100011000110011111011000110
+11000000110011000000110000001100001101100011011000111100011000110000011011000110
+11000000110001100110011001100111011101110111011000111000011101110110011011001110
+11000000110001111100011111000011111000111111011000011000011111100111111001111100
+00000000000000000000000000000000000000000000000000011000011000000000000000000000
+00000000000000000000000000000000000000000000000000110000011000000000000000000000
+00000000000000000000000000000000000000000000000001110000011000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000000000000000000000000000000000000000000000000000000000
+00000000000000000000000000011000000000000000000000000000000000000000000000000000
+00000000000000000000000000011000000011000110000000000000000000000000000000000000
+00000000000000000000000000011000000000000110000011000000000000000000000000000000
+00000000000000000000000000011000000011001111001111110000000000000000000000000000
+00000000000000000000000000011000000011000110001100110000000000000000000000000000
+00000000000000000000000000011000000011000110011000110000000000000000000000000000
+00000000000000000000000000011000000011000110011111110000000000000000000000000000
+00000000000000000000000000011000000011000110011000000000000000000000000000000000
+00000000000000000000000000011111110011000110001100110000000000000000000000000000
+00000000000000000000000000011111110011000111001111100000000000000000000000000000
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bwsplash/pbm2c.c	Sun Mar 28 21:36:48 2021 +0000
@@ -0,0 +1,116 @@
+/*
+ * This program compiles bwsplash.pbm into a C char array
+ * for inclusion into phone UI firmware source.
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+
+FILE *inf, *outf;
+char *infname, linebuf[128];
+int lineno;
+
+void
+get_input_line()
+{
+	char *cp;
+
+	if (!fgets(linebuf, sizeof linebuf, inf)) {
+		fprintf(stderr, "%s: premature EOF\n", infname);
+		exit(1);
+	}
+	lineno++;
+	cp = index(linebuf, '\n');
+	if (!cp) {
+		fprintf(stderr, "%s line %d: too long or missing newline\n",
+			infname, lineno);
+		exit(1);
+	}
+	*cp = '\0';
+}
+
+void
+parse_pixel_line(outbuf, npix)
+	u_char *outbuf;
+	unsigned npix;
+{
+	char *cp;
+	u_char *dp;
+	unsigned n;
+
+	cp = linebuf;
+	dp = outbuf;
+	for (n = 0; n < npix; n++) {
+		if (*cp != '0' && *cp != '1') {
+inv:			fprintf(stderr,
+	"%s line %d: does not match expected line of %u 0/1 characters\n",
+				infname, lineno, npix);
+			exit(1);
+		}
+		*dp++ = *cp++ - '0';
+	}
+	if (*cp)
+		goto inv;
+}
+
+void
+pack_pixel_byte(bits)
+	u_char *bits;
+{
+	unsigned byte, mask, n;
+
+	byte = 0;
+	for (n = 0, mask = 0x80; n < 8; n++, mask >>= 1)
+		if (bits[n])
+			byte |= mask;
+	fprintf(outf, "0x%02X,", byte);
+}
+
+main(argc, argv)
+	char **argv;
+{
+	unsigned nrow, ncol;
+	u_char rowbuf[80];
+
+	if (argc != 3) {
+		fprintf(stderr, "usage: %s pbmfile outfile\n", argv[0]);
+		exit(1);
+	}
+	infname = argv[1];
+	inf = fopen(infname, "r");
+	if (!inf) {
+		perror(infname);
+		exit(1);
+	}
+	get_input_line();
+	if (strcmp(linebuf, "P1")) {
+		fprintf(stderr,
+			"error in %s: first line is not the expected \"P1\"\n",
+			infname);
+		exit(1);
+	}
+	get_input_line();
+	if (strcmp(linebuf, "80 30")) {
+		fprintf(stderr,
+		"error in %s: second line is not the expected \"80 30\"\n",
+			infname);
+		exit(1);
+	}
+	outf = fopen(argv[2], "w");
+	if (!outf) {
+		perror(argv[2]);
+		exit(1);
+	}
+	for (nrow = 0; nrow < 30; nrow++) {
+		get_input_line();
+		parse_pixel_line(rowbuf, 80);
+		putc('\t', outf);
+		for (ncol = 0; ncol < 80; ncol += 8)
+			pack_pixel_byte(rowbuf + ncol);
+		putc('\n', outf);
+	}
+	exit(0);
+}