![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
it works!
Dependencies: SDFileSystem2 mbed
Fork of manworm_tv_raster by
Diff: main.cpp
- Revision:
- 16:1f728d08b3a7
- Parent:
- 14:5ee7843f2805
--- a/main.cpp Sun Sep 30 18:09:24 2018 +0000 +++ b/main.cpp Thu Oct 04 12:37:25 2018 +0000 @@ -1,7 +1,6 @@ #include "mbed.h" #include <math.h> #include "main.h" -#include "face.h" #include "SDFileSystem.h" #define TEXT_LEVEL 5 @@ -20,8 +19,6 @@ uint8_t char_col = 0; // current column counter uint8_t char_row = 0; // current row counter -uint8_t vsync = 0; - Serial pc(USBTX, USBRX); #include "vincent_data.h" @@ -116,14 +113,12 @@ vptr = bl_line_v; sptr = im_line_s; nop = 1; - vsync = 0; } else if (l < YL + V_PORCH_SIZE) { vptr = im_line_va + (l - 30) * H_RES; sptr = im_line_s; nop = 1; img = 1; - vsync = 0; } else if (l < 254) { vptr = bl_line_v; @@ -159,14 +154,14 @@ GPIOA->ODR = sptr[i] << 4; asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop"); - asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop"); + asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop"); + asm("nop");asm("nop");asm("nop");asm("nop"); } } //move to next line l++; tics++; - if(l == V_RES) vsync = 1; if(l > 255) l = 0; } @@ -244,26 +239,12 @@ FILE *fp; - //test code - write an image to the SD card - //fp = fopen("/sd/man.worm", "wb"); - //for(int x = 0; x < XL; x += 2) - //{ - // for(int y = 0; y < YL; y++) - // { - // current_frame[y][x / 2] = (splash[y][x] & 0xf0) + (splash[y][x + 1] >> 4); - // } - //} - //fwrite(current_frame, 1, VIDEO_FRAME_SIZE, fp); - //fclose(fp); - - fp = fopen("/sd/man.worm", "rb"); + fp = fopen("/sd/man.worm.starwars", "rb"); uint32_t old_tics = tics; for(;;) - { - if(!vsync) continue; - - //rewind(fp); + { + if (feof(fp)) rewind(fp); fread(current_frame, 1, VIDEO_FRAME_SIZE, fp); for(int x = 0; x < XL; x += 2) { @@ -284,9 +265,7 @@ char status_string[20]; sprintf(status_string, "%.1f", 15625.f / (float)(tics - old_tics)); old_tics = tics; - set_status_string(status_string); - - vsync = 0; + set_status_string(status_string); } }