Esempio n. 1
0
void push_foo(void) {
	int i, j;
	// Ungerade Zeilen schieben
	for (j = 0; j < 32; j++) {
		for (i = 0; i < 38; i++) {
			send_pixel((char*)transfer_pixmap[(j*38)+i]);
			ftd = !ftd;
		}

		if (j == 31) {
			send_pixel_block_spacer(true, false);
		} else {
			send_pixel_block_spacer(false, false);
		}
	}

	// Gerade Zeilen schieben
	for (j = 0; j < 32; j++) {
		for (i = 0; i < 38; i++) {
			send_pixel((char*)transfer_pixmap[(j*38)+i+1216]);
		}

		if (j == 31) {
			send_pixel_block_spacer(true, true);
		} else {
			send_pixel_block_spacer(false, true);
		}
	}
}
Esempio n. 2
0
/**
 * Sends the spacer between the pixel blocks.
 *
 * @param endFullBlock true if it's the last block prior bank switching, false otherwise
 * @param odd true If odd rows needs to be filled, false otherwise.
 */
void send_pixel_block_spacer (bool endFullBlock, bool odd) {
	send_pixel(false);
	send_pixel(false);

	if (odd) {
		send_pixel(true);
	} else {
		send_pixel(false);
	}

	send_pixel(false);
	send_pixel(false);
	send_pixel(true);
	send_pixel(false);
	send_pixel(false);
	send_pixel(false);
	send_pixel(false);

	if (endFullBlock) {
		PORTC |= (1 << LINE6);
		_delay_us(2);
		PORTC &= ~(1 << LINE6);
		_delay_us(2);
	}
}
Esempio n. 3
0
static u08 load_data(FIL *fh,u16 xp, u16 yp)
{
  u08 result = CMD_OK;
  u16 x = 0;
  u16 y = 0;
  while(y < height) {
    
    // fetch partial pixel at the end of the buffer
    if(buf_avail < 3) {
      while(buf_avail > 0) {
        partial_rgb[partial_num] = buf[buf_pos];
        partial_num ++;
        buf_pos++;
        buf_avail--;
      }
    }
    
    // read a new buffer if the current one is empty
    // -> read from SD card
    if(buf_avail == 0) {
      result = fill_buffer(fh);
      if(result != CMD_OK) {
        return result;
      }
    }
    
    // do we have to fill the partial pixel with the fresh buffer?
    if(partial_num > 0) {
      // this only happens after an empty buffer
      while(partial_num < 3) {
        if(buf_avail == 0) {
          return PIC_READ_ERROR;
        }
        partial_rgb[partial_num] = buf[buf_pos];
        partial_num++;
        buf_pos++;
        buf_avail--;
      }
    }
    
    // calculate the number of pixels in the buffer
    // and the number of pixels fitting in the current line
    // -> use min of both
    u16 got_pixels = buf_avail / 3;
    if(partial_num > 0) {
      got_pixels ++;
    }
    u16 line_pixels = width - x;
    u16 draw_pixels;
    if(got_pixels < line_pixels) {
      draw_pixels = got_pixels;
    } else {
      draw_pixels = line_pixels;
    }
    
    // determine the display area (=line) for these pixels
    u16 x_end = x + draw_pixels - 1;
    display_set_area(xp + x, yp + y, xp + x_end, yp+y);
    display_draw_start();
    // send partial pixel first
    if(partial_num>0) {
      send_pixel(partial_rgb);
      draw_pixels--;
      partial_num = 0;
    }
    // now send buffer pixels
    for(u16 i=0;i<draw_pixels;i++) {
      const u08 *rgb = buf + buf_pos;
      send_pixel(rgb);
      buf_pos += 3;
      buf_avail -= 3;
    }
    display_draw_stop();

    // update draw location
    x = x_end + 1;
    if(x == width) {
      x = 0;
      y++;
    }
  }  
  return CMD_OK;
}