Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void showButton(int yPlace, int xPlace){ // y = x && x = y
- short int file_handle, i, j, x, y;
- int color;
- file_handle = alt_up_sd_card_fopen("knopje.bmp", 0);
- if (file_handle >= 0) {
- // Skip header data
- short int read_byte;
- for(i = 0; i < 54 ; i++) {
- read_byte = alt_up_sd_card_read(file_handle);
- }
- // Read image
- for(j = 0; j < 16; j++) {
- for(i = 0; i < 16; i++) {
- read_byte = alt_up_sd_card_read(file_handle);
- x = read_byte;
- if( read_byte == -1 ) {
- printf("no bytes to read\n");
- break;
- }
- read_byte = alt_up_sd_card_read(file_handle);
- y = read_byte;
- color = (x << 8) | y;
- //color = x | (y << 8);
- //if (color != 0) printf("Color = %x\n", color);
- *(pixel_buffer + ((xPlace-j) << 9) + (i + yPlace)) = (unsigned int) color;
- }
- }
- } else {
- printf("Can't open button image\n");
- }
- alt_up_sd_card_fclose(file_handle);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement