aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2013-04-03 15:34:48 +0200
committerJoel Bodenmann <joel@unormal.org>2013-04-03 15:34:48 +0200
commitb386962981d7667cd0d14cc50969eb82d0d71dcc (patch)
treed75928a8b0dba43763b67cd505467f2a9309fe38
parent4871a420573d1a4986eb8a3cee18e4a8c58faee5 (diff)
parent8b15aab802024434bd8565aebb33368e66532a97 (diff)
downloaduGFX-b386962981d7667cd0d14cc50969eb82d0d71dcc.tar.gz
uGFX-b386962981d7667cd0d14cc50969eb82d0d71dcc.tar.bz2
uGFX-b386962981d7667cd0d14cc50969eb82d0d71dcc.zip
merged inmarket
-rw-r--r--demos/modules/gdisp/gdisp_images/main.c16
-rw-r--r--include/gdisp/image.h2
-rw-r--r--src/gdisp/image.c4
-rw-r--r--tools/file2c/binaries/file2c.exebin9216 -> 9728 bytes
-rw-r--r--tools/file2c/source/VS 2012 Project/file2c.v11.suobin25600 -> 25600 bytes
-rw-r--r--tools/file2c/source/file2c.c29
6 files changed, 43 insertions, 8 deletions
diff --git a/demos/modules/gdisp/gdisp_images/main.c b/demos/modules/gdisp/gdisp_images/main.c
index 6ca5f640..8f14750e 100644
--- a/demos/modules/gdisp/gdisp_images/main.c
+++ b/demos/modules/gdisp/gdisp_images/main.c
@@ -22,12 +22,22 @@
#include "hal.h"
#include "gfx.h"
+#ifdef WIN32
+ #define USE_MEMORY_FILE FALSE // Can be true or false for Win32
+#else
+ #define USE_MEMORY_FILE TRUE // Non-Win32 - use the compiled in image
+#endif
+
+#if USE_MEMORY_FILE
+ #include "test-pal8.h"
+#endif
+
static gdispImage myImage;
int main(void) {
coord_t swidth, sheight;
- halInit(); // Initialise the Hardware
+ halInit(); // Initialize the Hardware
chSysInit(); // Initialize the OS
gdispInit(); // Initialize the display
@@ -38,7 +48,11 @@ int main(void) {
sheight = gdispGetHeight();
// Set up IO for our image
+#if USE_MEMORY_FILE
+ gdispImageSetMemoryReader(&myImage, test_pal8);
+#else
gdispImageSetSimulFileReader(&myImage, "test-pal8.bmp");
+#endif
gdispImageOpen(&myImage);
gdispImageDraw(&myImage, 0, 0, swidth, sheight, 0, 0);
diff --git a/include/gdisp/image.h b/include/gdisp/image.h
index 8e71437b..49b10d42 100644
--- a/include/gdisp/image.h
+++ b/include/gdisp/image.h
@@ -135,7 +135,7 @@ extern "C" {
*
* @note Always returns TRUE for a Memory Reader
*/
- bool_t gdispImageSetMemoryReader(gdispImage *img, const char *memimage);
+ bool_t gdispImageSetMemoryReader(gdispImage *img, const void *memimage);
/**
* @brief Sets the io fields in the image structure to routines
diff --git a/src/gdisp/image.c b/src/gdisp/image.c
index 616aab11..3da0844d 100644
--- a/src/gdisp/image.c
+++ b/src/gdisp/image.c
@@ -88,10 +88,10 @@ static void ImageMemoryClose(struct gdispImageIO *pio) {
static const gdispImageIOFunctions ImageMemoryFunctions =
{ ImageMemoryRead, ImageMemorySeek, ImageMemoryClose };
-bool_t gdispImageSetMemoryReader(gdispImage *img, const char *memimage) {
+bool_t gdispImageSetMemoryReader(gdispImage *img, const void *memimage) {
img->io.fns = &ImageMemoryFunctions;
img->io.pos = 0;
- img->io.fd = (void *)memimage;
+ img->io.fd = memimage;
return TRUE;
}
diff --git a/tools/file2c/binaries/file2c.exe b/tools/file2c/binaries/file2c.exe
index d1959ad6..333b1138 100644
--- a/tools/file2c/binaries/file2c.exe
+++ b/tools/file2c/binaries/file2c.exe
Binary files differ
diff --git a/tools/file2c/source/VS 2012 Project/file2c.v11.suo b/tools/file2c/source/VS 2012 Project/file2c.v11.suo
index 586b2c04..38fa846c 100644
--- a/tools/file2c/source/VS 2012 Project/file2c.v11.suo
+++ b/tools/file2c/source/VS 2012 Project/file2c.v11.suo
Binary files differ
diff --git a/tools/file2c/source/file2c.c b/tools/file2c/source/file2c.c
index d58d6a58..29b9da2f 100644
--- a/tools/file2c/source/file2c.c
+++ b/tools/file2c/source/file2c.c
@@ -46,7 +46,7 @@ static char *filenameof(char *fname) {
static char *clean4c(char *fname) {
char *p;
- while((p = strpbrk(fname, "-+ `~!@#$%^&*(){}[]|:;'\",<>?/|="))) *p = '_';
+ while((p = strpbrk(fname, "-+ `~!@#$%^&*(){}[]|:;'\",<>?/|=.\\"))) *p = '_';
return fname;
}
@@ -66,7 +66,7 @@ size_t len;
size_t i;
/* Default values for our parameters */
- opt_progname = argv[0];
+ opt_progname = filenameof(argv[0]);
opt_inputfile = 0;
opt_outputfile = 0;
opt_arrayname = 0;
@@ -79,6 +79,7 @@ size_t i;
if (argv[0][0] == '-') {
while (*++(argv[0])) {
switch(argv[0][0]) {
+ case '?': case 'h': goto usage;
case 'b': opt_breakblocks = 1; break;
case 'c': opt_const = "const "; break;
case 's': opt_static = "static "; break;
@@ -97,6 +98,7 @@ size_t i;
fprintf(stderr, "Usage:\n\t%s -?\n"
"\t%s [-bs] [-n name] [inputfile] [outputfile]\n"
"\t\t-?\tThis help\n"
+ "\t\t-h\tThis help\n"
"\t\t-b\tBreak the arrays for compilers that won't handle large arrays\n"
"\t\t-c\tDeclare the arrays as const (useful to ensure they end up in Flash)\n"
"\t\t-s\tDeclare the arrays as static\n"
@@ -136,14 +138,33 @@ size_t i;
} else
f_output = stdout;
- /* Set the array name */
+ /* Print the comment header */
+ fprintf(f_output, "/**\n * This file was generated ");
+ if (opt_inputfile) fprintf(f_output, "from \"%s\" ", opt_inputfile);
+ fprintf(f_output, "using...\n *\n *\t%s", opt_progname);
+ if (opt_arrayname || opt_static[0] || opt_const[0] || opt_breakblocks) {
+ fprintf(f_output, " -");
+ if (opt_breakblocks) fprintf(f_output, "b");
+ if (opt_const[0]) fprintf(f_output, "c");
+ if (opt_static[0]) fprintf(f_output, "s");
+ if (opt_arrayname) fprintf(f_output, "n %s", opt_arrayname);
+ }
+ if (opt_inputfile) fprintf(f_output, " %s", opt_inputfile);
+ if (opt_outputfile) fprintf(f_output, " %s", opt_outputfile);
+ fprintf(f_output, "\n *\n */\n");
+
+ /*
+ * Set the array name.
+ * We do this after printing opt_inputfile for the last time as we
+ * modify opt_inputfile in place to generate opt_arrayname.
+ */
if (!opt_arrayname) {
if (opt_inputfile)
opt_arrayname = filenameof(opt_inputfile);
if (!opt_arrayname || !opt_arrayname[0])
opt_arrayname = "filearray";
- opt_arrayname = clean4c(opt_arrayname);
}
+ opt_arrayname = clean4c(opt_arrayname);
/* Read the file processing 1K at a time */
blocknum = 0;