# HG changeset patch
# User sl
# Date 1410021589 -7200
# Node ID fa7c9f9140aa8c84ed175740adf77b2bda6bfb64
# Parent  3b7acc7fb64b4a06e94d18c84a1a8e38a7a6a0af
GP1212A02: Adding select font size command.

diff -r 3b7acc7fb64b -r fa7c9f9140aa FutabaGP1212A02.cpp
--- a/FutabaGP1212A02.cpp	Sat Sep 06 15:54:51 2014 +0200
+++ b/FutabaGP1212A02.cpp	Sat Sep 06 18:39:49 2014 +0200
@@ -102,11 +102,14 @@
 		iNextFrameAddress = 0x0000;
 
 		//Beta font test
-		//SendCommandFontAction(EFontDelete);
-		
+		/*
+		SendCommandFontAction(EFontDelete);
+
+		//SendCommandSelectFontSize(EFontLarge);		
 		//SendCommandReset();
 
-		/*
+		
+		
 		unsigned char charPixels[]={	0xFF,0xFF,0xFF,0xFF,
 										0x80,0x00,0x00,0x01,
 										0x80,0x00,0x00,0x01,
@@ -125,13 +128,19 @@
 										0xFF,0xFF,0xFF,0xFF};
 		
 		
+		//SendCommandFontAction(EFontStore);
 		for (unsigned short i=0;i<16;i++)
 		{
+			//SendCommandFontAction(EFontDelete);
+			
 			SendCommandDefineCharacter(EFont16x32,0x0030+i,charPixels);
 			//SendCommandFontAction(EFontStore);
+			
+			
 			//sleep(100);
 		}
 		*/
+		//SendCommandFontAction(EFontTransfer);
 		
 
 		//SendCommandDefineCharacter(EFont16x32,0x0031,charPixels);
@@ -788,17 +797,17 @@
 /**
 @return Clock character width in pixels.
 */
-int GP1212A02A::ClockCharWidthInPixels(TClockSize aSize)
+int GP1212A02A::ClockCharWidthInPixels(TFontSizeLogical aSize)
 	{
 	switch (aSize)
 		{
-	case EClockTiny:
+	case EFontTiny:
 		return 6;
-	case EClockSmall:
+	case EFontSmall:
 		return 8;
-	case EClockMedium:
+	case EFontMedium:
 		return 12;
-	case EClockLarge:
+	case EFontLarge:
 		return 16;
 		}
 
@@ -808,17 +817,17 @@
 /**
 @return Clock character height in pixels.
 */
-int GP1212A02A::ClockCharHeightInPixels(TClockSize aSize)
+int GP1212A02A::ClockCharHeightInPixels(TFontSizeLogical aSize)
 	{
 	switch (aSize)
 		{
-	case EClockTiny:
+	case EFontTiny:
 		return 8;
-	case EClockSmall:
+	case EFontSmall:
 		return 16;
-	case EClockMedium:
+	case EFontMedium:
 		return 24;
-	case EClockLarge:
+	case EFontLarge:
 		return 32;
 		}
 
@@ -828,7 +837,7 @@
 /**
 Return the Display Window address for centering the clock corresponding to the given parameters.
 */
-unsigned short GP1212A02A::ClockCenterAddress(TClockFormat aFormat, TClockSize aSize)
+unsigned short GP1212A02A::ClockCenterAddress(TClockFormat aFormat, TFontSizeLogical aSize)
 	{
 		int charCount=ClockCharCount(aFormat);
 		int halfWidth=(ClockCharWidthInPixels(aSize)*charCount)/2;
@@ -848,7 +857,7 @@
 */
 void GP1212A02A::ShowClock()
 	{
-	SendCommandClockDisplay(EClockDay24,ClockCenterAddress(EClockDay24,EClockLarge),EClockLarge);
+	SendCommandClockDisplay(EClock24,ClockCenterAddress(EClock24,EFontLarge),EFontLarge);
 	}
 
 /**
@@ -932,7 +941,7 @@
 that cannot be displayed. 
 * Excluding the clock display area can be input other display commands.
 */
-void GP1212A02A::SendCommandClockDisplay(TClockFormat aClockFormat, unsigned short aAddress, TClockSize aSize)
+void GP1212A02A::SendCommandClockDisplay(TClockFormat aClockFormat, unsigned short aAddress, TFontSizeLogical aSize)
 	{
 	FutabaVfdReport report;
     report[0]=0x00; //Report ID
@@ -1081,7 +1090,6 @@
 Ps = 31H : Transfer
 Ps = 32H : Delete
 */
-
 void GP1212A02A::SendCommandFontAction(TFontAction aFontAction)
 	{
 	FutabaVfdReport report;
@@ -1094,3 +1102,27 @@
 
     Write(report);
 	}
+
+
+/**
+[Code]1BH,4AH,46H,Pf
+[Function]Setting the font size 
+ Pf = Font size 
+[Definable area]
+Pf = 30H?6x8 dot 
+Pf = 31H?8x16dot and 16x16 dot 
+Pf = 32H?12x24 dot and 24x24 dot 
+Pf = 33H?16x32 dot and 32x32 dot
+*/
+void GP1212A02A::SendCommandSelectFontSize(TFontSizeLogical aFontSoze)
+	{
+	FutabaVfdReport report;
+    report[0]=0x00; //Report ID
+    report[1]=0x04; //Report size
+    report[2]=0x1B; //Command ID
+    report[3]=0x4A; //Command ID
+    report[4]=0x46; //Command ID
+    report[5]=aFontSoze; //Pf
+
+    Write(report);
+	}
\ No newline at end of file
diff -r 3b7acc7fb64b -r fa7c9f9140aa FutabaGP1212A02.h
--- a/FutabaGP1212A02.h	Sat Sep 06 15:54:51 2014 +0200
+++ b/FutabaGP1212A02.h	Sat Sep 06 18:39:49 2014 +0200
@@ -106,12 +106,12 @@
 		EClockDay12	=	0x11
 	};
 
-	enum TClockSize
+	enum TFontSizeLogical
 	{
-		EClockTiny		=	0x30,
-		EClockSmall		=	0x31,
-		EClockMedium	=	0x32,
-		EClockLarge		=	0x33
+		EFontTiny		=	0x30,
+		EFontSmall		=	0x31,
+		EFontMedium	=	0x32,
+		EFontLarge		=	0x33
 	};
 
 	enum TFontSize
@@ -144,11 +144,12 @@
 	void SendCommandPower(TPowerStatus aPowerStatus);
 	//Clock commands
 	void SendCommandClockSetting(TWeekDay aWeekDay, unsigned char aHour, unsigned char aMinute);
-	void SendCommandClockDisplay(TClockFormat aClockFormat, unsigned short aAddress, TClockSize aSize);	
+	void SendCommandClockDisplay(TClockFormat aClockFormat, unsigned short aAddress, TFontSizeLogical aSize);	
 	void SendCommandClockCancel();
 	//Font commands
 	void SendCommandDefineCharacter(TFontSize aFontSize, unsigned short aCharacterCode, unsigned char* aPixelData);
 	void SendCommandFontAction(TFontAction aFontAction);
+	void SendCommandSelectFontSize(TFontSizeLogical aFontSoze);
 
 
 	//BMP box
@@ -159,9 +160,9 @@
 
 	//Clock utilities
 	int ClockCharCount(TClockFormat aFormat);
-	int ClockCharWidthInPixels(TClockSize aSize);
-	int ClockCharHeightInPixels(TClockSize aSize);
-	unsigned short ClockCenterAddress(TClockFormat aFormat, TClockSize aSize);
+	int ClockCharWidthInPixels(TFontSizeLogical aSize);
+	int ClockCharHeightInPixels(TFontSizeLogical aSize);
+	unsigned short ClockCenterAddress(TClockFormat aFormat, TFontSizeLogical aSize);
 	//Font utilities
 	int CharacterSizeInBytes(TFontSize aFontSize);