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.
Dependencies: SDFileSystem mbed TFTLCD
imaginator.cpp
00001 #include "imaginator.h" 00002 void superDisplay() 00003 { 00004 HX8340S_LCD lcd( p9, p14, p13, p11); 00005 lcd.Initialize(); 00006 lcd.ClearScreen(); 00007 } 00008 void superSd(unsigned char*buffer,unsigned int *offset,int bytes,const char *path) 00009 { 00010 SDFileSystem sd(p11, p12, p13, p8, "sd"); // the pinout on the mbed Cool Components workshop board 00011 FILE *fp =fopen(path, "r"); 00012 00013 if(fp == NULL) { 00014 error("Could not open file\c\n"); 00015 } 00016 fseek(fp, *offset,SEEK_SET); 00017 *offset=*offset+bytes; 00018 fread((char*)buffer,1,bytes,fp); 00019 fclose(fp); 00020 return; 00021 } 00022 void colorCompute(unsigned char*buffer, int* colorBuffer,int sizeOfBuffer) 00023 { 00024 int j=0; 00025 for(int i=0;i<sizeOfBuffer;i=i+4) 00026 { 00027 colorBuffer[j]=RGB((buffer[i+2]),(buffer[i+1]),(buffer[i])); 00028 j++; 00029 } 00030 return; 00031 } 00032 void pickUpLine(unsigned char*buffer, int* colorBuffer,int sizeOfBuffer,int sizeOfLine,const char *path, unsigned int *absPtr) 00033 { 00034 superSd(buffer,absPtr,sizeOfBuffer,path); 00035 colorCompute(buffer,colorBuffer,sizeOfBuffer); 00036 return; 00037 } 00038 void drawLine(int* color,int y) 00039 { 00040 HX8340S_LCD lcd(p9, p14, p13, p11); 00041 DigitalOut scr(p9); 00042 scr=0; 00043 int k=0; 00044 for(int j=y;j<(16+y);j++) 00045 { 00046 for(int i=0;i<220;i++) 00047 { 00048 lcd.DrawPixel(i,j,color[k]); 00049 k++; 00050 } 00051 } 00052 scr=1; 00053 return; 00054 } 00055 void bmpFromSDToScreen(const char* path) 00056 { 00057 unsigned char rawbytes[14080]; 00058 int color[3520]; 00059 unsigned int absPtr=54; 00060 superDisplay(); 00061 for(int i=0;i<176;i=i+16) 00062 { 00063 pickUpLine(rawbytes,color,14080,3520,path,&absPtr); 00064 drawLine(color,i); 00065 } 00066 return; 00067 }
Generated on Thu Jul 14 2022 07:08:24 by
1.7.2