cauqleuir madre
Dependencies: SDFileSystem mbed TFTLCD
main.cpp@18:724eb70c757e, 2013-02-02 (annotated)
- Committer:
- Danton
- Date:
- Sat Feb 02 00:47:15 2013 +0000
- Revision:
- 18:724eb70c757e
- Parent:
- 17:3d7951357fd3
- Child:
- 19:089c4027bfba
fixed seek
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Danton | 0:a11b3a90c259 | 1 | #include "mbed.h" |
Danton | 0:a11b3a90c259 | 2 | #include "SDFileSystem.h" |
Danton | 2:e205fa129def | 3 | #include "hx8340bs.h" |
Danton | 0:a11b3a90c259 | 4 | |
Danton | 15:3bfbb557020e | 5 | void superSd(unsigned char*buffer,int offset,const char *path) |
Danton | 15:3bfbb557020e | 6 | { |
Danton | 15:3bfbb557020e | 7 | SDFileSystem sd(p11, p12, p13, p8, "sd"); // the pinout on the mbed Cool Components workshop board |
Danton | 15:3bfbb557020e | 8 | FILE *fp =fopen("/sd/mydir/rose.bmp", "r"); |
Danton | 15:3bfbb557020e | 9 | |
Danton | 15:3bfbb557020e | 10 | if(fp == NULL) { |
Danton | 15:3bfbb557020e | 11 | error("Could not open file\c\n"); |
Danton | 15:3bfbb557020e | 12 | } |
Danton | 15:3bfbb557020e | 13 | //fprintf(fp, "Hello fun SD Card World!\c\n"); |
Danton | 15:3bfbb557020e | 14 | //fread ( void * ptr, size_t size, size_t count, FILE * stream ); |
Danton | 17:3d7951357fd3 | 15 | fseek(fp, offset,SEEK_SET); |
Danton | 15:3bfbb557020e | 16 | fread((char*)buffer,1,100,fp); |
Danton | 15:3bfbb557020e | 17 | fclose(fp); |
Danton | 15:3bfbb557020e | 18 | |
Danton | 15:3bfbb557020e | 19 | } |
Danton | 15:3bfbb557020e | 20 | void superDisplay(unsigned char*buffer,int offset,const char *path) |
Danton | 15:3bfbb557020e | 21 | { |
Danton | 15:3bfbb557020e | 22 | HX8340S_LCD lcd( p9, p14, p13, p11); |
Danton | 15:3bfbb557020e | 23 | lcd.Initialize(); |
Danton | 15:3bfbb557020e | 24 | lcd.ClearScreen(); |
Danton | 15:3bfbb557020e | 25 | lcd.FillScreen(COLOR_BLUE); |
Danton | 15:3bfbb557020e | 26 | lcd.Print(path, CENTER, 25 ); |
Danton | 15:3bfbb557020e | 27 | lcd.DrawBitmap(0,0,(bitmap_t*)buffer,1); |
Danton | 15:3bfbb557020e | 28 | } |
Danton | 0:a11b3a90c259 | 29 | |
Danton | 0:a11b3a90c259 | 30 | int main() { |
Danton | 6:ac9692245a01 | 31 | printf("Hello Stinky World!\c\n"); |
Danton | 0:a11b3a90c259 | 32 | |
Danton | 2:e205fa129def | 33 | //mkdir("/sd/mydir", 0777); |
Danton | 0:a11b3a90c259 | 34 | |
Danton | 15:3bfbb557020e | 35 | |
Danton | 6:ac9692245a01 | 36 | unsigned char bitmap[100]; |
Danton | 3:4a9643fb389c | 37 | int i=0; |
Danton | 15:3bfbb557020e | 38 | superSd(bitmap,0,"/sd/mydir/rose.bmp"); |
Danton | 6:ac9692245a01 | 39 | while(i<100) |
Danton | 3:4a9643fb389c | 40 | { |
Danton | 18:724eb70c757e | 41 | printf("%c",bitmap[i]); |
Danton | 3:4a9643fb389c | 42 | i++; |
Danton | 3:4a9643fb389c | 43 | } |
Danton | 15:3bfbb557020e | 44 | superDisplay(bitmap,0,"Hola imbecil"); |
Danton | 18:724eb70c757e | 45 | superSd(bitmap,100,"/sd/mydir/rose.bmp"); |
Danton | 15:3bfbb557020e | 46 | i=0; |
Danton | 18:724eb70c757e | 47 | printf("\n\n\n\n"); |
Danton | 15:3bfbb557020e | 48 | while(i<100) |
Danton | 15:3bfbb557020e | 49 | { |
Danton | 18:724eb70c757e | 50 | printf("%c\n",bitmap[i]); |
Danton | 15:3bfbb557020e | 51 | i++; |
Danton | 15:3bfbb557020e | 52 | } |
Danton | 17:3d7951357fd3 | 53 | superDisplay(bitmap,100,"Whats the != between 1&2"); |
Danton | 15:3bfbb557020e | 54 | |
Danton | 0:a11b3a90c259 | 55 | printf("Goodbye World!\c\n"); |
Danton | 0:a11b3a90c259 | 56 | } |