GP1212A02: Adding select font size command.
1.1 --- a/FutabaGP1212A02.cpp Sat Sep 06 15:54:51 2014 +0200
1.2 +++ b/FutabaGP1212A02.cpp Sat Sep 06 18:39:49 2014 +0200
1.3 @@ -102,11 +102,14 @@
1.4 iNextFrameAddress = 0x0000;
1.5
1.6 //Beta font test
1.7 - //SendCommandFontAction(EFontDelete);
1.8 -
1.9 + /*
1.10 + SendCommandFontAction(EFontDelete);
1.11 +
1.12 + //SendCommandSelectFontSize(EFontLarge);
1.13 //SendCommandReset();
1.14
1.15 - /*
1.16 +
1.17 +
1.18 unsigned char charPixels[]={ 0xFF,0xFF,0xFF,0xFF,
1.19 0x80,0x00,0x00,0x01,
1.20 0x80,0x00,0x00,0x01,
1.21 @@ -125,13 +128,19 @@
1.22 0xFF,0xFF,0xFF,0xFF};
1.23
1.24
1.25 + //SendCommandFontAction(EFontStore);
1.26 for (unsigned short i=0;i<16;i++)
1.27 {
1.28 + //SendCommandFontAction(EFontDelete);
1.29 +
1.30 SendCommandDefineCharacter(EFont16x32,0x0030+i,charPixels);
1.31 //SendCommandFontAction(EFontStore);
1.32 +
1.33 +
1.34 //sleep(100);
1.35 }
1.36 */
1.37 + //SendCommandFontAction(EFontTransfer);
1.38
1.39
1.40 //SendCommandDefineCharacter(EFont16x32,0x0031,charPixels);
1.41 @@ -788,17 +797,17 @@
1.42 /**
1.43 @return Clock character width in pixels.
1.44 */
1.45 -int GP1212A02A::ClockCharWidthInPixels(TClockSize aSize)
1.46 +int GP1212A02A::ClockCharWidthInPixels(TFontSizeLogical aSize)
1.47 {
1.48 switch (aSize)
1.49 {
1.50 - case EClockTiny:
1.51 + case EFontTiny:
1.52 return 6;
1.53 - case EClockSmall:
1.54 + case EFontSmall:
1.55 return 8;
1.56 - case EClockMedium:
1.57 + case EFontMedium:
1.58 return 12;
1.59 - case EClockLarge:
1.60 + case EFontLarge:
1.61 return 16;
1.62 }
1.63
1.64 @@ -808,17 +817,17 @@
1.65 /**
1.66 @return Clock character height in pixels.
1.67 */
1.68 -int GP1212A02A::ClockCharHeightInPixels(TClockSize aSize)
1.69 +int GP1212A02A::ClockCharHeightInPixels(TFontSizeLogical aSize)
1.70 {
1.71 switch (aSize)
1.72 {
1.73 - case EClockTiny:
1.74 + case EFontTiny:
1.75 return 8;
1.76 - case EClockSmall:
1.77 + case EFontSmall:
1.78 return 16;
1.79 - case EClockMedium:
1.80 + case EFontMedium:
1.81 return 24;
1.82 - case EClockLarge:
1.83 + case EFontLarge:
1.84 return 32;
1.85 }
1.86
1.87 @@ -828,7 +837,7 @@
1.88 /**
1.89 Return the Display Window address for centering the clock corresponding to the given parameters.
1.90 */
1.91 -unsigned short GP1212A02A::ClockCenterAddress(TClockFormat aFormat, TClockSize aSize)
1.92 +unsigned short GP1212A02A::ClockCenterAddress(TClockFormat aFormat, TFontSizeLogical aSize)
1.93 {
1.94 int charCount=ClockCharCount(aFormat);
1.95 int halfWidth=(ClockCharWidthInPixels(aSize)*charCount)/2;
1.96 @@ -848,7 +857,7 @@
1.97 */
1.98 void GP1212A02A::ShowClock()
1.99 {
1.100 - SendCommandClockDisplay(EClockDay24,ClockCenterAddress(EClockDay24,EClockLarge),EClockLarge);
1.101 + SendCommandClockDisplay(EClock24,ClockCenterAddress(EClock24,EFontLarge),EFontLarge);
1.102 }
1.103
1.104 /**
1.105 @@ -932,7 +941,7 @@
1.106 that cannot be displayed.
1.107 * Excluding the clock display area can be input other display commands.
1.108 */
1.109 -void GP1212A02A::SendCommandClockDisplay(TClockFormat aClockFormat, unsigned short aAddress, TClockSize aSize)
1.110 +void GP1212A02A::SendCommandClockDisplay(TClockFormat aClockFormat, unsigned short aAddress, TFontSizeLogical aSize)
1.111 {
1.112 FutabaVfdReport report;
1.113 report[0]=0x00; //Report ID
1.114 @@ -1081,7 +1090,6 @@
1.115 Ps = 31H : Transfer
1.116 Ps = 32H : Delete
1.117 */
1.118 -
1.119 void GP1212A02A::SendCommandFontAction(TFontAction aFontAction)
1.120 {
1.121 FutabaVfdReport report;
1.122 @@ -1094,3 +1102,27 @@
1.123
1.124 Write(report);
1.125 }
1.126 +
1.127 +
1.128 +/**
1.129 +[Code]1BH,4AH,46H,Pf
1.130 +[Function]Setting the font size
1.131 + Pf = Font size
1.132 +[Definable area]
1.133 +Pf = 30H?6x8 dot
1.134 +Pf = 31H?8x16dot and 16x16 dot
1.135 +Pf = 32H?12x24 dot and 24x24 dot
1.136 +Pf = 33H?16x32 dot and 32x32 dot
1.137 +*/
1.138 +void GP1212A02A::SendCommandSelectFontSize(TFontSizeLogical aFontSoze)
1.139 + {
1.140 + FutabaVfdReport report;
1.141 + report[0]=0x00; //Report ID
1.142 + report[1]=0x04; //Report size
1.143 + report[2]=0x1B; //Command ID
1.144 + report[3]=0x4A; //Command ID
1.145 + report[4]=0x46; //Command ID
1.146 + report[5]=aFontSoze; //Pf
1.147 +
1.148 + Write(report);
1.149 + }
1.150 \ No newline at end of file
2.1 --- a/FutabaGP1212A02.h Sat Sep 06 15:54:51 2014 +0200
2.2 +++ b/FutabaGP1212A02.h Sat Sep 06 18:39:49 2014 +0200
2.3 @@ -106,12 +106,12 @@
2.4 EClockDay12 = 0x11
2.5 };
2.6
2.7 - enum TClockSize
2.8 + enum TFontSizeLogical
2.9 {
2.10 - EClockTiny = 0x30,
2.11 - EClockSmall = 0x31,
2.12 - EClockMedium = 0x32,
2.13 - EClockLarge = 0x33
2.14 + EFontTiny = 0x30,
2.15 + EFontSmall = 0x31,
2.16 + EFontMedium = 0x32,
2.17 + EFontLarge = 0x33
2.18 };
2.19
2.20 enum TFontSize
2.21 @@ -144,11 +144,12 @@
2.22 void SendCommandPower(TPowerStatus aPowerStatus);
2.23 //Clock commands
2.24 void SendCommandClockSetting(TWeekDay aWeekDay, unsigned char aHour, unsigned char aMinute);
2.25 - void SendCommandClockDisplay(TClockFormat aClockFormat, unsigned short aAddress, TClockSize aSize);
2.26 + void SendCommandClockDisplay(TClockFormat aClockFormat, unsigned short aAddress, TFontSizeLogical aSize);
2.27 void SendCommandClockCancel();
2.28 //Font commands
2.29 void SendCommandDefineCharacter(TFontSize aFontSize, unsigned short aCharacterCode, unsigned char* aPixelData);
2.30 void SendCommandFontAction(TFontAction aFontAction);
2.31 + void SendCommandSelectFontSize(TFontSizeLogical aFontSoze);
2.32
2.33
2.34 //BMP box
2.35 @@ -159,9 +160,9 @@
2.36
2.37 //Clock utilities
2.38 int ClockCharCount(TClockFormat aFormat);
2.39 - int ClockCharWidthInPixels(TClockSize aSize);
2.40 - int ClockCharHeightInPixels(TClockSize aSize);
2.41 - unsigned short ClockCenterAddress(TClockFormat aFormat, TClockSize aSize);
2.42 + int ClockCharWidthInPixels(TFontSizeLogical aSize);
2.43 + int ClockCharHeightInPixels(TFontSizeLogical aSize);
2.44 + unsigned short ClockCenterAddress(TClockFormat aFormat, TFontSizeLogical aSize);
2.45 //Font utilities
2.46 int CharacterSizeInBytes(TFontSize aFontSize);
2.47