cauqleuir madre

Dependencies:   SDFileSystem mbed TFTLCD

main.cpp

Committer:
Danton
Date:
2013-02-02
Revision:
18:724eb70c757e
Parent:
17:3d7951357fd3
Child:
19:089c4027bfba

File content as of revision 18:724eb70c757e:

#include "mbed.h"
#include "SDFileSystem.h"
#include "hx8340bs.h"

void superSd(unsigned char*buffer,int offset,const char *path)
{
     SDFileSystem sd(p11, p12, p13, p8, "sd"); // the pinout on the mbed Cool Components workshop board
     FILE *fp =fopen("/sd/mydir/rose.bmp", "r");
   
    if(fp == NULL) {
        error("Could not open file\c\n");
    }
    //fprintf(fp, "Hello fun SD Card World!\c\n");
    //fread ( void * ptr, size_t size, size_t count, FILE * stream );
    fseek(fp, offset,SEEK_SET);
    fread((char*)buffer,1,100,fp);
    fclose(fp); 
     
}
void superDisplay(unsigned char*buffer,int offset,const char *path)
{
    HX8340S_LCD lcd( p9, p14, p13, p11);
    lcd.Initialize();
    lcd.ClearScreen();
    lcd.FillScreen(COLOR_BLUE); 
    lcd.Print(path, CENTER, 25 );
    lcd.DrawBitmap(0,0,(bitmap_t*)buffer,1);
}
 
int main() {
    printf("Hello Stinky World!\c\n");    
 
    //mkdir("/sd/mydir", 0777);
    
    
    unsigned char bitmap[100];
    int i=0;
    superSd(bitmap,0,"/sd/mydir/rose.bmp");
    while(i<100)
    {
        printf("%c",bitmap[i]);
        i++;
    }
    superDisplay(bitmap,0,"Hola imbecil");
    superSd(bitmap,100,"/sd/mydir/rose.bmp");
    i=0;
    printf("\n\n\n\n");
    while(i<100)
    {
        printf("%c\n",bitmap[i]);
        i++;
    }
    superDisplay(bitmap,100,"Whats the != between 1&2");

    printf("Goodbye World!\c\n");
}