basic implementation done ...
[my-code/atmel.git] / led_plex / convert_font.c
diff --git a/led_plex/convert_font.c b/led_plex/convert_font.c
new file mode 100644 (file)
index 0000000..33f7897
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * convert_font.c - convert linux console 8x8 font data
+ *
+ * author: hackbard@hackdaworld.org
+ *
+ * usage:
+ *
+ * first you have to adjust this file two times (see comments!)
+ *
+ * build: gcc -Wall -o convert_font convert_font.c -I/usr/src/linux/include
+ * 
+ * ./convert_font > fonts.asm
+ *
+ * ONLY 8x8 FONTS SUPPORTED!
+ *
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+typedef unsigned int u32;
+
+// put your font data here!
+#include "/usr/src/linux/drivers/video/console/font_pearl_8x8.c"
+
+int main(int argc,char **argv) {
+
+       unsigned char *font_data;
+       int font,col,row;
+
+       // adjust the font data pointer here!
+       font_data=(unsigned char *)fontdata_pearl8x8;
+
+       for(font=0;font<=0x7f;font++) {
+
+               /* print the font number */
+               printf("; %d 0x%02x",font,font);
+               if((font>0x1f)&(font<0x7f))
+                       printf(" %c\n",font);
+               else
+                       printf("\n");
+               printf(".db ");
+
+               /* print the array content of the font */
+               for(col=0;col<8;col++) {
+                       printf("0b");
+                       for(row=0;row<8;row++)
+       printf("%c",((font_data[font*8+row]>>(7-col))&1)?'1':'0');
+                       if(col!=7) printf(", ");
+                       else printf("\n");
+
+               }
+       }
+
+       return 0;
+}