diff --git a/build-number.txt b/build-number.txt index 3bb8a49..68cfb10 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -464 +472 diff --git a/src/main.c b/src/main.c index c355ecf..fe1367c 100755 --- a/src/main.c +++ b/src/main.c @@ -26,7 +26,7 @@ int main(void) while(!Camera_Captured); extern uint8_t ImageBuffer[CAMERA_IMAGE_WIDTH * CAMERA_IMAGE_HEIGHT / 8]; - Print_Image(ImageBuffer, CAMERA_IMAGE_WIDTH, CAMERA_IMAGE_HEIGHT); + Print_Image(ImageBuffer, CAMERA_IMAGE_WIDTH, CAMERA_IMAGE_HEIGHT, 2); for(;;) { diff --git a/src/ov7670.h b/src/ov7670.h index e7ea706..254ce7f 100644 --- a/src/ov7670.h +++ b/src/ov7670.h @@ -3,7 +3,7 @@ #include #include "stm32f1xx.h" -#define CAMERA_IMAGE_WIDTH 176 +#define CAMERA_IMAGE_WIDTH 160 #define CAMERA_IMAGE_HEIGHT 144 extern volatile int Camera_Captured; diff --git a/src/print.c b/src/print.c index f75eba1..fc19327 100644 --- a/src/print.c +++ b/src/print.c @@ -39,27 +39,35 @@ void Print_Text(const char *text, const Font_t *font) } // Width needs to be divisible by 8 -void Print_Image(const uint8_t *data, int width, int height) +void Print_Image(const uint8_t *data, int width, int height, int scale) { int currentline = 0; while(height) { - int lines = PRINT_BUFFER_LINES; + int lines = PRINT_BUFFER_LINES / scale; if(height < lines) { lines = height; } - for(int i = 0; i < lines; i++) + memset(Print_Buffer, 0, sizeof(Print_Buffer)); + + for(int i = 0; i < lines * scale; i++) { - memcpy(Print_Buffer + i * LTP1245_LINE_BYTES, - data + currentline * width / 8, - width / 8); - memset(Print_Buffer + width / 8, 0, LTP1245_LINE_BYTES - width / 8); + for(int j = 0; j < width * scale; j++) + { + int black = data[(currentline / scale * width + j / scale) / 8] + & (0x80 >> ((j / scale) % 8)); + if(black) + { + Print_Buffer[i * LTP1245_LINE_BYTES + j / 8] |= + (0x80 >> (j % 8)); + } + } currentline++; } - LTP1245_Print(Print_Buffer, lines); + LTP1245_Print(Print_Buffer, lines * scale); height -= lines; } diff --git a/src/print.h b/src/print.h index 2d61190..168594d 100644 --- a/src/print.h +++ b/src/print.h @@ -8,4 +8,4 @@ #define PRINT_BUFFER_LINES 64 void Print_Text(const char *text, const Font_t *font); -void Print_Image(const uint8_t *data, int width, int height); \ No newline at end of file +void Print_Image(const uint8_t *data, int width, int height, int scale); \ No newline at end of file