ソースを参照

Organize fonts.

Vladimir N. Shilov 1 年間 前
コミット
89a30393ed

+ 5 - 1
Stab-STM32.code-workspace

@@ -4,5 +4,9 @@
 			"path": "."
 		}
 	],
-	"settings": {}
+	"settings": {
+		"files.associations": {
+			"stdio.h": "c"
+		}
+	}
 }

+ 2 - 0
lib/st7735/font_12x16uk.c

@@ -1,5 +1,6 @@
 #include "fonts.h"
 
+#ifdef USE_Font_10x16ua
 static const uint16_t Font12x16ukr [] = {
   0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,  //  32  20  ' '
   0x0600,0x0600,0x0F00,0x0F00,0x0F00,0x0F00,0x0F00,0x0600,0x0600,0x0600,0x0000,0x0000,0x0600,0x0600,0x0000,0x0000,  //  33  21  '!'
@@ -228,3 +229,4 @@ static const uint16_t Font12x16ukr [] = {
 };
 
 FontDef Font_10x16ua = {12,16,Font12x16ukr};
+#endif

+ 12 - 3
lib/st7735/fonts.c

@@ -1,5 +1,6 @@
 #include "fonts.h"
 
+#ifdef USE_Font_7x10
 static const uint16_t Font7x10 [] = {
   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // sp
   0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x0000, 0x1000, 0x0000, 0x0000,  // !
@@ -97,7 +98,8 @@ static const uint16_t Font7x10 [] = {
   0x3000, 0x1000, 0x1000, 0x1000, 0x0800, 0x0800, 0x1000, 0x1000, 0x1000, 0x3000,  // }
   0x0000, 0x0000, 0x0000, 0x7400, 0x4C00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,  // ~
 };
-
+#endif
+#ifdef USE_Font_11x18
 static const uint16_t Font11x18 [] = {
   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,   // sp
   0x0000, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0000, 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000,   // !
@@ -195,7 +197,8 @@ static const uint16_t Font11x18 [] = {
   0x3800, 0x3C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0E00, 0x0700, 0x0700, 0x0E00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x3C00, 0x3800,   // }
   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3880, 0x7F80, 0x4700, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,   // ~
 };
-
+#endif
+#ifdef USE_Font_16x26
 static const uint16_t Font16x26 [] = {
   0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [ ]
   0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03E0,0x03C0,0x03C0,0x01C0,0x01C0,0x01C0,0x01C0,0x01C0,0x0000,0x0000,0x0000,0x03E0,0x03E0,0x03E0,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [!]
@@ -293,8 +296,14 @@ static const uint16_t Font16x26 [] = {
   0x3FC0,0x03E0,0x01E0,0x01E0,0x01E0,0x01E0,0x01C0,0x03C0,0x03C0,0x01C0,0x01E0,0x00FE,0x00FE,0x01E0,0x01C0,0x03C0,0x03C0,0x01C0,0x01E0,0x01E0,0x01E0,0x01E0,0x03E0,0x3FC0,0x3F00,0x0000, // Ascii = [}]
   0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3F07,0x7FC7,0x73E7,0xF1FF,0xF07E,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, // Ascii = [~]
 };
+#endif
 
-
+#ifdef USE_Font_7x10
 FontDef Font_7x10 = {7,10,Font7x10};
+#endif
+#ifdef USE_Font_11x18
 FontDef Font_11x18 = {11,18,Font11x18};
+#endif
+#ifdef USE_Font_16x26
 FontDef Font_16x26 = {16,26,Font16x26};
+#endif

+ 14 - 3
lib/st7735/fonts.h

@@ -3,19 +3,30 @@
 
 #include <stdint.h>
 
+#define USE_UTF8
+#define USE_LiberM_7x10
+#define USE_Font_11x18
+
 typedef struct {
   const uint8_t width;
   const uint8_t height;
   const uint16_t *data;
 } FontDef;
 
-
+#ifdef USE_Font_7x10
 extern FontDef Font_7x10;
+#endif
+#ifdef USE_Font_11x18
 extern FontDef Font_11x18;
+#endif
+#ifdef USE_Font_16x26
 extern FontDef Font_16x26;
+#endif
+#ifdef USE_LiberM_7x10
 extern FontDef LiberM_7x10;
+#endif
+#ifdef USE_Font_10x16ua
 extern FontDef Font_10x16ua;
-
-#define USE_UTF8
+#endif
 
 #endif // __FONTS_H__

+ 2 - 0
lib/st7735/liberation_mono_7x10.c

@@ -1,5 +1,6 @@
 #include "fonts.h"
 
+#ifdef USE_LiberM_7x10
 static const uint16_t LiberM7x10 [] = {
 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,  /* 32-  */
 0x0000,0x0000,0x1000,0x1000,0x1000,0x1000,0x1000,0x0000,0x1000,0x0000,  /* 33-! */
@@ -228,3 +229,4 @@ static const uint16_t LiberM7x10 [] = {
 };
 
 FontDef LiberM_7x10 = {7,10,LiberM7x10};
+#endif