diff FontPack/base_upperRegion.c @ 123:a984d87a1ec0 FlipDisplay

Added option to build FontPack as static libary which is linked to the Firmware project (to allow separate build settings)
author Ideenmodellierer
date Sun, 27 Jan 2019 22:01:07 +0100
parents 51e2734895a3
children 0172431fbad9
line wrap: on
line diff
--- a/FontPack/base_upperRegion.c	Sun Jan 13 18:59:53 2019 +0100
+++ b/FontPack/base_upperRegion.c	Sun Jan 27 22:01:07 2019 +0100
@@ -49,12 +49,12 @@
 // From Common/Inc:
 #include "FirmwareData.h"
 
-// From Discovery/Inc
-#include "gfx_fonts.h"
 
+#ifdef DEBUG
 // From AC6 support:
 #include <stdio.h>
 #include <stdint.h>
+#endif
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -85,6 +85,7 @@
 
 //////////////////////////////////////////////////////////////////////////////
 
+#ifdef BUILD_LIBRARY
 /* Fonts fixed in upper region */
 #include "Fonts/font_awe48.h"
 #include "Fonts/font_T24.h"
@@ -95,32 +96,35 @@
 #include "Fonts/font_T105.h"
 #include "Fonts/font_T144_plus.h"
 
+#include "Fonts/image_ostc.h"
+#else
+#include "gfx_fonts.h"
+#endif
 
 /* Images fixed in upper region */
 #include "Fonts/image_battery.h"
 #include "Fonts/image_heinrichs_weikamp.h"
-#include "Fonts/image_ostc.h"
+
+/////////////////////////////////////////////////////////////////////////////
+
 
-//////////////////////////////////////////////////////////////////////////////
+#ifdef DEBUG
+
+#define ASSERT(e) \
+		do { if( ! (e) )  {	++errors; printf("FAIL at %3d: %s \n", __LINE__, #e); errorflag = 1;} } while(0)
+
+#define ASSERT_RANGE(e, min, max) ASSERT(min <= e); ASSERT( e <= max)
 
 extern void initialise_monitor_handles(void);
 
 static int errors = 0;
 static uint8_t errorflag = 0;
 
-#define ASSERT(e) \
-		do { if( ! (e) )  {	++errors; printf("FAIL at %3d: %s \n", __LINE__, #e); errorflag = 1;} } while(0)
-
-#define ASSERT_RANGE(e, min, max) ASSERT(min <= e); ASSERT( e <= max)
-
-
-
 int main(void)
 {
-#ifdef DEBUG_STLINK_V2
+#if DEBUG_STLINK_V2
 	 initialise_monitor_handles();
 #endif
-
 		//---- Check the linker puts the directory at the requested address ------
 		ASSERT( & Awe48    == (tFont*)0x81DFE00 );
 		ASSERT( & FontT24  == (tFont*)0x81DFE0c );
@@ -131,8 +135,6 @@
 		ASSERT( & FontT105 == (tFont*)0x81DFE48 );
 		ASSERT( & FontT144 == (tFont*)0x81DFE54 );
 
-
-
 		//---- Check the linker puts the font data in the requested section ------
 		extern tChar __upper_font_data;
 		extern tChar __upper_font_data_end;
@@ -145,9 +147,6 @@
 
 		ASSERT_RANGE(&ImgOSTC,  (tImage*)&__upper_font_data, (tImage*)&__upper_font_data_end);
 
-
-
-
 		for(const tFont* font = & __font_directory; font < &__font_directory_end; ++font)
 		{
 			printf("Font: %x\n",font);
@@ -236,5 +235,28 @@
 		printf("Font Check: no errors.\n");
 		return 0;
 }
+/*#endif*/
+#else
+#define ASSERT(e) \
+		do { if( ! (e) )  {	++errors; errorflag = 1;} } while(0)
 
+#define ASSERT_RANGE(e, min, max) ASSERT(min <= e); ASSERT( e <= max)
+
+uint16_t errors = 1;
+static uint8_t errorflag = 0;
+uint16_t CheckFontPosition()
+{
+	uint16_t retvalue;
+	ASSERT( & Awe48    == (tFont*)0x81DFE00 );
+	ASSERT( & FontT24  == (tFont*)0x81DFE0c );
+	ASSERT( & FontT42  == (tFont*)0x81DFE18 );
+	ASSERT( & FontT48  == (tFont*)0x81DFE24 );
+	ASSERT( & FontT54  == (tFont*)0x81DFE30 );
+	ASSERT( & FontT84  == (tFont*)0x81DFE3c );
+	ASSERT( & FontT105 == (tFont*)0x81DFE48 );
+	ASSERT( & FontT144 == (tFont*)0x81DFE54 );
+	retvalue = errors;
+	return retvalue;
+}
+#endif
 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/