cauqleuir madre
Dependencies: SDFileSystem mbed TFTLCD
imaginator.cpp@56:51410b4b1078, 2013-02-02 (annotated)
- Committer:
- Danton
- Date:
- Sat Feb 02 18:54:33 2013 +0000
- Revision:
- 56:51410b4b1078
- Child:
- 57:ed9db2bcd1bf
before I rearreange the code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Danton | 56:51410b4b1078 | 1 | #include "imaginator.h" |
Danton | 56:51410b4b1078 | 2 | void superDisplay() |
Danton | 56:51410b4b1078 | 3 | { |
Danton | 56:51410b4b1078 | 4 | HX8340S_LCD lcd( p9, p14, p13, p11); |
Danton | 56:51410b4b1078 | 5 | lcd.Initialize(); |
Danton | 56:51410b4b1078 | 6 | lcd.ClearScreen(); |
Danton | 56:51410b4b1078 | 7 | } |
Danton | 56:51410b4b1078 | 8 | void superSd(unsigned char*buffer,unsigned int *offset,int bytes,const char *path) |
Danton | 56:51410b4b1078 | 9 | { |
Danton | 56:51410b4b1078 | 10 | SDFileSystem sd(p11, p12, p13, p8, "sd"); // the pinout on the mbed Cool Components workshop board |
Danton | 56:51410b4b1078 | 11 | FILE *fp =fopen(path, "r"); |
Danton | 56:51410b4b1078 | 12 | |
Danton | 56:51410b4b1078 | 13 | if(fp == NULL) { |
Danton | 56:51410b4b1078 | 14 | error("Could not open file\c\n"); |
Danton | 56:51410b4b1078 | 15 | } |
Danton | 56:51410b4b1078 | 16 | fseek(fp, *offset,SEEK_SET); |
Danton | 56:51410b4b1078 | 17 | *offset=*offset+bytes; |
Danton | 56:51410b4b1078 | 18 | fread((char*)buffer,1,bytes,fp); |
Danton | 56:51410b4b1078 | 19 | fclose(fp); |
Danton | 56:51410b4b1078 | 20 | |
Danton | 56:51410b4b1078 | 21 | } |
Danton | 56:51410b4b1078 | 22 | void colorCompute(unsigned char*buffer, int* colorBuffer,int sizeOfBuffer) |
Danton | 56:51410b4b1078 | 23 | { |
Danton | 56:51410b4b1078 | 24 | int j=0; |
Danton | 56:51410b4b1078 | 25 | for(int i=0;i<sizeOfBuffer;i=i+4) |
Danton | 56:51410b4b1078 | 26 | { |
Danton | 56:51410b4b1078 | 27 | colorBuffer[j]=RGB((buffer[i+2]),(buffer[i+1]),(buffer[i])); |
Danton | 56:51410b4b1078 | 28 | j++; |
Danton | 56:51410b4b1078 | 29 | } |
Danton | 56:51410b4b1078 | 30 | } |
Danton | 56:51410b4b1078 | 31 | void pickUpLine(unsigned char*buffer, int* colorBuffer,int sizeOfBuffer,int sizeOfLine,const char *path, unsigned int *absPtr) |
Danton | 56:51410b4b1078 | 32 | { |
Danton | 56:51410b4b1078 | 33 | superSd(buffer,absPtr,sizeOfBuffer,path); |
Danton | 56:51410b4b1078 | 34 | colorCompute(buffer,colorBuffer,sizeOfBuffer); |
Danton | 56:51410b4b1078 | 35 | } |