avr-firmwares/drivers/fbani_recorder.c

43 lines
537 B
C

#include "fbani_recorder.h"
#include "framebuffer.h"
#include <util/delay.h>
void fbani_recorder(unsigned int count) {
int8_t px, py, mx, my;
fb_fill(0);
px = 0;
py = 0;
mx = 1;
my = 1;
while(1) {
if (px <= 0) {
mx = 1;
}
if (py <= 0) {
my = 1;
}
if (px >= FB_WIDTH - 1) {
mx = -1;
}
if (py >= FB_HEIGHT - 1) {
my = -1;
count --;
}
FB_SET(px,py,0);
if (!count) return;
px += mx;
py += my;
FB_SET(px,py,1);
_delay_ms(50);
}
}