ä»æ¥ãã€ãã«ãœãããŠã§ã¢éšåã®èª¬æãçµããŸãããTFTãã£ã¹ãã¬ã€ãžã®ç»åãšããªã«æåã®åºåã«é¢ãã質åããããŸããã ç§ãã¡ã¯ãã¹ãŠãçŸããè¡ããŸãã

çºè¡ãµã€ã¯ã«ã®å 容ïŒ
- [ããŒã1]䜿çšããããœãããŠã§ã¢ããã³ããŒããŠã§ã¢ãœãªã¥ãŒã·ã§ã³ã®æŠèŠã
- [ããŒã2] FT800ã°ã©ãã£ãã¯ã¹ã³ã³ãããŒã©ãŒå ¥éã åšèŸºæ©åšã«æ¢è£œã®mbedã©ã€ãã©ãªã䜿çšããŸãã
- [ããŒã3] HYT-271ã»ã³ãµãŒã®æ¥ç¶ã åšèŸºæ©åšçšã®ç¬èªã®ã©ã€ãã©ãªãmbedã§äœæããŠå ¬éããŸãã
- [ããŒã4]ã¢ããªã±ãŒã·ã§ã³éçºïŒããã°ã©ã æ§é ãã¿ããã¹ã¯ãªãŒã³ã§ã®äœæ¥ã
- [ããŒã5]ã¢ããªã±ãŒã·ã§ã³éçºïŒç»åã®è¡šç€ºããã·ã¢åã®åé¡ã
- [ããŒã6]ããŠãžã³ã°éšåã®å°å·
çžå¯Ÿæ¹¿åºŠãšïŒåæã«ïŒæž©åºŠã®é«é枬å®ã«åœ¹ç«ã€ã¿ããã¹ã¯ãªãŒã³ãåãããããã¿ã€ãããã€ã¹ã®éçºã«ã€ããŠè©±ããŠããããšãæãåºãããŠãã ããã ãã€ã¯ãã³ã³ãããŒã©çšã®ããã°ã©ã ãäœæããã«ã¯ããªã³ã©ã€ã³IDE mbedã䜿çšããŸããããã«ãããSiLabsãAtmelãWiznetãSTM32ãNXPãªã©ã®ã¡ãŒã«ãŒã®ãããã°ããŒãã§åãããã«æ©èœããäžæ®çºæ§ã³ãŒããäœæã§ããŸãã
1.ç»åãTFTã«åºåãã
FTDIã°ã©ãã£ãã¯ã¹ã³ã³ãããŒã©ã䜿çšããŠTFTãã£ã¹ãã¬ã€ãå¶åŸ¡ããäžè¬çãªã¹ããŒã ã¯ã 以åã® èšäºã§ãã§ã«èª¬æãããŠããŸãã ä»ã®æç»é¢é£ã®æé ãšåæ§ã«ãTFTãã£ã¹ãã¬ã€ã§ã®ç»åã®è¡šç€ºã¯ãFT801ã°ã©ãã£ãã¯ã¹ã³ã³ãããŒã©ãŒã«å®è£ ãããããŒããŠã§ã¢ã§ãã 管çãã¹ãã³ã³ãããŒã©ãŒã¯ãåçŽãªå¶åŸ¡ã³ãã³ããšå¿ èŠãªããŒã¿ãFT801ã«éä¿¡ããã ãã§ãã
FT8xxã·ãªãŒãºã°ã©ãã£ãã¯ã³ã³ãããŒã©ãŒã䜿çšãããšã.jpegãŸãã¯.pngç»åãæäœã§ããŸãã ç»åã¯ç»é¢äžã«è¡šç€ºã§ããã ãã§ãªããå€æããããšãã§ããŸã-ãµã€ãºå€æŽãå転ãç»é¢äžã§ã®ç§»åãã¹ã¯ãªãŒã³ã»ãŒããŒãšããŠã䜿çšã§ããŸãã ããããã¹ãŠã®æäœã¯ããããŒãžã£ãŒMKããé©åãªã³ãã³ããåä¿¡ãããšãã°ã©ãã£ãã¯ã³ã³ãããŒã©ãŒã§å®è¡ãããŸãã
ç»åãã°ã©ãã£ãã¯ã¹ã³ã³ãããŒã©ãŒã«ããŠã³ããŒãããããšã«ã€ããŠã¯ãç»åãæäœãã2ã€ã®ã¢ãããŒããããã«åé¢ããå¿ èŠããããŸãã

æåã®ã±ãŒã¹ã§ã¯ã.jpegãã¡ã€ã«ã¯ã³ã³ãããŒã«MKã®ã¡ã¢ãªãŸãã¯å€éšã¡ãã£ã¢ããååŸãããFT8xxã°ã©ãã£ãã¯ã¹ã³ã³ãããŒã©ã®ã¡ã¢ãªã«ããã«æžã蟌ãŸããŸãã ãã®å ŽåãCMD_LOADIMAGEã³ãã³ããããŒãã«äœ¿çšãããŸãã ç»åãFT8xxã®ã¡ã¢ãªã«ããŒããããšãç»åãæäœããããã®ãã¹ãŠã®æ©èœãå©çšå¯èœã«ãªããŸã-ç»åãå€æãããã£ã¹ãã¬ã€ã«è¡šç€ºããŸãã ãã®æ¹æ³ã¯ãç»åãä¿åããå Žæãããå Žåãã€ãŸãUSBãã©ãã·ã¥ã¡ã¢ãªãŸãã¯SDã«ãŒãã䜿çšããå Žåã«æé©ã§ãã
2çªç®ã®å Žåãã€ã¡ãŒãžã¯Deflateã¢ã«ãŽãªãºã ã䜿çšããŠäºåã«å§çž®ãããŸãã ãšã³ã³ãŒãã®çµæãšããŠååŸãããããããããã¯ã䜿çšããã¹ããŒã¹ãã¯ããã«å°ãªããããå€éšã¡ãã£ã¢ã ãã§ãªããã³ã³ãããŒã«MKã®å éšã¡ã¢ãªã«ãä¿åã§ããŸãã ç»åã¯å§çž®åœ¢åŒã§FT8xxã°ã©ãã£ãã¯ã³ã³ãããŒã©ãŒã«ããŠã³ããŒããããããŒã¿ã¯ã°ã©ãã£ãã¯ã³ã³ãããŒã©ãŒã«ãã£ãŠè§£åãããŸãã å§çž®ãããã€ã¡ãŒãžãããŒãããã«ã¯ãCMD_INFLATEã³ãã³ãã䜿çšããŸãã ã€ã¡ãŒãžã解åããåŸãæåã®å Žåãšåãæ¹æ³ã§äœæ¥ã§ããŸãã
ç§ã®ãããžã§ã¯ãã§ã¯å€éšã¡ã¢ãªã®äœ¿çšã¯æ³å®ãããŠããªããããæåã®ã±ãŒã¹ã®ã¿ãæ€èšããŸã-å¶åŸ¡ãã€ã¯ãã³ã³ãããŒã©ã®ã¡ã¢ãªã«ä¿åãããå§çž®ç»åã䜿çšããŸãã ãã®çµæã3ã€ã®ç»åã衚瀺ããããšæããŸãã枩床ãšçžå¯Ÿæ¹¿åºŠã®ã¢ã€ã³ã³ãã¡ã€ã³ã¡ãã¥ãŒãšå ±ã«ç»é¢ã«è¡šç€ºããHYT-271ã»ã³ãµãŒã®åçãã»ã³ãµãŒã®èª¬æãšãšãã«ç»é¢ã«è¡šç€ºãããã§ãã


1.1ã ç»åã®ãã©ãŒããããå§çž®
Deflateã¢ã«ãŽãªãºã ã¯å ã zipã¢ãŒã«ã€ãçšã«äœæãããŸããããç¹èš±ãäžè¶³ããŠãããããç»åå§çž®ãªã©ã®ä»ã®ç®çã«äœ¿çšãããŠããŸãã ã¡ãªã¿ã«ãããã«ã¯Deflateãšpngã«é¢ããåªããèšäºããããŸãã
FTDIã¯ãã€ã¡ãŒãžå€æçšã®ããã€ãã®ã³ã³ãœãŒã«ãŠãŒãã£ãªãã£ïŒ img_cvtãªã©ïŒãæäŸããŸãã EVE Screen Editorã®ãããªã°ã©ãã£ã«ã«ã·ã§ã«ãå©çšã§ããŸããããã«ãããç»åãå€æã§ããã ãã§ãªããäžè¬çã«ã°ã©ãã£ãã¯ã³ã³ãããŒã©ãŒçšã®ããã°ã©ã ãäœæããéã®ç掻ãå€§å¹ ã«ç°¡çŽ åãããŸãã åºæ¬çã«ãEVE Screen Editorã¯Riverdi TFTã¢ãžã¥ãŒã«ã®ãšãã¥ã¬ãŒã¿ãŒã§ãã

ããã°ã©ã ã€ã³ã¿ãŒãã§ã€ã¹ã«ç°åžžãªãã®ã¯ãŸã£ãããããŸãã-å°æ¥ã®TFTç»é¢ã¯äžå€®ã®ãŠã£ã³ããŠã«åœ¢æãããŸã-ç®çã®ç»åããã®ä»ã®ã°ã©ãã£ãã¯èŠçŽ ããã©ãã°ã¢ã³ãããããã§ãããã£ãŒã«ãã§ãã
ç§ã䜿çšããŠããFT801ã³ã³ãããŒã©ãŒã䜿çšãããšãTFTãã£ã¹ãã¬ã€ã«9ã€ã®åœ¢åŒã衚瀺ã§ããŸããçœé»L1ãL4ãL8ãRGB332ãARGB2ãARGB4ãRGB565ãPALETTEDãARGB1555ã«ã€ããŠã¯ãã¡ãŒã«ãŒã®ããã¥ã¡ã³ããã芧ãã ããã ããŸããŸãªåœ¢åŒã䜿çšãããšãç»åããšã³ã³ãŒããããã€ããªãã¡ã€ã«ã®ç»åå質ãšãµã€ãºã®ç°ãªãæ¯çãååŸã§ããŸãã

ïŒå·Šããå³ã«L1ãL4ãL8ãRGB332ãARGB2ãARGB4ãRGB565ããã¬ãããARGB1555ïŒ
çè«çã«ã¯ãARGB1555圢åŒã䜿çšããŠæé«ã®å質ãåŸãããšãã§ããŸãããå®éã«ã¯ããŸããŸãªãªãã·ã§ã³ãè©ŠããŠæé©ãªãã®ãéžæããããšããå§ãããŸãã ã»ã³ãµãŒã®åçã¯ãARGB1555ãŸãã¯RGB565ã«å€æããåŸã«æ¬åœã«è¯ãèŠããŸãããããæç¹ã§å éšã¡ã¢ãªMKãååã§ã¯ãªããRGB332ãåªå ããŠãããã®åœ¢åŒãæŸæ£ããå¿ èŠããããŸããã ããã¯å€å°ãŸãšãã«èŠããARGB1555ãšRGB565ã®ãããã7067ãš7816ã®ä»£ããã«1865ãã€ãã䜿çšããŸãã
ã¢ã€ã³ã³ã¯ããèå³æ·±ãããšãå€æããŸããã ãœãŒã¹ãã¡ã€ã«ã¯ãéæãªèæ¯ã37x77ããã³53x67ãã¯ã»ã«ã®.pngã§ãã ã¢ã€ã³ã³ã®éæ床ã¯ãARGBã¿ã€ãã®ãšã³ã³ãŒãã§ã®ã¿ä¿åã§ããŸãã ARGB2ãARGB4ãããã³ARGB1555ã®åœ¢åŒããéžæããå¿ èŠããããŸãã ãããã®ãã¡ãæãé åçãªå¹³æ»åç»åã¯ARGB2ã§ã¯æäŸãããŸãããé©ããããšã«ãARGB1555ã§ã¯ãªãARGB4ã§æäŸãããŸãã

ïŒå³ã§ã¯å·Šããå³ã«ARGB2ãARGB4ãARGB1555ïŒ
é©åãªåœ¢åŒãéžæãããããããžã§ã¯ããã¹ã¯ãªãŒã³ãšãã£ã¿ã§ä¿åããå¿ èŠããããŸãã Screen Editorãã€ã³ã¹ããŒã«ããããã©ã«ããŒã«ãimagesãã£ã¬ã¯ããªãŒã衚瀺ãããŸããããã«ã¯ã䜿çšãããŠããåã€ã¡ãŒãžã«å¯ŸããŠ.binhãã¡ã€ã«ãäœæãããŸãã 圌ãå¿ èŠã§ãã
1.2ã ç»åãã°ã©ãã£ãã¯ã¹ã³ã³ãããŒã©ãŒã¡ã¢ãªã«èªã¿èŸŒã
ç»åã®ãã€ããªè¡šçŸãåãåã£ãããã¹ã¯ãªãŒã³ãšãã£ã¿ãŒããmbed IDEã«æ»ããŸããããã°ã©ã ã³ãŒãã§ã¯ãåãåã£ãããããããããã¹ãŠé åãšããŠä¿åããŸãã ããšãã°ã湿床ã¢ã€ã³ã³ã¯æ¬¡ã®ããã«ãªããŸãã
const unsigned char hum_icon[]={ 120,156,165,86,203,109,195,48,12,205,177,40,250,25,193,35,120,4,141,160,17,60,130,71,200,181,55,143,224,123,46,26,193,11,20,208,4,133,54,168,71,96,31,165,248,43,74,145,82,18,8,20,138,79,228,35,41,193,244,73,117,218,86,250,175,250,251,65,243,115,200,203,133,88,236,83,232,153,130,92,171,145,29,109,82,135,108,214,168,44,117,172,29,209,1,59,22,35,21,197,82,91,165,125,100,45,121,254,188,147,33,131,94,110,255,37,17,177,52,248,189,149,209,247,155,136,85,2,82,195,238,124,109,186,213,102,132,156,83,189,80,152,91,222,111,130,213,207,226,94,92,60,93,152,186,137,150,185,185,98,53,193,178,229,51,223,53,194,121,237,217,255,235,133,215,248,229,115,250,195,126,11,109,68,228,33,79,159,63,75,251,184,135,224,228,162,202,247,167,188,83,58,238,251,178,106,156,119,162,51,219,60,36,121,164,59,35,237,113,189,77,6,107,40,121,163,49,85,46,121,110,200,215,194,39,199,199,74,59,152,116,247,176,19,83,34,242,85,172,111,28,57,226,140,76,185,74,185,58,6,117,130,151,46,136,186,100,215,9,54,93,128,85,240,27,78,182,49,83,255,189,54,2,227,255,96,37,30,146,106,33,103,85,88,171,49,142,113,123,45,234,145,191,17,194,228,249,59,138,233,74,34,113,187,172,204,236,254,182,76,194,253,91,170,100,211,188,128,154,252,219,167,197,26,49,39,147,190,41,216,9,239,185,5,131,150,253,192,65,161,7,206,91,135,240,250,101,84,249,232,103,49,197,95,24,13,226,26,68,183,56,103,196,58,91,255,63,65,221,118,198, };
ãã®ç»åãFT801ã°ã©ãã£ãã¯ã³ã³ãããŒã©ãŒã®ã¡ã¢ãªã«èªã¿èŸŒãã«ã¯ãã³ã³ãããŒã«MKãã3ã€ã®ã³ãã³ããéä¿¡ããå¿ èŠããããŸãã
#define IMAGE_ADDR_HUMIDITY 29696 ... (*_TFT).WrCmd32(CMD_INFLATE); (*_TFT).WrCmd32(IMAGE_ADDR_HUMIDITY); (*_TFT).WrCmdBufFromFlash(hum_icon, sizeof(hum_icon));
CMD_INFLATE-Deflateã¢ã«ãŽãªãºã ã«åŸã£ãŠå§çž®ãããç»åãã¡ã¢ãªã«æžã蟌ãŸããããšãFT801ã«äŒããã³ãã³ãã
IMAGE_ADDR_HUMIDITY-RAM_Gã°ã©ãã£ãã¯ã¹ã³ã³ãããŒã©ãŒã®ã¡ã¢ãªå ã®éå§ã¢ãã¬ã¹ãã€ã¡ãŒãžãå©çšå¯èœã«ãªããŸãã
hum_iconã¯ãç»åãæ ŒçŽããé åã§ãã
ãã®ãããªæäœã®åŸãã°ã©ãã£ãã¯ã³ã³ãããŒã©ãŒã®ã¡ã¢ãªãããã°ã©ã ã«ãã£ãŠããŸãã¯ãªã»ããã®çµæãšããŠã¯ãªã¢ããããŸã§ãã湿床ãã¢ã€ã³ã³ãç»é¢ã«è¡šç€ºãããŸãã
1.3ã ç»åãã£ããã£
ããŒãåŸã®æ¬¡ã®ã¹ãããã¯ãç»åãããã£ããã£ãããããšã§ãã
StartDL(); ... (*_TFT).DL(BITMAP_HANDLE(0)); (*_TFT).DL(BITMAP_SOURCE(IMAGE_ADDR_HUMIDITY)); (*_TFT).DL(BITMAP_LAYOUT(ARGB4, 60, 38)); (*_TFT).DL(BITMAP_SIZE(NEAREST, BORDER, BORDER, 30, 38)); ... FinishDL();
BITMAP_HANDLEã³ãã³ãã䜿çšããŠãåç»åïŒãããããããªããžã§ã¯ãïŒã«ãã€ã³ã¿ãŒïŒ0ã31ã®æ°åïŒãå²ãåœãŠãŸããããã«ãããåŸã§ç»åãåç §ã§ããŸãã
BITMAP_SOURCEã³ãã³ãã¯ãFT8xxã°ã©ãã£ãã¯ã¹ã³ã³ãããŒã©ãŒã®ã¡ã¢ãªã¢ãã¬ã¹RAM_GãæããŸãïŒpãã€ã¡ãŒãžã®ããŠã³ããŒããåç §ïŒã
BITMAP_LAYOUTã³ãã³ãã¯ã°ã©ãã£ãã¯ã¹ã³ã³ãããŒã©ãŒã«ç»åã®åœ¢åŒãšãµã€ãºãäŒããBITMAP_SIZEã³ãã³ãã¯åºåç»åã®ãµã€ãºã決å®ããŸãã åŒæ°ãå€æŽããããšã«ãããããšãã°ãç»åãå³ãŸãã¯å·Šã«ããªãã³ã°ã§ããŸãã
ç»åããã£ããã£ããã ãã§ãªããã°ã©ãã£ãã¯ã³ã³ãããŒã©ãŒã®ã¡ã¢ãªã«èªã¿èŸŒãã ãã§ãFT8xxã®åæååŸã«äžåºŠå®è¡ããã ãã§ååã§ãã ãã ããã€ã¡ãŒãžãã£ããã£ã³ãã³ãã¯ãããŒãã³ãã³ããšã¯å¯Ÿç §çã«ããããããã£ã¹ãã¬ã€ãªã¹ãã³ãã³ãã§ãããã€ãŸãããã£ã¹ãã¬ã€ãªã¹ãã®éå§åŸããã£ã¹ãã¬ã€ãªã¹ãã³ãã³ãã®çµäºåã«ã®ã¿äœ¿çšã§ããããšãç解ããããšãéèŠã§ãã
* ãã®ã·ãªãŒãºã®2çªç®ã®èšäºã§ ããã£ã¹ãã¬ã€ãªã¹ããšã¯äœãããŸãäœãé£ã¹ããããã«ã€ããŠèªãããšãã§ããŸãã
1.4ã ç»ååºå
ç»åãèªã¿èŸŒãã§ãã£ããã£ããåŸãTFTãã£ã¹ãã¬ã€ã«è¡šç€ºã§ããŸãã ãããè¡ãã«ã¯ãBITMAPã°ã«ãŒãã®ã³ãã³ãã䜿çšããŸããããšãã°ãã¡ã€ã³ã¡ãã¥ãŒã®ãã¿ã³ã®1ã€ã«ã湿床ãã¢ã€ã³ã³ã衚瀺ããã«ã¯ã3ã€ã®ã³ãã³ããå®è¡ããŸãã
StartDL(); ... // () ... (*_TFT).DL(BEGIN(BITMAPS)); (*_TFT).DL(VERTEX2II(12 + 255, 62 + 10, 0, 0)); (*_TFT).DL(END()); ... FinishDL();
VERTEX2IIã³ãã³ãã®æåã®2ã€ã®åŒæ°ã¯è¡šç€ºãã座æšã瀺ãã3çªç®ã®åŒæ°ã¯BITMAP_SOURCEããã³BITMAP_HANDLE-"0"ã«èšå®ãããã湿床ãã¢ã€ã³ã³ãžã®ãã€ã³ã¿ãŒã§ãã
枩床ã¢ã€ã³ã³ãšã»ã³ãµãŒåçã®çµè«ã¯ãŸã£ããåãããã«å®è¡ãããŸã
StartDL(); ... (*_TFT).DL(BEGIN(BITMAPS)); (*_TFT).DL(VERTEX2II(12 + 260, 62 + 93 + 12 + 10, 1, 0)); (*_TFT).DL(END()); ... FinishDL();
StartDL(); ... (*_TFT).DL(BEGIN(BITMAPS)); (*_TFT).DL(VERTEX2II(360, 140, 2, 0)); (*_TFT).DL(END()); ... FinishDL();
ãããžã§ã¯ãã®å®å šãªãœãŒã¹ã³ãŒããžã®ãªã³ã¯ã以äžã«ç€ºããŸãã
ã«ã¹ã¿ã ãã©ã³ãã®äœ¿çš
FT8xxã·ãªãŒãºã°ã©ãã£ãã¯ã¹ã³ã³ãããŒã©ãŒã®äœ¿çšéå§ã«é¢ããèšäºã§ã¯ãæšæºã®ãŠã£ãžã§ããã®ãµããŒããã€ãŸãFTDIã°ã©ãã£ãã¯ã¹ã³ã³ãããŒã©ãŒã«åºã¥ãããŒããŠã§ã¢ããŒã¹ã®æ¯èŒçè€éãªã°ã©ãã£ãã¯ãªããžã§ã¯ãã®è¡šç€ºæé ãåç §ãããŸããã ãŠã£ãžã§ããã®äžã«ã¯ãFTB800_2 mbedã©ã€ãã©ãªã®ããã¹ãæååããããæååã®è¡šç€ºã¯TextïŒïŒé¢æ°ã«å¯Ÿå¿ããŠããŸãã
(*_TFT).Text(22, 67, 27, 0, "Current humidity (rH)");
é¢æ°ã®åŒæ°ã¯ãè¡ã®æåã®æåã®åº§æšïŒ22ã67ïŒã䜿çšãããã©ã³ãã®æ°ïŒ27ïŒãè¿œå ãªãã·ã§ã³ïŒ0ïŒããããŠå®éã«ã¯ããã¹ãè¡ã§ãã 座æšã«ã€ããŠã¯ãã¹ãŠæããã§ããè¿œå ã®ãªãã·ã§ã³ã¯ç»é¢äžã®è¡ã®äœçœ®ã«ã®ã¿é©çšãããããããã©ã³ãã«ã€ããŠèª¬æããŸãã
䜿çšããããã©ã³ãã®çªå·ã¯0ã31ã®çªå·ã§ã0ã15ã®çªå·ã¯ã«ã¹ã¿ã ãã©ã³ãçšã«äºçŽãããŠããŸãã16ã31ã®çªå·ã¯16åã®çµã¿èŸŒã¿ãã©ã³ãã«å¯Ÿå¿ããŸãã ã¢ããªã±ãŒã·ã§ã³ã§æåã®128æåã®ASCIIæåã®ã¿ã衚瀺ããã®ã«ååã§ããããããã®æåã®æšæºã¹ã¿ã€ã«ã§ååãªå Žåã¯ããã®å Žæã§åæ¢ããèšäºããã以äžèªãããšã¯ã§ããŸãã-16ã31ã®æ°åã®ãã©ã³ãã䜿çšããŠãã ããã

éæšæºã¹ã¿ã€ã«ã®æ°åãšã©ãã³æåãå¿ èŠãªå ŽåããŸãã¯æšæºASCIIã»ããïŒããªã«æåãªã©ïŒãè¶ ããæåãåºåããå Žåã¯ãç¬èªã®ãã©ã³ãã®èªã¿èŸŒã¿ãåŠçããå¿ èŠããããŸãã
FT8xxã°ã©ãã£ãã¯ã³ã³ãããŒã©ãŒã®å Žåãã«ã¹ã¿ã ãã©ã³ãã¯ç»åãšã»ãŒåãããããããã§ãããããæ°ãããã©ã³ããäœæãããšãããŸããŸãªæ¹æ³ã§ç»åã衚瀺ããããã»ã¹ãç¹°ãè¿ãããŸãã
2.1ã ãã©ã³ãã®æžåŒèšå®ãå§çž®
æåã®æ®µéã§ã¯ãç®çã®ãã©ã³ãïŒ.ttf圢åŒãéåžžã«é©ããŠããŸãïŒãããŠã³ããŒããŸãã¯äœæããFT8xxxã°ã©ãã£ãã¯ã³ã³ãããŒã©ãŒã«ã¢ããããŒãããããã®ãã€ããªãã¡ã€ã«ãååŸããå¿ èŠããããŸãã ãããè¡ãã«ã¯ã ã³ã³ãœãŒã«ãŠãŒãã£ãªãã£ãŸãã¯åãEVE Screen Editorã䜿çšã§ããŸãã
ã¹ã¯ãªãŒã³ãšãã£ã¿ãŒã§ã¯ããã©ã³ãã¯ç»åãã¡ã€ã«ãšåãæ¹æ³ã§ã€ã³ããŒããããŸãããã©ã³ããã¡ã€ã«ã¯ã³ã³ãã³ããŠã£ã³ããŠã«è¿œå ããããã®å§çž®ãã©ã¡ãŒã¿ãŒã¯ããããã£ãŠã£ã³ããŠã§èšå®ãããŸãïŒåœ¢åŒããµã€ãºãæåã»ããã
圢åŒã¯ãL1ãL4ãL8ã®3ã€ã®ãªãã·ã§ã³ããéžæãããŸãã ç»åå€æãšåæ§ã«ãéãã¯ã¬ã³ããªã³ã°å質ãšãã€ããªãã¡ã€ã«ã®ãµã€ãºã®æ¯çã«ãããŸãã ãã©ã³ããµã€ãºã¯ããã¯ã»ã«åäœã§æåã®å¹ ã決å®ããã ãã§ãããcharsetãã£ãŒã«ããæã泚ç®ã«å€ããŸãã
FTDIã°ã©ãã£ãã¯ã³ã³ãããŒã©ãŒã®å Žåãããã©ã«ãã®ãã©ã³ãã¯128 ASCIIæåã§ãã
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ // , 32-
ãããã®æåã®ã¿ã䜿çšããã¹ã¿ã€ã«ãå€æŽããããã ãã«æ°ãããã©ã³ããè¿œå ããå Žåã¯ãæåã»ãããå€æŽããã«ãã©ã³ããå€æããŠãã ããã ãŸããããªã«æåãŸãã¯ãã®ä»ã®éASCIIæåãè¿œå ããå¿ èŠãããå Žåã¯ãæåã»ããã眮ãæããå¿ èŠããããŸãã ç§ã®ã¢ããªã±ãŒã·ã§ã³ã§ã¯ããã¹ãŠã®ããªã«æåãæ°åãããã€ãã®å¥èªç¹ãšæ°åŠèšå·ã床ãšããŒã»ã³ãã®èšå·ãããã€ãã®ã©ãã³æåãå¿ èŠã«ãªããŸãã ãã®çµæãå€æŽãããæåã»ããã¯æ¬¡ã®ããã«ãªããŸãã
0123456789.,:-°±%<>rHYTICS // , 32-
ããã§ãç»åãæäœãããšããšåãããã«ãScreen Editorãããžã§ã¯ããä¿åããEVE Screen Editorãã€ã³ã¹ããŒã«ãããŠãããã©ã«ããŒã«ç§»åãã/ fontsãã£ã¬ã¯ããªãŒã§ãã€ããªã®.binhãã¡ã€ã«ãèŠã€ããŸãã
2.2ã ã°ã©ãã£ãã¯ã¹ã³ã³ãããŒã©ãŒã¡ã¢ãªãžã®èªã¿èŸŒã¿
æ°ãããã©ã³ããããŠã³ããŒããããšãã€ã¡ãŒãžã®ããŒãããã»ã¹ãç¹°ãè¿ãããŸãããã©ã³ãã®ãã€ããªè¡šçŸãé åãšããŠä¿åããCMD_INFLATEã³ãã³ãã䜿çšããŠãã°ã©ãã£ãã¯ã¹ã³ã³ãããŒã©ãŒã®ã¡ã¢ãªå ã®æå®ã®éå§ã¢ãã¬ã¹ã§FT8xxã«ããŒãããŸãã
#define FONT_ADDR_ROBOTO_REGULAR_30 16992 ... (*_TFT).WrCmd32(CMD_INFLATE); (*_TFT).WrCmd32(FONT_SET_ROBOTO_REGULAR_30); (*_TFT).WrCmdBufFromFlash(font_RobotoRegular30, sizeof(font_RobotoRegular30));
2.3ã ãã©ã³ãã®ãã£ããã£ãšã€ã³ã¹ããŒã«
ã«ã¹ã¿ã ãã©ã³ãã®ããã£ããã£ãã¯ãã€ã¡ãŒãžãã£ããã£ãšåãã³ãã³ãã§å®è¡ãããŸãããBITMAP_HANDLEãBITMAP_SOURCEãBITMAP_LAYOUTãããã³BITMAP_SIZEã³ãã³ãã®åŸã§ãSetFontïŒïŒãåŒã³åºããŠæ°ãããã©ã³ããèšå®ããå¿ èŠããããŸãã
(*_TFT).DL(BITMAP_HANDLE(3)); (*_TFT).DL(BITMAP_SOURCE(FONT_ADDR_ROBOTO_REGULAR_30)); (*_TFT).DL(BITMAP_LAYOUT(L4, 16, 33)); (*_TFT).DL(BITMAP_SIZE(NEAREST, BORDER, BORDER, 32, 33)); (*_TFT).SetFont(3, FONT_SET_ROBOTO_REGULAR_30);
2.4ã ãã©ã³ãã䜿çšãã
ããŠãã«ã¹ã¿ã ãã©ã³ãã®äžã§ã3çªç®ã¯ããŠã³ããŒãããRoboto Regularãã©ã³ãã§ãã å€æäžã«ãã®ãã©ã³ãã®æåã»ãããå€æŽãããŠããªãå Žåãçµã¿èŸŒã¿ãã©ã³ãçªå·27ãRoboto Regularã«å€æŽããã«ã¯ãå€æŽããã ãã§æžã¿ãŸãã
(*_TFT).Text(22, 67, 27, 0, "Current humidity (rH)");
ã«
(*_TFT).Text(22, 67, 3, 0, "Current humidity (rH)"); //
ãã ããFT8xxã³ã³ãããŒã©ãŒã§ã¯éæšæºã®æåãåºåãããããæ瀺çã«è¡ïŒãçŸåšã®æ¹¿åºŠïŒrHïŒãïŒãæå®ãã代ããã«ãåå¥ã®æåãããã®è¡ãã¹ã«ã«ããããå¿ èŠããããŸãã
ãçžå¯Ÿæ¹¿åºŠãã®è¡ãæ€èšããŠãã ããã ã¿ã¹ã¯ã¯ããã®è¡ã®åæåãæåã»ããã®çªå·ãšäžèŽãããããšã§ãã
ã³ã³ãã€ã©ãããªã«æåã¢ã«ãã¡ãããããµããŒãããŠããå Žåã倧æåã®ABBã§å§ãŸããå°æåã®uyuã§çµããåæåïŒlettersããã³ofã®çç¥ïŒã¯ã0xC0ã0xFFã®å€ã«å¯Ÿå¿ããŸãã ãã®ãããæååã®æåãšæåã»ããå ã®ãããã®æåã®çªå·ãäžèŽãããã«ã¯ãåæåã®ã³ãŒãããåºå®å€ãæžç®ããå¿ èŠããããŸãã ããšãã°ãcharlistã®æåAã32çªç®ã®äœçœ®ïŒ0x20ïŒãåãã Aã«ç¶ãæåãããŒãã«CP1251ãšåãé åºã«ãªãå Žåããçžå¯Ÿæ¹¿åºŠãè¡ã®åæåã®ã³ãŒãããå€ãæžç®ããå¿ èŠããããŸãïŒã¹ããŒã¹ãé€ãïŒ 0xA0ã
ããªã«æåãšã³ã³ãŒãã£ã³ã°CP1251

ãã ããã³ã³ãã€ã©ã¯ããªã«æåããµããŒãããŠããªãå¯èœæ§ããããmbed-ovskyã¯ãµããŒãããŠããŸããã ããã¯ãã³ã³ãã€ã©ãããªã«æåã0xC0ã0xFFã®ã³ãŒããšããŠèªèããªããããUnicodeãããæ£ç¢ºã«ã¯UTF-8ã䜿çšãã以å€ã«éžæè¢ããªãããšãæå³ããŸãã
ã¡ã€ã³ASCIIããŒãã«ã«å«ãŸããªãåæåïŒããªã«æåã°ããã³Â±ïŒã¯ã2ãã€ãã®UTF-8ã³ãŒããšããŠè¡šãããŸãã åæåã®ã³ãŒããååŸãããããæåã»ããã®æ°åãšäžèŽãããŸãã
ãŸããcharlistã«ããã©ãã³æåã®å ŽåãUnicodeãcharsetã®æ°åã«çœ®ãæããå¿ èŠããããŸããå¯äžã®éãã¯ãã©ãã³æåãšããããã³ã³ããããŒã»ã³ããªã©ã®ä»ã®ASCIIæåã®ã³ãŒãã2ãã€ãã§ã¯ãªã1ãã€ãã§æ§æãããããšã§ãã
æååã®å€æ | UTF-8ã³ãŒã | æåã»ããã®ã·ãŒã±ã³ã¹çªå· |
ABV ... nop | 0xD090 ... 0xD0BF | 43 ... 90 |
æåã®...ãããš | 0xD180 ... 0xD18F | 91 ... 96 |
° | 0xC2B0 | 112 |
± | 0xC2B1 | 113 |
ã¹ããŒã¹ã㌠| 0x20 | 32 |
0 ... 9 | 0x30 ... 0x39 | 33 ... 43 |
ã | 0x2E | 108 |
ã | 0x2C | 109 |
ïŒ | 0x3A | 110 |
ãªã©ãªã© |
ãã®ãããªæååå€æãå®è¡ããããã«ã察å¿ããé¢æ°ãäœæãããŠããŸãã
CreateStringRussianæååå€æé¢æ°
void Display::CreateStringRussian(const string rustext) { // CHANGED ASCII: // 0123456789.,:-°±%<>rHYTICS int len = rustext.length(); int j = 0; for (int i = 0; i < len; i ++) { uint16_t res = uint8_t(rustext[i]); if (res > 0x7F) { res = res << 8 | uint8_t(rustext[i + 1]); // ... if ((res >= 0xD090) && (res <= 0xD0BF)) { char offset = (char)(res - 0xD090); russianStr[j] = 32 + 11 + offset; // ... } else if ((res >= 0xD180) && (res <= 0xD18F)) { char offset = (char)(res - 0xD180); russianStr[j] = 32 + 59 + offset; } // Degree sign else if (res == 0xC2B0) { russianStr[j] = 32 + 79; } // Plus-minus sign else if (res == 0xC2B1) { russianStr[j] = 32 + 80; } i++; } else { // Space if (res == 0x20) { russianStr[j] = 32; } // Numbers else if (res >= 0x30 && res <= 0x39) { russianStr[j] = 32 + 1 + (res - 0x30); } // . else if (res == 0x2E) { russianStr[j] = 32 + 75; } // , else if (res == 0x2C) { russianStr[j] = 32 + 76; } // : else if (res == 0x3A) { russianStr[j] = 32 + 77; } // - else if (res == 0x2D) { russianStr[j] = 32 + 78; } // % else if (res == 0x25) { russianStr[j] = 32 + 81; } // < else if (res == 0x3C) { russianStr[j] = 32 + 82; } // > else if (res == 0x3C) { russianStr[j] = 32 + 83; } // "r" else if (res == 0x72) { russianStr[j] = 32 + 84; } // "H" else if (res == 0x48) { russianStr[j] = 32 + 85; } // "Y" else if (res == 0x59) { russianStr[j] = 32 + 86; } // "T" else if (res == 0x54) { russianStr[j] = 32 + 87; } // "I" else if (res == 0x49) { russianStr[j] = 32 + 88; } // "C" else if (res == 0x43) { russianStr[j] = 32 + 89; } // "S" else if (res == 0x53) { russianStr[j] = 32 + 90; } } j++; } russianStr[j] = 0; }
ãããã£ãŠãTFTãã£ã¹ãã¬ã€ã«ãçžå¯Ÿæ¹¿åºŠãè¡ïŒãŸãã¯ãã·ã¢èªã®ä»ã®è¡ïŒã衚瀺ããã«ã¯ãæåã«ãããå€æããŠãããè¡ã®æšæºåºåã䜿çšããå¿ èŠããããŸãã3çªç®ã®åŒæ°ãšããŠãã©ã³ãçªå·ãæå®ããããšãå¿ããªãã§ãã ãã
CreateStringRussian(" "); (*_TFT).Text(15, 15, 3, 0, russianStr);
3.æçµçµæ
å®æãããããžã§ã¯ãã®ãœãŒã¹ã³ãŒãã¯developer.mbed.orgã§å ¥æã§ããŸãã 次ã®ãããžã§ã¯ããã¡ã€ã«ã¯ãä»æ¥ã®èšäºã®ãããã¯ã«é¢é£ããŠããŸãã
- /pictures.h-å€æãããç»åãšãã©ã³ã
- /TFT/display.ImagesAndFonts.cpp-ç»åãšãã©ã³ãã®ããŠã³ããŒããšãã£ããã£ããã©ã³ãã®ã€ã³ã¹ããŒã«
- /TFT/display.StringsTransform.cpp-æååå€æ
- /TFT/display.Draw_MainMenu.cpp-枩床ãšæ¹¿åºŠã®ã¢ã€ã³ã³ã衚瀺ãããã¡ã€ã³ã¡ãã¥ãŒç»é¢ã®åœ¢æ
- /TFT/display.Draw_AboutSensor.cpp-圌ã®åçã衚瀺ãããã»ã³ãµãŒã®èª¬æãå«ãç»é¢ã®åœ¢æ
ãããã£ãŠãç§ã¯æçµçã«ãªã³ã©ã€ã³IDE ARM mbedã§ãããžã§ã¯ããäœæãã説æãçµäºããŸãã mbedã®Hello Wordã®äœæãããåšèŸºæ©åšã®2ã€ã®ã©ã€ãã©ãªïŒåãååã®ã»ã³ãµãŒã®HYTãšRiverdiã®TFTã¢ãžã¥ãŒã«ã®FT800_2ïŒã䜿çšããããªã倧ããªããã°ã©ã ãŸã§ããã¹ãŠãã«ããŒããŸããã
éæ³ã¯ãçµæã®ããã°ã©ã ãmbedã§ãµããŒããããŠãããããã°ããŒãã®ããããã®åäœãããã¡ãŒã ãŠã§ã¢ã«ã³ã³ãã€ã«ã§ããããšã§ãã
ãã®ã·ãªãŒãºã®æåŸã®èšäºã§ã¯ããã®ããã€ã¹ã®ã±ãŒã¹ãäœæããã¹ããŒãªãŒãå ±æããŸãã
ãããã«
çµè«ãšããŠãç§ã¯äŒçµ±çã«èªè ã®æ³šæã«æè¬ãããããã£ãŒã«ã®Habréã¡ãŒã«ã¢ãã¬ã¹ã«æžããŠãã補åã®äœ¿çšã«ã€ããŠå®å šã«è³ªåã§ããããšãæãåºãããŠãããŸãã