align to 1 fps
This commit is contained in:
parent
a2b7e26ace
commit
4816dae943
1 changed files with 6 additions and 1 deletions
|
@ -12,6 +12,9 @@
|
||||||
#define HEIGHT 32
|
#define HEIGHT 32
|
||||||
#define X_OFFSET ((128 - WIDTH) / 2)
|
#define X_OFFSET ((128 - WIDTH) / 2)
|
||||||
|
|
||||||
|
#define FPS 1
|
||||||
|
#define SYSTICKS_PER_FRAME ((DELAY_US_TIME * 1000000) / FPS)
|
||||||
|
|
||||||
void decode_next_frame();
|
void decode_next_frame();
|
||||||
void refresh_screen();
|
void refresh_screen();
|
||||||
void clear_screen();
|
void clear_screen();
|
||||||
|
@ -33,10 +36,12 @@ int main() {
|
||||||
ssd1306_cmd(*cmd_list++);
|
ssd1306_cmd(*cmd_list++);
|
||||||
clear_screen();
|
clear_screen();
|
||||||
|
|
||||||
|
u32 next_frame = SysTick->CNT;
|
||||||
while (1) {
|
while (1) {
|
||||||
decode_next_frame();
|
decode_next_frame();
|
||||||
|
while (SysTick->CNT < next_frame) {}
|
||||||
|
next_frame += SYSTICKS_PER_FRAME;
|
||||||
refresh_screen();
|
refresh_screen();
|
||||||
Delay_Ms(300);
|
|
||||||
if (reader >= sizeof(video))
|
if (reader >= sizeof(video))
|
||||||
reader = 0;
|
reader = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue