Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "math.h" 00003 #include "SDBlockDevice.h" 00004 #include "FATFileSystem.h" 00005 00006 00007 SDBlockDevice sd(p5, p6, p7, p8); 00008 FATFileSystem fs("sd"); 00009 00010 #include "tar.h" 00011 00012 00013 00014 00015 #include "ST7735.h" 00016 00017 ST7735 TFT(p5, p6, p7, p9, p10, p11); 00018 //ST7735 TFT(p11, p12, p13, p15, p16, p17); 00019 PwmOut TFT_BackLight(p25); 00020 00021 DigitalOut myled(LED1); 00022 DigitalOut myled2(LED2); 00023 DigitalOut myled4(LED4); 00024 00025 float p = 3.1415926; 00026 00027 Timer t; 00028 00029 extern int confSaber[]; 00030 extern int theme[]; 00031 extern int confSaber_mini[]; 00032 extern int theme_mini[]; 00033 00034 FILE * fp; 00035 00036 int main() 00037 { 00038 sd.init(); 00039 fs.mount(&sd); 00040 00041 myled2 = 1; 00042 00043 TFT_BackLight = 0; 00044 00045 TFT.initR(INITR_MINI160x80_RS); // INITR_MINI160x80 00046 00047 TFT.setRotation(2); 00048 TFT.fillScreen(ST7735_BLACK); 00049 TFT_BackLight = 1; 00050 00051 //fp = fopenTar("/sd/mydir/config.thm", "config.bmp"); 00052 //TFT.DrawBMP(0, 0, fp); 00053 //fclose(fp); 00054 00055 00056 int i = 1; 00057 while(0) { 00058 fp = fopen("/sd/mydir/cat.ani", "r"); 00059 TFT.DrawANI(0, 30, fp, i); 00060 fclose(fp); 00061 wait_ms(20); 00062 i++; 00063 if(i == 9) i = 1; 00064 } 00065 00066 00067 /* 00068 fp = fopen("/sd/mydir/test1_16.gif", "r"); 00069 TFT.DrawGIF(0, 0, fp); 00070 fclose(fp); 00071 00072 fp = fopen("/sd/mydir/test1_ff.gif", "r"); 00073 TFT.DrawGIF(40, 0, fp); 00074 fclose(fp); 00075 00076 fp = fopen("/sd/mydir/test2_4.gif", "r"); 00077 TFT.DrawGIF(0, 80, fp); 00078 fclose(fp); 00079 00080 fp = fopen("/sd/mydir/test2_16.gif", "r"); 00081 TFT.DrawGIF(40, 80, fp); 00082 fclose(fp); 00083 00084 fp = fopenTar("/sd/mydir/config.thm", "test1_16.gif"); 00085 TFT.DrawGIF(20, 0, fp); 00086 fclose(fp);*/ 00087 00088 00089 TFT.fillCircle(10, 10, 5, ST7735_RED); 00090 TFT.fillCircle(150, 10, 5, ST7735_GREEN); 00091 TFT.fillCircle(150, 70, 5, ST7735_BLUE); 00092 TFT.fillCircle(10, 70, 5, ST7735_WHITE); 00093 00094 00095 for ( int i=0; i<360; i+=10 ) { 00096 TFT_BackLight = cos( i*2.0*3.14/360 ) * 0.5 + 0.5; 00097 wait(0.1); 00098 } 00099 00100 TFT.setCursor(0, 0); 00101 TFT.setTextColor(ST7735_WHITE); 00102 TFT.setTextWrap(true); 00103 TFT.write("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur adipiscing ante sed nibh tincidunt feugiat. Maecenas enim massa, fringilla sed malesuada et, malesuada sit amet turpis. Sed porttitor neque ut ante pretium vitae malesuada nunc bibendum. Nullam aliquet ultrices massa eu hendrerit. Ut sed nisi lorem. In vestibulum purus a tortor imperdiet posuere. ", 0xffff); 00104 00105 //wait(1); 00106 00107 //tftPrintTest(); 00108 00109 /* 00110 t.start(); 00111 fp = fopenTar("/sd/mydir/config.thm", "config.bmp"); 00112 TFT.DrawBMP(0, 0, fp); 00113 t.stop(); 00114 fclose(fp); 00115 printf("config TAR : %f seconds sur SD\n", t.read()); 00116 t.reset(); 00117 00118 00119 t.start(); 00120 fp = fopenTar("/sd/mydir/config.thm", "main.bmp"); 00121 TFT.DrawBMP(0, 80, fp); 00122 t.stop(); 00123 fclose(fp); 00124 printf("config TAR : %f seconds sur SD\n", t.read()); 00125 t.reset(); 00126 */ 00127 00128 /* 00129 wait(1); 00130 t.start(); 00131 fp = fopen("/sd/mydir/tour.bmp", "r"); 00132 TFT_BackLight = 0; 00133 TFT.DrawBMP(0, 0, fp); 00134 TFT_BackLight = 1; 00135 t.stop(); 00136 fclose(fp); 00137 printf("Tour : %f seconds sur SD\n", t.read()); 00138 t.reset(); 00139 00140 t.start(); 00141 fp = fopen("/sd/mydir/test2.bmp", "r"); 00142 TFT.DrawBMP(0, 0, fp); 00143 t.stop(); 00144 fclose(fp); 00145 printf("coeur : %f seconds sur SD\n", t.read()); 00146 t.reset(); 00147 */ 00148 00149 00150 //wait(1); 00151 //TFT.fillScreen(ST7735_BLACK); 00152 //TFT.DrawStarfield(80, 40, 1, 0, 300, 4); 00153 //TFT.fillScreen(ST7735_BLACK); 00154 00155 wait(1); 00156 TFT.DrawRam(11, 52, 57, 57, confSaber); 00157 TFT.drawFastHLine(0, 0, 80, ST7735_GREEN); 00158 wait(1); 00159 TFT.scrollBmp(0, 0, BOTTOM_TO_TOP, theme); 00160 wait(1); 00161 TFT.scrollBmp(0, 0, TOP_TO_BOTTOM, confSaber); 00162 00163 00164 /* 00165 wait(1); 00166 TFT.drawFastHLine(0, 14, 80, 0x2104); 00167 TFT.DrawRam(1, 1, 11, 11, confSaber_mini); 00168 wait(1); 00169 TFT.scrollBmp(15, 0, BOTTOM_TO_TOP, theme); 00170 wait(1); 00171 TFT.scrollBmp(15, 0, TOP_TO_BOTTOM, confSaber); 00172 TFT.drawFastHLine(0, 146, 80, 0x2104); 00173 TFT.DrawRam(1, 148, 11, 11, theme_mini); 00174 wait(1); 00175 TFT.scrollBmp(15, 15, BOTTOM_TO_TOP, theme); 00176 wait(1); 00177 TFT.scrollBmp(15, 15, TOP_TO_BOTTOM, confSaber); 00178 */ 00179 00180 while(1) { 00181 myled = 1; 00182 wait(1); 00183 myled = 0; 00184 wait(1); 00185 } 00186 }
Generated on Tue Jul 12 2022 15:05:43 by
1.7.2