ãã®èšäºã§ã¯ãArduino DUEã§ã®ãã«ãã«ã©ãŒTFTãã£ã¹ãã¬ã€ã®æäœã«é¢ããçãã·ãªãŒãºã®èšäºãéããŸãã ãã®èšäºãšåŸç¶ã®èšäºã§ã¯ãTFTãã£ã¹ãã¬ã€ã®äž»ãªæ©èœãæ€èšããã©ã€ãã©ãªã®èª¬æãæäŸãããã®ãããªãã£ã¹ãã¬ã€ã§äœæ¥ããéã«çããå žåçãªã¿ã¹ã¯ã®äŸãæ€èšããŸãã
çŸåšãArduinoã³ã³ããŒãã³ãåžå Žã«ã¯ãããŸããŸãªTFTãã£ã¹ãã¬ã€ããããŸãã ãŠãŒã¶ãŒã®èŠ³ç¹ããã¯ãäž»ã«ãµã€ãºã解å床ãæ¥ç¶æ¹æ³ãããã³è¿œå æ©èœãç°ãªããŸãã ãããã®ãã£ã¹ãã¬ã€ã®ã»ãšãã©ã«ã¯ã¿ããã¹ã¯ãªãŒã³ãè£ åãããŠãããããã·ã¹ãã 管çããã䟿å©ã«ãªããåŸæ¥ã®ãã¿ã³ããžã§ã€ã¹ãã£ãã¯ããšã³ã³ãŒããŒããã®ä»ã®æ©æ¢°è£ 眮ãåãé€ãããšãã§ããŸãã
320x240以äžã®è§£å床ã®ã°ã©ãã£ãã¯ãã£ã¹ãã¬ã€ã䜿çšããããšã¯ãããªãã®éã®ã¡ã¢ãªãååšãããã€ã¯ãã³ã³ãããŒã©èªäœãååã«é«éã§ããããšãæå³ããŸãã ããã«ãå€ãã®å Žåãæ¥ç¶ã«ã¯å€æ°ã®ãã³ãå¿ èŠã«ãªããããArduino DUEã³ã³ãããŒã©ãŒãããŒã¹ãšããŠéžæãããŸããã
ãã®èšäºãå·çãããšãã次ã®æ©åšããå®éšã»ããã¢ããããšããŠäœ¿çšãããŸããã
- Arduino DUE Conââtroller-Getechã®ArduinoäºæIduinoã¯ããŒã³ã
- TFTãã£ã¹ãã¬ã€ïŒååã«æ€èšããçµæãColdtears Electronics 3.2ã€ã³ããã£ã¹ãã¬ã€ã®ãé«åºŠãªãããŒãžã§ã³ãéžæãããŸãããããã¯ã解å床ã®åäžïŒã»ãšãã©ã®åæ§ã®ãã£ã¹ãã¬ã€ã§ã¯320x340ã®ä»£ããã«480x320ïŒãšè¿œå æ©èœïŒãã®ãã£ã¹ãã¬ã€ã«ã¯ãã©ãã·ã¥ã¡ã¢ãªãè¿œå ãããŠããããã©ã³ããšã¢ã€ã³ã³ãè¿œå ã®ãã©ã³ãã®ããŠã³ããŒããæåŠã§ããããã貎éãªã³ã³ãããŒã©ãŒã¡ã¢ãªãç¯çŽã§ããŸãïŒã ãã£ã¹ãã¬ã€ã«ã¯ILI948ã³ã³ãããŒã©ãŒãè£ åãããŠããŸãã ããŒãã«ã¯SDã«ãŒãã¹ãããããããŸãã
- ãã£ã¹ãã¬ã€ãArduino DUEã³ã³ãããŒã©ãŒã«æ¥ç¶ããããã®ç¹å¥ãªããŒã ãã¬ãŒãã ãã®ããŒã ãã¬ãŒãã䜿çšãããšã16ããããã©ã¬ã«ã€ã³ã¿ãŒãã§ã€ã¹ãä»ããŠãã£ã¹ãã¬ã€ãæ¥ç¶ããArduino ISPã³ãã¯ã¿ãä»ããŠãã©ãã·ã¥ã¡ã¢ãªãæ¥ç¶ã§ããŸããããã«ãããéçºè ã«ãããšæ倧ã®ããã©ãŒãã³ã¹ãä¿èšŒãããŸãã ããŒã ãã¬ãŒãã«ã¯SDã«ãŒãã¹ããããè£ åãããŠããŸãïŒããã©ã«ãã§ã¯ç¡å¹ã«ãªã£ãŠããŸããæå¹ã«ããã«ã¯ãããŒãã®ãžã£ã³ããŒãéããå¿ èŠããããŸãããåŸã§è©³ãã説æããŸãïŒã
ããŒã ãã¬ãŒãã¯Arduino DUEå°çšã«èšèšãããŠããããšã«æ³šæããŠãã ããã Arduino MEGAã§ãã£ã¹ãã¬ã€ã䜿çšããã«ã¯ã5v â 3.3vã¬ãã«ã³ã³ããŒã¿ãŒãæèŒããå¥ã®ããŒãžã§ã³ã®ããŒã ãã¬ãŒããå¿ èŠã§ãã
ãã£ã¹ãã¬ã€ã®ãã³é åãšCTEããŒã ãã¬ãŒãã«é¢ãããã¹ãŠã®è³æã¯ã補é å ã®Webãµã€ãããããŠã³ããŒãã§ããŸãã
è¡šç€ºïŒ http : //coldtears.lin3.siteonlinetest.com/files/3.2b.zip
SchildïŒ http : //coldtears.lin3.siteonlinetest.com/files/CTE_DUE_shield.zip
UTFãã£ã¹ãã¬ã€ã®ã»ããã¯ãTFTãã£ã¹ãã¬ã€ãæäœããããã«äœ¿çšãããŸãã ãããã®ã©ã€ãã©ãªã®ææ°ããŒãžã§ã³ã¯ãéçºè ã®Webãµã€ãã§èŠã€ããããšãã§ããŸãïŒ http : //www.henningkarlsen.com/electronics/
ãã£ã¹ãã¬ã€ãæ¥ç¶ããåŸã次ã®ã³ã³ãããŒã©ãŒãã³ã¯ç©ºãããŸãŸã«ãªããŸãïŒD0ãD1ãD8ãD11-D13ãD14-D24ãD29-D31ãD41-D43ãA0-A11ãDAC0ãDAC1ãSCL1ãSDA1ã¯èªç±ã«äœ¿çšã§ããŸãã
1.ããŒã¹UTFTã©ã€ãã©ãªã äžè¬çãªæ å ±
UTFTã©ã€ãã©ãªã¯ãããŸããŸãªã¿ã€ãã®TFTãã£ã¹ãã¬ã€ã§åäœããããã«èšèšãããŠããã䞊åïŒ8ããããŸãã¯16ãããïŒã§æ¥ç¶ãããŠããã»ããã·ãªã¢ã«ã€ã³ã¿ãŒãã§ã€ã¹ãä»ããŠæ¥ç¶ãããŠããŸãã åœåãITead Studioããã³NKG Electronicsã«ãããã£ã¹ãã¬ã€ããµããŒãããããã«éçºãããŸãããããã®åŸãä»ã®ããã€ãã®ã¡ãŒã«ãŒããã®ãµããŒããå«ãŸããŸããã å ã®ã©ã€ãã©ãªã¯ãã¡ãããããŠã³ããŒãã§ããŸãïŒ http : //www.henningkarlsen.com/electronics/library.php?id=51
ã©ã€ãã©ãªã«ã¯ãè±èªã®éåžžã«åªããããã¥ã¡ã³ããä»å±ããŠããŸãã ãã®èšäºã¯ãäž»ã«éçºè ã®ããã¥ã¡ã³ãã«åºã¥ããŠãããããçšåºŠã®å®çšçãªçµéšãšäœæ¥äžã«åŸãããè¿œå æ å ±ãè¿œå ããŠããŸãã
ã©ã€ãã©ãªã§ãµããŒãããããã£ã¹ãã¬ã€ã®ãªã¹ããšãã®äž»ãªæ©èœã¯ãã©ã€ãã©ãªã«ä»å±ã®ä»å±ææžãUTFTã§ãµããŒãããããã£ã¹ãã¬ã€ã¢ãžã¥ãŒã«ããã³ã³ã³ãããŒã©ãŒãã«èšèŒãããŠããŸãã
ãã®ã©ã€ãã©ãªã¯åºæ¬çãªãã®ã§ã衚瀺åºåã®åºæ¬çãªæ©èœã®ã¿ãå«ãŸããŠããŸãã ã¿ããã¹ã¯ãªãŒã³ã³ã³ãããŒã«ïŒU_TouchïŒããªã³ã¹ã¯ãªãŒã³ãã¿ã³ã®æäœïŒUTFT_ButtonsïŒãã°ã©ãã£ãã¯ããªããã£ããæç»ããããã®æ¡åŒµæ©èœã»ããïŒUTFT_GeometryïŒãããã³äžéšã®ãã£ã¹ãã¬ã€ã«çµã¿èŸŒãŸãããã©ã³ããšã¢ã€ã³ã³ã®äœ¿çšãªã©ãè¿œå æ©èœãå®è£ ãããŠããŸãã ïŒUTFT_CTEïŒãªã©
ããŒã¹ã©ã€ãã©ãªã䜿çšãããšãããŒãããããã©ã³ããæäœã§ããŸãã ãã©ã³ãã¯ãããŒã¿ã®é åãšããŠä¿åãããå¥ã®ãã¡ã€ã«ã«é 眮ãããŠããã°ã©ã ããã¹ãã«æ¥ç¶ãããŸãã
2.ã©ã€ãã©ãªã®äœ¿çšãéå§ãã
ã©ã€ãã©ãªã¯ãAVRãã©ãããã©ãŒã ã«åºã¥ãã³ã³ãããŒã©ãŒïŒArduino MEGAïŒãšARMãã©ãããã©ãŒã äžã®ã³ã³ãããŒã©ãŒïŒArduino DUEïŒã®äž¡æ¹ã§äœ¿çšã§ããŸãã Arduino DUEã³ã³ãããŒã©ãŒã§ã©ã€ãã©ãªãŒã®äœ¿çšãéå§ããåã«ãã©ã€ãã©ãªãŒãã€ã³ã¹ããŒã«ãããŠãããã©ã«ããŒã«ç§»åããå¿ èŠããããŸãïŒ_ARDUINO_FOLDER_ / libraries / UTFTã/ hardware / armãã©ã«ããŒãšãã®äžã®HW_ARM_definesãã¡ã€ã«ãèŠã€ããŸãã ãã®ãã¡ã€ã«ã§ã¯ã次ã®è¡ã®ã³ã¡ã³ãã解é€ããå¿ èŠããããŸãã
#define CTE_DUE_SHIELD 1
UTFTã©ã€ãã©ãªã«ã¯ãçŸåšäœ¿çšãããŠããªã衚瀺ã¢ãã«ã®åæåã³ãŒããç¡å¹ã«ã§ãã䟿å©ãªæ©èœããããŸãã ããã«ãããäžå®éã®ã¡ã¢ãªãç¯çŽãããŸãïŒããšãã°ãã³ã³ãã€ã«ãããããã°ã©ã ã12KBè¿ãæžå°ããŸããïŒã ãããè¡ãã«ã¯ãã©ã€ãã©ãªã®ã«ãŒããã©ã«ããŒã«ãããšãã£ã¿ãŒã§memorysaver.hãã¡ã€ã«ãéãããããžã§ã¯ãã§äœ¿çšããäºå®ã®ãªãã³ã³ãããŒã©ãŒã®ååã§è¡ã®ã³ã¡ã³ãã解é€ããŸãã ãã®å Žåãã³ã¡ã³ããä»ãããŸãŸã«ããå¿ èŠãããã³ã³ãããŒã©ãŒã¯1ã€ã ãã§ãïŒäœ¿çšããŠããã³ã³ãããŒã©ãŒïŒã äžèšã®ããã«ããã£ã¹ãã¬ã€ã«ã¯ILI9481ã³ã³ãããŒã©ãŒãè£ åãããŠããŸãã ãããã£ãŠã次ã®è¡ïŒ
//#define DISABLE_ILI9481 1 // CTE32HR
ã³ã¡ã³ãã®ãŸãŸã«ããŠãæ®ãã®è¡ã§ã¯è¡ã®å é ã«ãããã¹ãŠã®//æåãåé€ããŸãã ããã§äœæ¥ã§ããŸãã
ãããžã§ã¯ãã§ã®ã©ã€ãã©ãªã®äœ¿çšã¯ãããŒããšåæåããå§ãŸããŸãã åæåãªãã·ã§ã³ã¯ã䜿çšãããã£ã¹ãã¬ã€ã®ã¿ã€ãã«ãã£ãŠç°ãªããŸãã åºæ¬UTFTã©ã€ãã©ãªãããŒããããªããžã§ã¯ã-myGLCDãšåŒã°ãããã£ã¹ãã¬ã€ãäœæããŸãã ãã©ã¡ãŒã¿ãŒ-RSãWRãCSãRSTãããã³ALEã©ã€ã³ãæ¥ç¶ãããŠãããã£ã¹ãã¬ã€ã¢ãã«ãšãã³çªå·ã®èå¥åã ãããã®ãã©ã¡ãŒã¿ãŒã¯ããã£ã¹ãã¬ã€ã®è£œé å ã«ç¢ºèªããããã©ã€ãã©ãªã«ä»å±ã®ãµããŒããããŠãããã£ã¹ãã¬ã€ã®ãªã¹ãããéžæããå¿ èŠããããŸãã
ãã®ããŒãžã§ã³ã§ã¯ã解å床480x320ã®3.2ã€ã³ããã£ã¹ãã¬ã€ãšãColdtears Electronics補ã®ILI9481ã³ã³ãããŒã©ãŒãCTE32HRãšããŠæå®ãããŠããŸãã åæã«ãããŒã ãã¬ãŒãåè·¯ã«ãããšãå¶åŸ¡ã©ã€ã³ã¯ãã³25-28ã«æ¥ç¶ãããŸãã
#include <UTFT.h>
UTFT myGLCD(CTE32HR,25,26,27,28);
次ã«ãå€éšãã©ã³ããæ¥ç¶ããå¿ èŠããããŸãïŒçµã¿èŸŒã¿ã®è¡šç€ºãã©ã³ãã¯ãŸã 䜿çšããŸãã-ããã¯å¥ã®è°è«ã®ãããã¯ã§ãïŒã ã©ã€ãã©ãªã«ã¯3ã€ã®åºæ¬ãã©ã³ããä»å±ããŠããŸãã ãããã®ãã©ã³ãã®åºåè¡ã¯æ¬¡ã®ããã«ãªããŸãã
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];
ãã®ãããã©ã€ãã©ãªãæ¥ç¶ããŠåæåãããã©ã³ããã¢ã¿ããããŠãvoid setupïŒïŒããã·ãŒãžã£ã§ãã£ã¹ãã¬ã€ãåæåããå¿ èŠããããŸãã
void setup() {
myGLCD.InitLCD();
myGLCD.clrScr();
}
InitLCDïŒïŒã³ãã³ãã䜿çšãããšããã£ã¹ãã¬ã€ã®åçŽæ¹åãŸãã¯æ°Žå¹³æ¹åãèšå®ã§ããŸãã ããã©ã«ãã§ã¯ïŒãã©ã¡ãŒã¿ãªãã§ã³ãã³ããåŒã³åºãããå ŽåïŒãæ°Žå¹³æ¹åãèšå®ãããŸãã ClrScrïŒïŒã³ãã³ã 衚瀺ãã¯ãªã¢ããã ãã§ãã ã©ã€ãã©ãªã«ã¯ããã£ã¹ãã¬ã€å šäœã®èæ¯è²ã®æŠå¿µããªãããšã«æ³šæããŠãã ããã ã¯ãªãŒãã³ã°åŸããã£ã¹ãã¬ã€ã¯åžžã«é»ã«ãªããŸãã
æåŸã«ãã©ã€ãã©ãªã³ãã³ãã®è©³çŽ°ãªèª¬æã«å ¥ãåã«ãæãç°¡åãªäŸãçµäºããŸããBigFontãã©ã³ããéžæããåŸæ¥ã®ãHelloãworldïŒããå°å·ããŸãããã£ã¹ãã¬ã€ã®äžçªäžã®è¡ã®äžå€®ã«ïŒ
void loop() {
myGLCD.setFont(BigFont);
myGLCD.print("Hello, world!",CENTER,0);
}
3.ã©ã€ãã©ãªã³ãã³ã
ã©ã€ãã©ãªã䜿çšãããšãã¯ãArduinoã©ã€ãã©ãªã®ãããã©ã«ããŒã«ã€ã³ã¹ããŒã«ãããã£ã¬ã¯ãã£ãã䜿çšããŠæ¥ç¶ããå¿ èŠããããŸãã
#include <UTFT.h>
ã³ãã³ãã®èª¬æã¯ãäž»ã«ã©ã€ãã©ãªã«ä»å±ããŠããè±èªã®ããã¥ã¢ã«ããåãããŠãããå®éã®èŠ³å¯ãšäŸã«ãã£ãŠå€§å¹ ã«è£è¶³ãããŠããŸãã ã ãã...
UTFT-æå®ãããååã§åºæ¬è¡šç€ºã¯ã©ã¹ãäœæããŸããã¢ãã«èå¥åãšæ¥ç¶æ¹æ³ã¯ãã©ã¡ãŒã¿ãŒãšããŠç€ºãããŸãã
次ã®2ã€ã®ãªãã·ã§ã³ããããŸãããã©ã¬ã«ã€ã³ã¿ãŒãã§ã€ã¹ãæã€ã¢ãã«ã®å Žåãã³ãã³ãã®åœ¢åŒã¯æ¬¡ã®ãšããã§ãã
UTFT _NAME_ (model, RS, WR, CS, RST, ALE)
ããã§ã_NAME_ã¯è¡šç€ºãªããžã§ã¯ãã®ä»»æã®ååã§ããããã®ãªããžã§ã¯ããžã®ã¢ã¯ã»ã¹ã®ãã¬ãã£ãã¯ã¹ãšããŠäœ¿çšãããŸããmodelã¯ç¹å®ã®ãã£ã¹ãã¬ã€ã®ã¢ãã«ã®èå¥åã§ãïŒãµããŒããããŠããã¢ãã«ã®ãªã¹ããåç §ïŒ RSãWRãCSãRSTãALEã¯ããã£ã¹ãã¬ã€ã¢ãžã¥ãŒã«ã®å¯Ÿå¿ããå¶åŸ¡ä¿¡å·ãã·ãŒã«ããä»ããŠæ¥ç¶ããããã³çªå·ã§ãã ãµããŒããããŠãããã¹ãŠã®ã¢ãã«ã«ALEä¿¡å·ãããããã§ã¯ãããŸãããã¢ãã«ã«ALEä¿¡å·ããªãå Žåã¯ããã®ãã©ã¡ãŒã¿ãŒãã¹ãããããŠãã ããã
ã·ãªã¢ã«ã€ã³ã¿ãŒãã§ã€ã¹ãæã€ã¢ãã«ã®å Žåãã³ãã³ãã®åœ¢åŒã¯æ¬¡ã®ãšããã§ãã
UTFT _NAME_ (model, SDA, SCL, CS, RST, RS)
ããã§ãSDAãSCLãCSãRSTãããã³RSã¯ãã·ãªã¢ã«ã€ã³ã¿ãŒãã§ãŒã¹ã®å¯Ÿå¿ããä¿¡å·ãæ¥ç¶ããããã³çªå·ã§ãã RSãã©ã¡ãŒã¿ã¯ãªãã·ã§ã³ã§ãããäžéšã®ãã£ã¹ãã¬ã€ã¢ãã«ã§ã¯èšå®ãããŠããŸããã
ãã®ã³ãã³ããå«ãè¡ã¯å®çŸ©é åã«é 眮ãããä»ã®ã©ã€ãã©ãªã³ãã³ãã®åã«é 眮ããå¿ èŠããããŸãã æå®ããã衚瀺åã¯ãåŸç¶ã®ãã¹ãŠã®ã©ã€ãã©ãªã³ãã³ãã®ãã¬ãã£ãã¯ã¹ãšããŠäœ¿çšããå¿ èŠããããŸãã
InitLCD-ãã£ã¹ãã¬ã€ãåæåããæ°Žå¹³ãŸãã¯åçŽæ¹åãèšå®ããŸãã æ¹åèå¥åã¯ãã©ã¡ãŒã¿ãŒãšããŠæå®ãããŸãã
ãã©ã¡ãŒã¿ãªãã§æå®ãããšãã³ãã³ãã¯æ°Žå¹³æ¹åãèšå®ããŸãã ãã©ã¡ãŒã¿PORTRAITãŸãã¯0-ãæå®ãããšãLANDSCAPEãŸãã¯1-æ°Žå¹³ãæå®ãããšãåçŽæ¹åãéžæãããŸãã
æ°Žå¹³æ¹åã®å Žåãã³ã³ãããŒã©ãŒã®ã³ãã¯ã¿ãŒã¯å·ŠåŽã«ãããåçŽã®ã³ãã¯ã¿ãŒã¯äžéšã«ãããŸãã ä»ã®ãªãã·ã§ã³ã¯æäŸãããŸããã 0ããã³1以å€ã®æ°å€ããã©ã¡ãŒã¿ãŒãšããŠèšå®ãããšãæ å ±ã®è¡šç€ºãä¹±ããŸãã
ãã®ã³ãã³ãã¯éåžžãvoid setupïŒïŒã»ã¯ã·ã§ã³ã§äœ¿çšãããŸãããããšãã°æ¬¡ã®ããã«ã¡ã€ã³ããã°ã©ã ã«ãŒãã§ã䜿çšã§ããŸãã
#include <UTFT.h> UTFT myGLCD(CTE32HR,25,26,27,28); extern uint8_t BigFont[]; void setup() { } void loop() { myGLCD.InitLCD(1); myGLCD.setFont(BigFont); myGLCD.print("Hello, world!",CENTER,0); delay(1000); myGLCD.InitLCD(0); myGLCD.setFont(BigFont); myGLCD.print("Hello, world!",CENTER,0); delay(1000); }
ååãšããŠãäœçœ®ã»ã³ãµãŒããã£ã¹ãã¬ã€ã«æ¥ç¶ããããšã«ãããã¿ãã¬ããã®ããã«ç»é¢ãå転ãããããšãã§ããŸã;ïŒïŒçå®ã¯ãåæåäžã«ãã£ã¹ãã¬ã€ãçæéçœãç¹æ» ããå°è±¡ãããããæãªãããšã§ãã ;ïŒ
ãã®ã³ãã³ãã¯ãèæ¯è²ãé»ãããã¹ããçœã«èšå®ãã䜿çšãããã©ã³ãã®ååãããªããã«ãªã»ãããããã¹ãŠã®å°å·ã³ãã³ãã®çµæã¯ããã©ã³ããæ瀺çã«èšå®ããããŸã§äºæž¬äžèœã«ãªããŸãïŒsetFontã³ãã³ããåç §ïŒã åæååŸããã£ã¹ãã¬ã€ããããã«ããããšããå§ãããŸãïŒclrScrã³ãã³ããåç §ïŒãç»é¢ã¯é»ã§å¡ãã€ã¶ãããŸãã
clrScr-ãã£ã¹ãã¬ã€ãã¯ãªã¢ãããã£ã¹ãã¬ã€ã«è¡šç€ºãããŠãããã¹ãŠã®æ å ±ãæ¶å»ãããã£ã¹ãã¬ã€ãé»ã§å¡ãã€ã¶ããŸãã ãã©ã¡ãŒã¿ãŒã¯ãããŸããã
ãã£ã¹ãã¬ã€ãã¯ãªãŒãã³ã°ãããšããæå®ãããèæ¯è²ïŒsetBackColorã³ãã³ããåç §ïŒã¯ãªã»ããããããåããŸãŸã§ããããã£ã¹ãã¬ã€ã¯ãŸã é»ã§å¡ãã€ã¶ãããŠããŸãã å¥ã®èæ¯è²ã§è¡šç€ºãã¯ãªã¢ããã«ã¯ãfillScrã³ãã³ãã䜿çšããå¿ èŠããããŸãã 次ã®äŸã¯ãclrScrã³ãã³ãã瀺ããŠããŸãã
#include <UTFT.h> UTFT myGLCD(CTE32HR,25,26,27,28); extern uint8_t BigFont[]; void setup() { myGLCD.InitLCD(); delay(1000); myGLCD.setBackColor(0,255,0); myGLCD.clrScr(); delay(1000); myGLCD.setFont(BigFont); myGLCD.print("FFFFFFFF", CENTER,0); } void loop() { }
ã³ã³ãããŒã©ãŒããªã»ããããããšããã£ã¹ãã¬ã€ãåæåããã1ç§åŸã«ã¯ãªã¢ããïŒãã£ã¹ãã¬ã€ãé»ããªãïŒã1ç§åŸã«ã·ã³ãã«ã衚瀺ãããŸãããã¯ãªãŒãã³ã°åã«èšå®ãããèæ¯è²ã¯å€æŽãããŠããŸããã
次ã®ããã€ãã®ã³ãã³ããæ€èšããåã«ãã©ã€ãã©ãªã³ãã³ãã§è²ãèšå®ããæ©èœãæ€èšããå¿ èŠããããŸãã
ã«ã©ãŒã³ãŒãã£ã³ã°ã·ã¹ãã
ã©ã€ãã©ãªã®è²ã¯ããã€ãã®æ¹æ³ã§èšå®ãããŸãã ã«ã©ãŒããŒã¿ãè¡šãå éšåœ¢åŒã¯RGB565ã§ãã ãã®åœ¢åŒã§ã¯ãè²ã¯16ãããå€ã§ãšã³ã³ãŒããããŸããèµ€ãšéã®ã¬ãã«ã¯5ãããã§ãç·ã¯6ãããã§ãšã³ã³ãŒããããŸãã è²ã§åäœããã»ãšãã©ã®ã©ã€ãã©ãªã³ãã³ãã¯ãã³ã³ãã§åºåããã3ã€ã®æ°åã®åœ¢åŒã§æå®ãããå€ãèªèããŸãã ãããã®åæ°å€ã¯ã察å¿ããè²ïŒRãGãBïŒã®ã¬ãã«ãæ åœããŸãã åçªå·ã«èš±å¯ãããå€ã¯0ã255ã§ãã
ãããã£ãŠããŠãŒã¶ãŒã¯è²ãRGB888圢åŒã§èšå®ããRGB565ã¯ã©ã€ãã©ãªå ã§äœ¿çšãããŸãã 圢åŒå€æã¯ã次ã®åŒã䜿çšããŠã©ã€ãã©ãªå ã§å®è¡ãããŸãã
word color = ((r&248)<<8 | (g&252)<<3 | (b&248)>>3);
ããã§ãcolorã¯RGB565圢åŒã®è²ã®å€ãrãgãããã³bã¯ãŠãŒã¶ãŒå®çŸ©ã®è²ã®å€ã§ãã çŸåšã®è²ã決å®ããããã®ãã¹ãŠã®é¢æ°ãè¿ãããã®ã¯ãã®åœ¢åŒã§ãã
è²ãæå®ãããšãã¯ãrãgãããã³bã®æå®å€ã®ãã¹ãŠã®çµã¿åãããç°ãªãè²ãçæããããã§ã¯ãªãããšãèæ ®ããå¿ èŠããããŸãã ãããã£ãŠãããšãã°ãèµ€ã®ã¬ãã«255ãš253ã®å€ã¯ãåãã¬ãã«ã®èµ€ã瀺ããŸãã 以äžã®ããã°ã©ã ã¯ãè²èšå®ã³ãã³ãã§ããã°ã©ã ã§æå®ãããè²ãååŸããããã«æå¹ãªrãgãããã³bã®æ倧å€ãšæå°å€ã衚瀺ããŸãã èšç®ãå®è¡ããã«ã¯ãmyGLCD.setBackColorã³ãã³ãã®ãã©ã¡ãŒã¿ãŒã§éžæããè²ãå°æ°å€rãgãbã«çœ®ãæããããã°ã©ã ãã³ã³ãã€ã«ããŠå®è¡ããŸãã ãã£ã¹ãã¬ã€ã«ã¯ãmyGLCD.getBackColoré¢æ°ã«ãã£ãŠè¿ãããRGB565ã·ã¹ãã ã®ã«ã©ãŒã³ãŒããšãrãgãããã³bã®æå°å€ãšæ倧å€ã衚瀺ããããã®è²ãååŸã§ããŸãã
#include <UTFT.h> UTFT myGLCD(CTE32HR,25,26,27,28); extern uint8_t BigFont[]; void setup() { myGLCD.InitLCD(); myGLCD.clrScr(); myGLCD.setFont(BigFont); } void loop() { myGLCD.setBackColor(245,34,112); myGLCD.setColor(VGA_NAVY); word CurrentColor=myGLCD.getBackColor(); byte R_1 = highByte(CurrentColor)>>3; byte R_min = R_1<<3; byte R_max = R_min|7; byte G_1 = highByte(CurrentColor)<<5; G_1 = G_1>>2|lowByte(CurrentColor)>>5; byte G_min = G_1<<2; byte G_max = G_min|3; byte B_1 = lowByte(CurrentColor)<<3; B_1 = B_1>>3; byte B_min = B_1<<3; byte B_max = B_min|7; myGLCD.print("GetColor", 0,0); myGLCD.print("RGB888 Min", 0,36); myGLCD.print("RGB888 Max", 0,54); myGLCD.printNumI(CurrentColor, 162,0); myGLCD.printNumI(R_min, 162,36); myGLCD.printNumI(R_max, 162,54); myGLCD.printNumI(G_min, 212,36); myGLCD.printNumI(G_max, 212,54); myGLCD.printNumI(B_min, 262,36); myGLCD.printNumI(B_max, 262,54); }
äžéšã®æšæºè²ã¯ãèå¥åã䜿çšããŠèšå®ã§ããŸãã
VGA_BLACK-é»ã
VGA_SILVER-ã·ã«ããŒ
VGA_GRAY-ã°ã¬ãŒ
VGA_WHITE-ãã¯ã€ã
VGA_MAROON-ã¬ãããã©ãŠã³
VGA_RED-èµ€
VGA_PURPLE-ããŒã³ã¿
VGA_FUCHSIA-ãã¯ã·ã¢
VGA_GREEN-ç·
VGA_LIME-ã©ã€ã
VGA_NAVY-æµ·è»
VGA_BLUE-é
VGA_TEAL-ãã«ãŒã°ãªãŒã³
VGA_AQUA-æµ·ã®æ³¢
ãããã®è²ã®RGBã³ãŒããç¥ãããå Žåã¯ãäžèšã®ããã°ã©ã ã®myGLCD.setBackColorã³ãã³ãã®3ã€ã®æ°åã®ä»£ããã«è²èå¥åã䜿çšããŸããã³ã³ãã€ã«ãšèµ·ååŸãã³ãŒãããã£ã¹ãã¬ã€ã«è¡šç€ºãããŸãã
ãã®ãããã©ã€ãã©ãªã³ãã³ãã®æ€èšãç¶ããŸãã
fillScr-ãã£ã¹ãã¬ã€ãã¯ãªã¢ãããã£ã¹ãã¬ã€ã«è¡šç€ºãããŠãããã¹ãŠã®æ å ±ãæ¶å»ãããã©ã¡ãŒã¿ãŒãšããŠæå®ãããèæ¯è²ã§å¡ãã€ã¶ããŸãã
èæ¯è²ã¯ã次ã®ããã«3ã€ã®æ°åãŸãã¯è²èå¥åã§æå®ãããŸãã
fillScr(0,0,0); //
fillScr(255,255,255); //
fillScr(255,128,0); //
fillScr(VGA_RED); //
ãã®ã³ãã³ãã¯ãclrScrãšåæ§ã«ãå°å·ã³ãã³ãã®æå®ãããèæ¯è²ãå€æŽããªããããæå®ãããè²ã§å¡ãã€ã¶ããããã£ã¹ãã¬ã€ã§å°å·ããå Žåãèæ¯è²ãè¿œå ã§æå®ããå¿ èŠããããŸãïŒsetBackColorã³ãã³ããåç §ïŒã
setColor-ã°ã©ãã£ãã¯ããªããã£ããå°å·ããã³æç»ããããã®ãã¹ãŠã®ã³ãã³ãã®ãã€ã³ã¯ãã®è²ãèšå®ããŸãã å¿ èŠãªè²ã¯ãã©ã¡ãŒã¿ãŒãšããŠæå®ãããŸãã
è²ã¯ãfillScrã³ãã³ãã®å Žåãšåãæ¹æ³ã§èšå®ãããŸã-æ°åãŸãã¯æšæºè²ã®èå¥åã䜿çšããŸãã äŸïŒ
#include <UTFT.h> UTFT myGLCD(CTE32HR,25,26,27,28); extern uint8_t BigFont[]; void setup() { myGLCD.InitLCD(); myGLCD.clrScr(); myGLCD.setFont(BigFont); } void loop() { myGLCD.setColor(VGA_RED); myGLCD.print("Hello, World!",CENTER,0); myGLCD.setColor(VGA_NAVY); myGLCD.print("Hello, World!",CENTER,18); myGLCD.setColor(VGA_TEAL); myGLCD.print("Hello, World!",CENTER,36); myGLCD.setColor(VGA_LIME); myGLCD.print("Hello, World!",CENTER,54); while(1); }
setBackColor-å°å·ã³ãã³ãã®èæ¯è²ãèšå®ããŸãã å¿ èŠãªè²ã¯ãã©ã¡ãŒã¿ãŒãšããŠæå®ãããŸãã
è²ã¯éåžžã®æ¹æ³ã§-æ°åãŸãã¯èå¥åã«ãã£ãŠèšå®ãããŸãïŒfillScrã³ãã³ããåç §ïŒ;ãã ãããã®ã³ãã³ãã«ã¯å¥ã®èå¥åããããŸã-VGA_TRANSPARENTã¯ããéæãªãèæ¯ã«æåãå°å·ã§ããŸãã
é»ä»¥å€ã®è²ã§å¡ãã€ã¶ããããã£ã¹ãã¬ã€ã«å°å·ããå¿ èŠãããå Žåã¯ãsetBackColorã³ãã³ãã§ãŸã£ããåãèæ¯è²ãèšå®ããããsetBackColorã³ãã³ãïŒVGA_TRANSPARENTïŒã䜿çšããå¿ èŠããããŸãã
getColor-ã€ã³ã¯è²ã®çŸåšã®å€ãè¿ããŸãã ãã©ã¡ãŒã¿ãŒã¯ãããŸããã
getBackColor âçŸåšã®èæ¯è²ã®å€ãè¿ããŸãã ãã©ã¡ãŒã¿ãŒã¯ãããŸããã
ãããã®2ã€ã®é¢æ°ã¯ãçŸåšæå®ãããŠããè²ã«å¯Ÿå¿ããåèªã¿ã€ãã®å€ãRGB565圢åŒã§è¿ããŸãã ãã®å€ã¯ãããšãã°æ¬¡ã®ããã«ãsetColorãSetBackColorãããã³fillScrã³ãã³ãã®ãã©ã¡ãŒã¿ãŒãšããŠæž¡ãããšãã§ããŸãã
setColor(32586);
ãã®ã³ãã³ãã¯ãäžèšã®RGB565ã«ã©ãŒãã³ãŒãããã°ã©ã ã§èŠãããããã«ãsetColorïŒ120,232,80ïŒãŸãã¯setColorïŒ125,233,84ïŒãšåãè²ãäžããŸãã
getDisplayXSize-éžæããæ¹åã®è¡šç€ºå¹ ããã¯ã»ã«åäœã§è¿ããŸãã ãã©ã¡ãŒã¿ãŒã¯ãããŸããã
getDisplayYSize-éžæããæ¹åã®ãã£ã¹ãã¬ã€ã®é«ãããã¯ã»ã«åäœã§è¿ããŸãã ãã©ã¡ãŒã¿ãŒã¯ãããŸããã
ãããã®2ã€ã®æ©èœã¯ã次ã®äŸã§èª¬æã§ããŸãã
#include <UTFT.h> UTFT myGLCD(CTE32HR,25,26,27,28); extern uint8_t BigFont[]; void setup() { } void loop() { myGLCD.InitLCD(PORTRAIT); myGLCD.setFont(BigFont); myGLCD.clrScr(); myGLCD.print("Screen Width=",0,0); myGLCD.printNumI(myGLCD.getDisplayXSize(),250,0); myGLCD.print("Screen Height=",0,18); myGLCD.printNumI(myGLCD.getDisplayYSize(),250,18); delay(2000); myGLCD.InitLCD(LANDSCAPE); myGLCD.setFont(BigFont); myGLCD.clrScr(); myGLCD.print("Screen Width=",0,0); myGLCD.printNumI(myGLCD.getDisplayXSize(),250,0); myGLCD.print("Screen Height=",0,18); myGLCD.printNumI(myGLCD.getDisplayYSize(),250,18); delay(2000); }
ããã°ã©ã ãéå§ãããšïŒæ¹åã¯åçŽã«èšå®ãããŸãïŒããã£ã¹ãã¬ã€ã®å¹ ã¯320ãã¯ã»ã«ã«ãªããé«ãã¯480ã«ãªããŸãã2ç§åŸãæ¹åã¯æ°Žå¹³ã«å€ãããå¹ ã¯480ãã¯ã»ã«ã«çãããªããé«ãã¯320ã«ãªããŸãã
å°å·ã³ãã³ããæ€èšãããã©ã³ããæäœããåã«ãUTFTã©ã€ãã©ãªã§ãã©ã³ãã䜿çšããæ¹æ³ã«ã€ããŠè©³ãã説æããå¿ èŠããããŸãã
å°å·ã³ãã³ãçšã®å€éšãã©ã³ãã
å€éšãã©ã³ãã¯ãæ¡åŒµåã.cã®å¥ã®ãã¡ã€ã«ã«ä¿åããããã©ã³ããã©ã¡ãŒã¿ãšæåã®ãšã³ã³ãŒããããã°ã©ãã£ãã¯ã€ã¡ãŒãžã«é¢ããæ å ±ãå«ãããŒã¿é åã§ãã
ãã©ã³ãã¯ããextern uint8_t _ FONT_NAME_;ããšããæååã§æ¥ç¶ãããŠããŸãã externæå®åã¯ããã©ã³ãããŒã¿é åãå¥ã®ãã¡ã€ã«ã«ããããã©ã³ãåããã©ã³ããã¡ã€ã«ããååŸãããããšã瀺ããŸãã ããã¯ãã¡ã€ã«åã§ã¯ãªãããã©ã³ãèªäœã®ååã§ããããšã«æ³šæããŠãã ããïŒãããã¯ç°ãªãå ŽåããããŸãïŒã 䜿çšãããã©ã³ãã¯ãexternæå®åã䜿çšããŠããã°ã©ã ã§å®£èšããå¿ èŠããããŸãã ããšãã°ã次ã®ããã«ïŒ
extern uint8_t BigFont[];
ã©ã€ãã©ãªã«ã¯ã3ã€ã®äž»èŠãªãã©ã³ããä»å±ããŠããŸãã
- SmallFont-95æå8x12
- BigFont-95æå16x16
- SevenSegNumFont-10 32 x 50ã®æ°å
SevenSegNumFontãã©ã³ãã¯ã7ã»ã°ã¡ã³ãã®ããžã¿ã«ã€ã³ãžã±ãŒã¿ãŒãæš¡å£ããŠããŸãã
è¿œå ã®ãã©ã³ãã¯æ¬¡ã®å Žæã«ãããŸãã
http://www.henningkarlsen.com/electronics/r_fonts.php
ãŸããç¹å¥ã«æºåãããç»åãã¡ã€ã«ããç¬èªã®ãã©ã³ããäœæã§ãããªã³ã©ã€ã³ãµãŒãã¹ããããŸãã
http://www.henningkarlsen.com/electronics/t_make_font_file.php
ã©ã€ãã©ãªã«å«ãŸãããã©ã³ãã¯ãã©ã€ãã©ãªã®ã«ãŒããã©ã«ããŒã®DefaultFonts.cãã¡ã€ã«ã«ä¿åãããŸãã è¿œå ã®ãã©ã³ãïŒåå¥ã«æç»ããããäžèšã®ãªã³ã¯ããããŠã³ããŒãããïŒããããžã§ã¯ãã®ãã©ã«ããŒã«é 眮ããããšããå§ãããŸããããããªããšãã³ã³ãã€ã©ãŒãããããèŠã€ããããªãå ŽåããããŸãã
ãã©ã³ããã¡ã€ã«ã¯ããŠãŒãã£ãªãã£æ å ±ãšãã©ã³ãã®ãšã³ã³ãŒããããã°ã©ãã£ãã¯ã€ã¡ãŒãžãå«ãé åã®å®çŸ©ã§ãã ååã«å ããŠããã©ã³ããã¡ã€ã«å ã®ã³ã¡ã³ãã«ã¯ããã¯ã»ã«åäœã®æåãµã€ãºã«é¢ããæ å ±ïŒãã®æ å ±ã¯ãããã¹ãã衚瀺ããããã®åº§æšãèšå®ãããšãã«åœ¹ç«ã¡ãŸãïŒããã©ã³ãããŒã¿é åã«ãã£ãŠå æãããã¡ã¢ãªéãããã³ãã®ãã©ã³ãã§æå®ãããæåæ°ãå«ãŸããŸãã 95æåã®ããã«ããã©ã³ãããããžã¿ã«ãïŒ10æåïŒãããã³ããµãã»ãããïŒç°ãªãæåæ°ïŒãåºå¥ããŸãã
é åã®æåã®4ãã€ãã«ã¯ããªãŒããŒãããæ å ±ãå«ãŸããŠããŸãã
ãã€ã0-ãã¯ã»ã«åäœã®æ°Žå¹³ãã©ã³ããµã€ãº
ãã€ã1-ãã¯ã»ã«åäœã®åçŽãã©ã³ããµã€ãº
ãã€ã2ã¯ããã©ã³ãã®æåã®æåã®ã³ãŒãã§ãïŒããã«ããã©ã³ãã®å Žåã¯0x20ãã€ãŸãã¹ããŒã¹ã³ãŒãããããžã¿ã«ãã®å Žåã¯0x30-æåã³ãŒãã¯ããŒããïŒã
ãã€ã3-ãã©ã³ãæåã®æ°ïŒããã«ããã©ã³ãã®å Žåã¯0x5Fããããžã¿ã«ãã®å Žåã¯0x0AïŒã
è€éãªåœ¢åŒã®è©³çŽ°ãšã«ã¹ã¿ã ãã©ã³ãã®äœæã«ã€ããŠã¯ããã¡ããã芧ãã ãã ïŒ http : //www.henningkarlsen.com/electronics/h_utft_fonts_101.php
7ã»ã°ã¡ã³ãã€ã³ãžã±ãŒã¿ãŒãšããŠã¹ã¿ã€ã«èšå®ããã倧ããªæ°åã䜿çšããå Žåã¯ãããã«SevenSegNumFontãã©ã³ãã代æ¿ã®SevenSegNumFontPlusãã©ã³ãã«çœ®ãæããããšããå§ãããŸãã
http://www.henningkarlsen.com/electronics/dlfont.php?id=21&t=c
æšæºãã©ã³ãã«ã¯ãªãéåžžã«äŸ¿å©ãªèšå·ãïŒãã®ååšã«ãã£ãŠåºå¥ãããŸãã ãã©ã³ããã¡ã€ã«ã¯ããã°ã©ã ã®ãã©ã«ããŒã«é 眮ããextern uint8_t SevenSegNumFont []宣èšã眮ãæããŸãã on extern uint8_t SevenSegNumFontPlus []; ãã®åŸããããžã§ã¯ããéããŠå床éããŸãã ãã©ã³ããã¡ã€ã«ãéãããããžã§ã¯ããé£æ¥ããã¿ãã«è¡šç€ºãããŸãã
setFont-å°å·ã³ãã³ãã®ãã©ã³ããèšå®ããŸãã ãã©ã³ãåã¯ãã©ã¡ãŒã¿ãŒãšããŠæž¡ãããŸãã
ãã©ã³ãã¯ãããã°ã©ã å®çŸ©é åã§äºåã«å®£èšããå¿ èŠããããŸãã äŸïŒ
#include <UTFT.h> UTFT myGLCD(CTE32HR,25,26,27,28); extern uint8_t SmallFont[]; void setup() { myGLCD.InitLCD(); myGLCD.setFont(SmallFont); myGLCD.clrScr(); myGLCD.print("Hello, World!",0,0); } void loop() {}
getFont-ã³ã³ãããŒã©ãŒã¡ã¢ãªå ã®çŸåšã®ãã©ã³ãã®ã¢ãã¬ã¹ãžã®ãã€ã³ã¿ãŒãè¿ããŸãã
äŸãèããŠã¿ãŸãããã ãã©ã³ãããŒã¿é åã®æåã®4ãã€ãã«ã¯ããã©ã³ãããããã£ã«é¢ããæ å ±ãå«ãŸããŠããããšãå°ãåã«è¿°ã¹ãŸããã çŸåšã®ãã©ã³ãã«é¢ãããã®æ å ±ã¯ãã³ã³ãããŒã©ãŒã®ã¡ã¢ãªããçŽæ¥ååŸããŠãããã°ã©ã ã§äœ¿çšã§ããŸãã 次ã®ããã°ã©ã ã¯å€æ°ã«é 眮ãããã¯ã»ã«åäœã®æåãµã€ãºãæåã®æåã®ã³ãŒããããã³setFontã³ãã³ãã§æå®ãããçŸåšã®ãã©ã³ãã®æåæ°ã衚瀺ããŸãã
#include <UTFT.h> UTFT myGLCD(CTE32HR,25,26,27,28); extern uint8_t BigFont[]; void setup() { myGLCD.InitLCD(); myGLCD.clrScr(); myGLCD.setFont(BigFont); SerialUSB.begin(9600); } void loop() { uint8_t* FontAddr = myGLCD.getFont(); byte CurrentFontX = *FontAddr; byte CurrentFontY = *(FontAddr+1); byte CurrentFontStartCode = *(FontAddr+2); byte CurrentFontSymNumber = *(FontAddr+3); myGLCD.printNumI(CurrentFontX, 0,0); myGLCD.printNumI(CurrentFontY, 0,18); myGLCD.printNumI(CurrentFontStartCode, 0,36); myGLCD.printNumI(CurrentFontSymNumber, 0,54);
åæ§ã«ãçŸåšã®ãã©ã³ãã®ä»»æã®ãã€ãã«ã¢ã¯ã»ã¹ã§ããŸãã
getFontXsize-çŸåšã®ãã©ã³ãã®æåã®æ°Žå¹³ãµã€ãºïŒå¹ ïŒããã¯ã»ã«åäœã§è¿ããŸãã ãã©ã¡ãŒã¿ãŒã¯ãããŸããã
getFontYXsize-çŸåšã®ãã©ã³ãã®æåã®åçŽãµã€ãºïŒé«ãïŒããã¯ã»ã«åäœã§è¿ããŸãã ãã©ã¡ãŒã¿ãŒã¯ãããŸããã
ãããã®é¢æ°ã¯ãå°å·ã³ãã³ãã®åº§æšãèšç®ããã®ã«åœ¹ç«ã¡ãŸãã ãããã®é¢æ°ã䜿çšããŠåº§æšãèšç®ããäŸã¯ãå°å·ã³ãã³ãã®èª¬æã«èšèŒãããŠããŸãã
次ã«ããã£ã¹ãã¬ã€ã«èšå·æ å ±ã衚瀺ããããã«èšèšãããããã€ãã®ã³ãã³ããã€ãŸãå°å·ã³ãã³ããæ€èšããŸãã
print-ããã¹ããæåå€æ°ã®å 容ããŸãã¯Stringåã®ãªããžã§ã¯ãã衚瀺ããŸãã åºåããã¹ããšå°å·é åã®å·Šäžé ã®åº§æšããã©ã¡ãŒã¿ãŒãšããŠæž¡ãããŸãã å¥ã®ãªãã·ã§ã³ãã©ã¡ãŒã¿ã䜿çšãããšãå°å·å¯èœãªè¡ãç¹å®ã®åŸé ã§é 眮ã§ããŸãã
ãã®ã³ãã³ãã¯ãããã¹ãæ å ±ãåºåããããã®ãã®ã§ããå°å·åº§æšXããã³Yã¯ãã¯ã»ã«åäœã§æå®ãããæ瀺çã«ããŸãã¯æŽæ°å€æ°ãŸãã¯åŒãä»ããŠéä¿¡ã§ããŸããX座æšãšããŠäœ¿çšããããã«èšèšããã3ã€ã®å®çŸ©æžã¿èå¥åããããŸãã
- LEFT-ããã¹ãã¯ãã£ã¹ãã¬ã€ã®å·Šç«¯ã«æããããŸã
- CENTER-ããã¹ãã¯ãã£ã¹ãã¬ã€ã®äžå€®ã«é 眮ãããŸã
- RIGHT-ããã¹ãã¯ãã£ã¹ãã¬ã€ã®å³ç«¯ã«æããããŸã
ããã¹ãæ å ±ã¯ãäºéåŒçšç¬Šã§å²ãŸããæååãšããŠè¡šãããšãã§ããŸãïŒ
myGLCD.print("Hello, World!", 0,0);
Stringåã®å€æ°ãšããŠã
String text = "Hello, World!";
myGLCD.print(text, 0,0);
ãŸãã¯æååå€ãè¿ãé¢æ°ã®çµæãšããŠïŒ
int valueInt = 12345;
myGLCD.print(String(valueInt), 0,0);
float valueFloat = 12345.67;
myGLCD.print(String(valueFloat), 0,18);
座æšã¯ã³ãã³ãåŒã³åºãããšã«åå¥ã«èšå®ãããã³ãã³ãã«ããçŸåšã®å°å·äœçœ®ã¯è¿ãããŸããããããã£ãŠã次ã®å°å·ã³ãã³ãã®äœçœ®ãåå¥ã«èšç®ããå¿ èŠããããŸããããã¯ããªãç°¡åãªæ¹æ³ã§è¡ãããšãã§ããŸãã次ã®äŸã§ã¯ã2è¡ã®æååå€ã1è¡ïŒã¹ããŒã¹ãªãïŒã§åºåããŸãã
#include <UTFT.h> UTFT myGLCD(CTE32HR,25,26,27,28); extern uint8_t BigFont[]; void setup() { myGLCD.InitLCD(); myGLCD.clrScr(); myGLCD.setFont(BigFont); } void loop() { int X=0; int Y=0; int valueInt1 = 12345; myGLCD.print(String(valueInt1), X,Y); X=X+myGLCD.getFontXsize()*String(valueInt1).length(); int valueInt2 = 67890; myGLCD.print(String(valueInt2), X,Y); }
衚瀺ãããå€ãã¹ããŒã¹ã§åºåãã«ã¯ãXã®èšç®å€ã1æåã®å¹ ã ãå¢ããå¿ èŠããããŸããããã§ãå°å·ã¯2è¡ã§å®è¡ãããŸãã
#include <UTFT.h> UTFT myGLCD(CTE32HR,25,26,27,28); extern uint8_t BigFont[]; void setup() { myGLCD.InitLCD(); myGLCD.clrScr(); myGLCD.setFont(BigFont); } void loop() { int X=0; int Y=0; int valueInt1 = 12345; myGLCD.print(String(valueInt1), X,Y); Y=Y+myGLCD.getFontYsize(); int valueInt2 = 67890; myGLCD.print(String(valueInt2), X,Y); } LEFT, CENTER RIGHT : #include <UTFT.h> UTFT myGLCD(CTE32HR,25,26,27,28); extern uint8_t BigFont[]; void setup() { myGLCD.InitLCD(); myGLCD.clrScr(); myGLCD.setFont(BigFont); } void loop() { int Y=60; myGLCD.print("Hello, World!", LEFT, Y); Y=Y+myGLCD.getFontYsize(); myGLCD.print("Goodbye, World!", LEFT,Y); Y=Y+myGLCD.getFontYsize()*4; myGLCD.print("Hello, World!", CENTER, Y); Y=Y+myGLCD.getFontYsize(); myGLCD.print("Goodbye, World!", CENTER,Y); Y=Y+myGLCD.getFontYsize()*4; myGLCD.print("Hello, World!", RIGHT, Y); Y=Y+myGLCD.getFontYsize(); myGLCD.print("Goodbye, World!", RIGHT,Y); }
å¥ã®ãªãã·ã§ã³ãã©ã¡ãŒã¿ã䜿çšãããšã0ã359床ã®è§åºŠã§åŸæããç·ãå°å·ã§ããŸããå転ã¯ãå°å·åº§æšïŒå·Šäžé ïŒã«å¯ŸããŠçžå¯Ÿçã«èšå®ãããŸããè§åºŠã®å€ããŒãã®å Žåãéåžžã®æ°Žå¹³æ¹åã®å°å·ãè¡ãããè§åºŠã倧ãããªããšãããã¹ãã¯æå®ãããè§åºŠã ãæèšåãã«å転ããŸãã次ã®äŸã¯ã楜ããã°ã©ãã£ãã¯å¹æãæäŸããŸãã
#include <UTFT.h> UTFT myGLCD(CTE32HR,25,26,27,28); extern uint8_t BigFont[]; void setup() { myGLCD.InitLCD(); myGLCD.clrScr(); myGLCD.setFont(BigFont); } void loop() { int X=240; int Y=160; for (int DEG=0; DEG<360; DEG+=20) { String text = "Hello, World!"; myGLCD.print(text, X,Y, DEG); } }
ããã¹ããæãã«å°å·ããå Žåãäºåå®çŸ©ãããèå¥åLEFTãCENTERãRIGHTã®äœ¿çšã¯æšå¥šãããŸãããã©ã€ãã©ãªã«ãã£ãŠé©åã«èšç®ã§ããªãããã§ããã€ãŸããäœçœ®åããã¯è¡ãæ°Žå¹³ã«å°å·ããããã®ããã«èšç®ãããå転ã¯äœçœ®åããåŸã«å®è¡ãããå°å·é åã®å·Šäžé ã«å¯ŸããŠçžå¯Ÿçã§ãã
ã¡ãªã¿ã«ãå°å·ã³ãã³ãã¯ãã£ã¹ãã¬ã€ããæãåºãæ¹æ³ã決å®ã§ããŸããããããã£ãŠãèªåã§æ倧è¡é·ã«åŸãå¿ èŠããããŸããè¡ãé·ãããå Žåã¯ããã§ã«å°å·ãããŠããããã¹ãã®äžã«ãã®ãããŒã«ãã衚瀺ã§ããŸãããã£ã¹ãã¬ã€ã®äžåŽã®å¢çããåºãå Žåãçµæã¯äºæž¬äžèœã«ãªãããšããããŸãã
printNumI-æŽæ°ãŸãã¯æŽæ°å€æ°ã®å 容ã衚瀺ããŸããåºåå€ãšå°å·é åã®å·Šäžé ã®åº§æšããã©ã¡ãŒã¿ãŒãšããŠæž¡ãããŸãããªãã·ã§ã³ã®ãã©ã¡ãŒã¿ãŒã䜿çšãããšãåºå圢åŒãå¶åŸ¡ã§ããŸãã
å°å·åº§æšã¯ãå°å·ã³ãã³ããšåãæ¹æ³ã§èšå®ãããŸããäœçœ®Xã«èšå·ãä»ããŠçªå·ãå°å·ããå Žåãçªå·èšå·ã衚瀺ãããæåã®æ¡ã衚瀺ãããŸããäœçœ®Xã«ç¬Šå·ãªãã®æ°å€ãŸãã¯æ£ã®å€ãå°å·ãããšãæ°å€ã®æåã®æ¡ã衚瀺ãããŸãã
#include <UTFT.h> UTFT myGLCD(CTE32HR,25,26,27,28); extern uint8_t BigFont[]; void setup() { myGLCD.InitLCD(); myGLCD.clrScr(); myGLCD.setFont(BigFont); } void loop() { byte X=100; byte Y=10; int Num1 = 1234; int Num2 = -1234; unsigned int Num3= 12345; myGLCD.printNumI(Num1,X,Y); Y=Y+myGLCD.getFontYsize(); myGLCD.printNumI(Num2,X,Y); Y=Y+myGLCD.getFontYsize(); myGLCD.printNumI(Num3,X,Y); }
å°å·ãããå€ã¯ãæŽæ°ãšããŠéä¿¡ããããšãã§ããŸãïŒ
myGLCD.printNumI(1250,0,0);
ãŸãã¯æŽæ°åã®ããããã®å€æ°ïŒ
int Num = 1324;
myGLCD.printNumI(Num,0,0);
æŽæ°å€ã§ããä»»æã®é¢æ°ãŸãã¯åŒã®çµæãåºåããããšãå¯èœã§ãïŒæŽæ°å€ã䜿çš
myGLCD.printNumI(myGLCD.getFontYsize()*2,0,0);
ããå ŽåãArduino DUEã§ã¯intåãâ2,147,483,648ãã2,147,483,647ãŸã§ã®èš±å®¹å€ã®ç¯å²ãæã€4ãã€ãæ°ã®åœ¢åŒã®longåã
unsigned intããã³unsigned longåã¯ãprintNumIã³ãã³ãã§ã¯ãµããŒããããŠããŸãããã€ãŸããå€ã¯ã³ãã³ãã«æž¡ãããšãã§ããŸããã笊å·ä»ãã®æ°å€ãšããŠè¡šç€ºãããŸããéã«ãcharåã¯ç¬Šå·ãªããšããŠæ±ãããŸãã
ãã®ã³ãã³ãã®è¿œå ã®ãªãã·ã§ã³ãã©ã¡ãŒã¿ã䜿çšãããšãæ°å€ãåºåããããã®åœ¢åŒãèšå®ã§ããŸããé·ããã©ã¡ãŒã¿ãŒã¯ããã£ã¹ãã¬ã€ã«è¡šç€ºãããæ°åãå ããæå°æåæ°ïŒæ°åã®ç¬Šå·ãå«ãïŒã決å®ããŸããæ°å€ã®ãããæ°ãæå®ãããé·ãã®å€ããå°ããå Žåãäžè¶³ããŠããæåæ°ã¯ãå·ŠåŽã®å¿ èŠãªæåæ°ã§è£ãããŸãããã£ã©ãŒãã©ã¡ãŒã¿ã䜿çšãããšãæ°åãè£ãæåïŒããã©ã«ãã§ã¯ã¹ããŒã¹ïŒãæå®ã§ããŸãããããã®æåã®çµã¿åããã«ãããç¹ã«ãæéãŸãã¯æ¥ä»ãåºåãããšãã«ãå³ã®å¢çã«é 眮ãããæ°å€ã®åºåãæŽçããããæå³ã®ãªããŒãã§å€ãè£ã£ããããããšãã§ããŸããã€ãŸããéåžžã®æ§é ã§ã¯ãªãã
byte Day = 2;
byte Month = 9;
int Year = 2013;
if (Day<10){
myGLCD.print("0",0,0);
myGLCD.printNumI(Day,16,0);
}else{
myGLCD.printNumI(Day,0,0);}
myGLCD.print(".", 32,0);
if (Month<10){
myGLCD.print("0",48,0);
myGLCD.printNumI(Month,64,0);
}else{
myGLCD.printNumI(Month,48,0,2,'0');}
myGLCD.print(".", 80,0);
myGLCD.printNumI(Year,96,0);
åã«æžãããšãã§ã
byte Day = 2;
byte Month = 9;
int Year = 2013;
myGLCD.printNumI(Day,0,0,2,'0');
myGLCD.print(".", 32,0);
myGLCD.printNumI(Month,48,0,2,'0');
myGLCD.print(".", 80,0);
myGLCD.printNumI(Year,96,0);
ãŸããããã»ã©è¯ããªãã§ããïŒ
printNumF-å®æ°ãŸãã¯å®æ°åã®å€æ°ã®å 容ã衚瀺ããŸããåºåå€ãå°æ°ç¹ä»¥äžã®æåæ°ãããã³å°å·é åã®å·Šäžé ã®åº§æšããã©ã¡ãŒã¿ãŒãšããŠæž¡ãããŸãããªãã·ã§ã³ã®ãã©ã¡ãŒã¿ãŒã䜿çšãããšãåºå圢åŒãå¶åŸ¡ã§ããŸãã
å°å·åº§æšã¯ãä»ã®å°å·ã³ãã³ããšåãæ¹æ³ã§èšå®ãããŸãã衚瀺ãããå®éã®å€ã¯ãæ°å€ãå®æ°åã®å€æ°ïŒæµ®åå°æ°ç¹æ°ïŒãããã³å®éã®çµæãŸãã¯åŒïŒçµæã¯å®æ°ïŒãè¿ãé¢æ°ãšããŠæå®ã§ããŸãã
å°æ°ç¹ä»¥äžã®æåæ°ã¯1ã5ã«èšå®ã§ããŸãããŒãå€ã¯èš±å¯ãããŸããïŒãã®å ŽåãæŽæ°åã«æ°å€ããã£ã¹ãããŠprintNumIã³ãã³ãã䜿çšããããšããå§ãããŸãïŒãããšãã°ã次ã®ã³ãã³ãïŒ
myGLCD.printNumF(-234.3442, 2, 0, 0);
â234.34ã®æ°å€ã衚瀺ã§ããŸãã
æ°å€ã¯ææ°åœ¢åŒãšãæµ®åå°æ°ç¹ã圢åŒã®äž¡æ¹ã§æå®ã§ããŸãããåºåã¯ãæµ®åå°æ°ç¹ã圢åŒã«ãªããŸããããšãã°ã2ã€ã®ã³ãã³ãïŒ
myGLCD.printNumF(-2.343442E2, 2, 0, 0);
myGLCD.printNumF(-234.3442, 2, 0, 0);
åãå€ã衚瀺â234.34
ãªãã·ã§ã³ã®Divider ãã©ã¡ãŒã¿ãŒã䜿çšãããšãå°æ°ç¹ãšããŠæ©èœããæåãåå®çŸ©ã§ããŸãïŒããã©ã«ãã¯ãããã§ãïŒãããšãã°ã次ã®ã³ãã³ãã
myGLCD.printNumF(-234.3442, 2, 0, 0, ',');
䜿çšãããšãå°æ°ç¹èšå·ãã³ã³ãã«çœ®ãæããããšãã§ããŸãããã®å Žåããã¡ãããæéã䜿çšããŠããã°ã©ã ã«æ°å€ãå ¥åããå¿ èŠããããŸãã眮æã¯åºåã«ã®ã¿åœ±é¿ããŸãã
ãªãã·ã§ã³ã®é·ãããã³ãã£ã©ãŒãã©ã¡ãŒã¿ã¯ãprintNumFã³ãã³ããšåæ§ã«æ©èœããæ°åã衚瀺ãããšãã«æå°æåæ°ãå¶åŸ¡ã§ããŸããé·ããã©ã¡ãŒã¿ã¯ã笊å·ãæŽæ°éšãå°æ°ç¹ãå°æ°éšãå«ãã衚瀺ãããæ°åãå ãããã¹ãŠã®æåãèæ ®ããŸããããšãã°ã次ã®ã³ãã³ã
myGLCD.printNumF(-234.3442, 2, 0, 0, '.', 10, '0');
ã¯ãçªå·â000234.34ïŒèŠªãã¿ãããã®åèšæ°ã10ã«ãªãããã«3ã€ã®ç¡æå³ãªãŒãã§è£ãããå ã®æ°ïŒã衚瀺ããŸãã
泚æïŒãªãã·ã§ã³ã®é·ããã©ã¡ãŒã¿ãŒã䜿çšããå Žåãdividerãã©ã¡ãŒã¿ãŒãèšå®ããå¿ èŠããããŸããèšå®ããªãå Žåãã·ã¹ãã ã¯é·ãã®å€ãåºåãæåã³ãŒããšããŠè§£éããããšãããããäºæž¬ã§ããªãçµæãçããå¯èœæ§ããããŸãã
次ã«ããã£ã¹ãã¬ã€äžã«ã°ã©ãã£ãã¯ããªããã£ãã衚瀺ã§ããã³ãã³ãã®ã°ã«ãŒãïŒãã€ã³ããã©ã€ã³ãé·æ¹åœ¢ãåïŒã«é²ã¿ãŸãããã
drawPixel-ãããã衚瀺ããŸãããã€ã³ãã®è²ã¯ãsetColorïŒïŒã³ãã³ãã§èšå®ãããçŸåšã®è²ã®å€ã«ãã£ãŠæ±ºãŸããŸãã
Xããã³Y座æšã¯ãã©ã¡ãŒã¿ãŒãšããŠæž¡ãããŸãã
ãã©ã¡ãŒã¿ãŒã¯ãæ°å€ãå€æ°ãé¢æ°ãŸãã¯åŒã®çµæã§æå®ã§ããŸãããã©ã¡ãŒã¿ã¯å®æ°ã§ãããŸããŸããããå°æ°éšåã¯ç Žæ£ãããŸãããŸãããã€ã³ãã®åº§æšããã£ã¹ãã¬ã€ãè¶ ããªãããšã確èªããå¿ èŠããããŸããããããªããšããã€ã³ãã衚瀺ãæ£ç¢ºã«æåŸ ããå Žæã«ãªããªãå¯èœæ§ããããŸããïŒ
drawPixelã³ãã³ãã®äœ¿çšäŸ-次ã®æ§æã§ã¯ãå¥ã ã®ãã€ã³ãããæ§ç¯ãããæ£åŒŠæ³¢ã衚瀺ãã
for (int x=0; x<48; x++) {
int y=(sin(x)*10)+100;
myGLCD.drawPixel(x*10,320-y);
ãŸãã次ã®ã³ãã³ãã°ã«ãŒãã§ã¯ã衚瀺ãããFigureã®ãµã€ãºã決å®ãã2ã€ã®ãã€ã³ãã®åº§æšããã©ã¡ãŒã¿ãŒãšããŠå¿ èŠã§ãã
drawLine-å§ç¹ãšçµç¹ã®åº§æšã§æå®ãããç·ã衚瀺ããŸãã
ç·ã®æç»ã®æ¹åã¯ãéå§ç¹ãšçµäºç¹ã®äœçœ®ã«ãã£ãŠç°ãªããŸããããšãã°ãç·ïŒ
myGLCD.drawLine(10,20,100,200);
æåã®ç¹ã®åº§æšãX = 10ãY = 20ã2çªç®ã®ç¹ãX = 100ãY = 200ã®ç¹ã®éã«çŸåšã®è²ãæç»ããŸããè¡ïŒ
myGLCD.drawLine(100,200,10,20);
åããã€ã³ãéã«ãŸã£ããåãç·ãæç»ããŸãããæç»ã®æ¹åã¯éã«ãªããŸãã
drawRect-å察åŽã®2ã€ã®è§ã®åº§æšã§å®çŸ©ãããé·æ¹åœ¢ã衚瀺ããŸãã
座æšã¯ãdrawLineã³ãã³ããšåãæ¹æ³ã§èšå®ãããŸãã
drawRoundRect-å察åŽã®2ã€ã®è§ã®åº§æšãæå®ãããšãè§ãäžžãé·æ¹åœ¢ã衚瀺ããŸãã
é·æ¹åœ¢ã®èŸºã®æå°ãµã€ãºã¯5ãã¯ã»ã«ã«å¶éãããŠããŸããå°ãã蟺ãæå®ãããšãé·æ¹åœ¢ã衚瀺ã§ããŸããã
fillRect-å察åŽã®2ã€ã®è§ã®åº§æšã§å®çŸ©ãããå¡ãã€ã¶ãããé·æ¹åœ¢ã衚瀺ããŸãã
åè§åœ¢ãæç»ãããçŸåšã®è²ã§å¡ãã€ã¶ãããŸãã
fillRoundRect-å察åŽã®2ã€ã®è§ã®åº§æšãæå®ãããšãè§ãäžžãå¡ãã€ã¶ãããé·æ¹åœ¢ã衚瀺ããŸãã
ãã®ã³ãã³ãã¯ãdrawRoundRectã³ãã³ããšåãããã«æ©èœããŸãã
次ã®2ã€ã®ã³ãã³ãã¯ãåãšåãæãããã®ãã®ã§ã3ã€ã®ãã©ã¡ãŒã¿ãŒãå¿ èŠã§ããåïŒãŸãã¯åïŒã®äžå¿ã®Xããã³Y座æšãšååŸã
drawCircle-äžå¿ãšååŸã®åº§æšã§å®çŸ©ãããåã衚瀺ããŸãã
ãã®å Žåãåã®ååŸã¯æ£ãã衚瀺ãããªããããè² ã®å€ãåãããšã¯ã§ããŸããã
次ã®ã³ãã³ãã¯ãååŸã50ãã¯ã»ã«ã®åãšã座æšX = 100ããã³Y = 120ã®ç¹ã«äžå¿ã衚瀺ããŸãã
drawCircle(100,120,50);
fillCircle-çŸåšã®è²ã§å¡ãã€ã¶ãããåã衚瀺ããŸããäžå¿ãšååŸã®åº§æšã«ãã£ãŠæ±ºå®ãããŸãã
è² ã®ååŸå€ã®å Žåãåã¯è¡šç€ºãããŸããã
ããã§ãã°ã©ãã£ãã¯ããªããã£ããæç»ããããã®ã³ãã³ãã調ã¹ãŸããããšããã§ãUTFTã©ã€ãã©ãªã«ã¯ãUTFT_Geometryã¢ããªã³ããããŸããããã«ãããäžè§åœ¢ïŒèŒªéãšå¡ãã€ã¶ãïŒãå匧ãåã»ã¯ã¿ãŒã衚瀺ã§ããŸãã次ã®ããããã®èšäºã§ããã®ã¢ããªã³ã®äœ¿çšãæ€èšããŸãã
æ®ãã¯ã»ãšãã©ãããŸãããç¹å¥ã«æºåãããã©ã¹ã¿ãŒã€ã¡ãŒãžããã£ã¹ãã¬ã€ã«è¡šç€ºã§ãã2ã€ã®ã³ãã³ã
drawBitmap-ç¹å¥ã«æºåãããã©ã¹ã¿ãŒã°ã©ãã£ãã¯ã€ã¡ãŒãžããã£ã¹ãã¬ã€ã«è¡šç€ºããŸãã
ãã©ã¡ãŒã¿ãŒã¯ãç»åã®å·Šäžé ã®åº§æšããã®å¯žæ³ãããã³ãšã³ã³ãŒããããç»åãä¿åãããŠããé åã®ååã§ãã
ãªãã·ã§ã³ã®ãã©ã¡ãŒã¿ãŒscaleã䜿çšãããšã衚瀺æã®ç»åã®ã¹ã±ãŒãªã³ã°ãå¶åŸ¡ã§ããŸãã
ãã®ã³ãã³ãã®ã€ã¡ãŒãžã¯ãã©ã€ãã©ãªã«ä»å±ããToolsãã©ã«ããŒã«ããç¹å¥ãªãŠãŒãã£ãªãã£ImageConverter565.exeã䜿çšããŠæºåãããŸãããããŠãããã§ãªã³ã©ã€ã³ç»åå€æãµãŒãã¹ã䜿çšã§ããŸãïŒ
http : //www.henningkarlsen.com/electronics/t_imageconverter565.php
ã³ã³ããŒã¿ãŒã¯jpgãpngãgifãã¡ã€ã«åœ¢åŒã§åäœããŸãã
äŸãšããŠãããããããç»åãšãã®èæ¯ã«ããã¹ãã¡ãã»ãŒãžã衚瀺ããã¿ã¹ã¯ãèããŸãããã¡ããããµã€ãºã480x320ãã¯ã»ã«ã®èæ¯ç»åã¯ãã³ã³ãããŒã©ãŒã®ã¡ã¢ãªã«èš±å®¹ã§ããªãã»ã©å€§ããªã¹ããŒã¹ã䜿çšããããã2åïŒ240x160ãã¯ã»ã«ïŒçž®å°ããç»åã䜿çšããŠã¹ã±ãŒãªã³ã°ã䜿çšããŸãã
ã€ã¡ãŒãžãæºåããã«ã¯ãImageConverter565.exeãã¡ã€ã«ãå®è¡ããã€ã¡ãŒãžãå«ããã¡ã€ã«ãéãå¿ èŠããããŸãã次ã«ãããµã€ãºãçž®å°ããã©ã°ãèšå®ããå¿ èŠãªç»åãµã€ãºïŒ240x160ïŒãèšå®ããŸãã ãååãä»ããŠä¿åãã¹ã€ããã§ã.cããéžæãããã¿ãŒã²ããããŒããã¹ã€ããã§ãchipKit / Arduino DueããéžæããŸãã ãé ååããã£ãŒã«ãã§ãç»åã®ååãèšå®ãããä¿åããã¯ãªãã¯ããŸãã
ã³ã³ããŒã¿ãŒã®çµæãæ¡åŒµåã.cã®ãã¡ã€ã«ãååŸãããŸãããã®ãã¡ã€ã«ã«ã¯ãç»åãšãšã³ã³ãŒããããç»åã«é¢ããæ å ±ãä¿åãããŸãããã®ãã¡ã€ã«ã¯ãããžã§ã¯ãã®ãã©ã«ããŒã«é 眮ãããã©ã³ãã§è¡ã£ãã®ãšåãæ¹æ³ã§externæå®åã䜿çšããŠé åãããã°ã©ã ã§å®£èšããå¿ èŠããããŸãã 16é²åœ¢åŒã§é åã®ãµã€ãºã瀺ãå¿ èŠãããã®ã¯è§æ¬åŒ§ã®ã¿ã§ãïŒãã®å€ã¯é åã®æåã®èŠçŽ ã«ãããããã¹ããšãã£ã¿ãŒã§çµæã®ãã¡ã€ã«ãéããšç¢ºèªã§ããŸãïŒã
ã¢ã¬ã€ãã³ããŒããŠæ¥ç¶ããåŸã¯ãå¿ ãããã°ã©ã ãã¡ã€ã«ãéããŠéãçŽããŠãã ããããã®å Žåãé åãã¡ã€ã«ã¯ããã°ã©ã ããã¹ãã®é£ã®æ¬¡ã®ã¿ãã§éããŸããããã°ã©ã ã®ããã¹ãã¯æ¬¡ã®ããã«ãªããŸãã
#include <UTFT.h> UTFT myGLCD(CTE32HR,25,26,27,28); extern uint8_t BigFont[]; extern unsigned short background[0x9600]; void setup() { myGLCD.InitLCD(); myGLCD.setColor(0,255,0); myGLCD.setFont(BigFont); myGLCD.setBackColor(VGA_TRANSPARENT); } void loop() { myGLCD.drawBitmap (0,0, 240, 160, background,2); myGLCD.print("Hello, World!", CENTER,50); while(1); }
ãããã£ãŠãåºåã240 x 160ãã¯ã»ã«ã®ååã®èæ¯ãæã€é åã«é 眮ãããç»åã®ãã£ã¹ãã¬ã€ã®å·Šäžé ã«èšå®ããŸãããã¹ã±ãŒã«ãã©ã¡ãŒã¿ïŒ2ïŒã䜿çšãããããç»åã¯ãã£ã¹ãã¬ã€å šäœã«æ¡å€§ãããŸãã次ã«ãå°å·æã«èæ¯ã®ãéæ床ããæäŸãããVGA_TRANSPARENTããã©ã¡ãŒã¿ã䜿çšããŠãç»åã®äžã«ããã¹ãã¡ãã»ãŒãžã衚瀺ããŸããããªãç¡é§ã§ã-1æã®åçã ãã§çŽ100kbã§ãããçŸããã§ã;ïŒ
è¿œå ã®ãã©ã¡ãŒã¿ãŒãæå®ããŠãã®ã³ãã³ããåŒã³åºãå¥ã®åœ¢åŒãå¯èœã§ãããç¹å®ã®è§åºŠã§ç»åãå転ãããããšãã§ããŸãããã®å Žåã3ã€ã®ãã©ã¡ãŒã¿ãŒãå¿ èŠã§ããdeg-ç»åã®å転è§åºŠrox-å転äžå¿ã®X座æšãroy-å転äžå¿ã®Y座æšå転è§åºŠã¯åºŠïŒ0ã359ïŒã§æå®ãããå転ã®äžå¿roxãšroyã®åº§æšã¯ç»åã®å·Šäžé ããã«ãŠã³ããããŸããäŸãèããŠã¿ãŸããããã©ã€ãã©ãªã«ä»å±ããinfo.cãã¡ã€ã«ãç»åãšããŠäœ¿çšããŸãïŒã©ã€ãã©ãªã«ãŒããã©ã«ããŒã®/ examples / ArduinoïŒARMïŒ/ UTFT_Bitmapãµããã©ã«ããŒã«ãããŸãïŒãç»åã®ãµã€ãºã¯32x32ãã¯ã»ã«ã§ãé åã®ãµã€ãºã¯0x400ã§ãã次ã®ããã°ã©ã ã¯ã軞ãäžå¿ã«å転ããç»åã衚瀺ããŸãã
#include <UTFT.h> UTFT myGLCD(CTE32HR,25,26,27,28); extern uint8_t BigFont[]; extern unsigned short info[0x400]; void setup() { myGLCD.InitLCD(); myGLCD.fillScr(VGA_WHITE); } void loop() { for (int R=0; R<360; R+=10){ myGLCD.drawBitmap (100,100, 32, 32, info,R,16,16); } }
æ®å¿µãªãããå転ãšã¹ã±ãŒãªã³ã°ãåæã«äœ¿çšããããšã¯ã§ããŸããã
æåŸã«ãããã«ããã€ãã®ã³ãã³ãïŒ
lcdOff-ãã£ã¹ãã¬ã€ããªãã«ããŸãããã©ã¡ãŒã¿ãŒã¯ãããŸããã
lcdOn-ãã£ã¹ãã¬ã€ããªã³ã«ããŸãããã©ã¡ãŒã¿ãŒã¯ãããŸããã
lcdOffïŒïŒã³ãã³ããå®è¡ããããšããã£ã¹ãã¬ã€ã¯ãªãã«ãªããlcdOnïŒïŒã³ãã³ããå®è¡ããããŸã§ã©ã®ã³ãã³ãã«ãå¿çããŸããã
éçºè ã«ãããšããããã®2ã€ã®ããŒã ã¯PCF8833ã³ã³ãããŒã©ãŒãåãããã£ã¹ãã¬ã€ã«ã®ã¿å®è£ ãããŠããããããã£ã¹ãã¬ã€ã§ã¯åã«ç¡èŠãããŸãã
setContrast-ãã£ã¹ãã¬ã€ã®ã³ã³ãã©ã¹ããèšå®ããŸãããã©ã¡ãŒã¿ã¯ã³ã³ãã©ã¹ãã®éã§ãã
ãã©ã¡ãŒã¿ãŒãšããŠããã£ã¹ãã¬ã€ã®ã³ã³ãã©ã¹ãã決å®ããæ¡ä»¶å€ãå®çŸ©ãããŸãïŒ0ïŒæå°ã³ã³ãã©ã¹ãïŒãã64ïŒæ倧ã³ã³ãã©ã¹ãïŒãŸã§ã
ãŸãããã®ã³ãã³ãã¯PCF8833ã³ã³ãããŒã©ãŒãåãããã£ã¹ãã¬ã€ã«ã®ã¿å®è£ ãããŠããããããã£ã¹ãã¬ã€ã§ã³ã³ãã©ã¹ãã®å€åã¯çºçãããã³ãã³ãã¯ç¡èŠãããŸãã
ãããã«
ããã§ãUTFTããŒã¹ã©ã€ãã©ãªã®ãã¹ãŠã®ã³ãã³ãã®äœ¿çšæ¹æ³ãåŠã³ãŸããã次ã®èšäºã§ã¯ããã®ã©ã€ãã©ãªãžã®è¿œå ã«ã€ããŠèª¬æããŸããããã«ãããæ©èœãæ¡åŒµãããŸãã次ã®ã¹ãããã¯ãã¿ããã¹ã¯ãªãŒã³ã§ã®äœæ¥ãããã³ã¿ããã¹ã¯ãªãŒã³ã§å¶åŸ¡ããããã£ã¹ãã¬ã€äžã®ããã¹ãããã³ã°ã©ãã£ãã¯ãã¿ã³ã§ã®äœæ¥ãšåæ§ã«ãäžè§åœ¢ãå匧ãããã³ã»ã¯ã¿ãŒã®æç»ã§ããå°æ¥çã«ã¯ããã£ã¹ãã¬ã€ã®çµã¿èŸŒã¿æ©èœãæ€èšããäºå®ã§ã-ãã£ã¹ãã¬ã€ã¢ãžã¥ãŒã«ã®å éšã¡ã¢ãªãROMã«çž«ãä»ãããããã©ã³ãããã³ã¢ã€ã³ã³ãæäœããŸãã