Add get_frame_counter() method to VGA module interface.

This commit is contained in:
giomba 2022-12-03 21:01:20 +01:00
parent 5f11fa209f
commit c23bcc7f43
3 changed files with 8 additions and 4 deletions

View File

@ -29,7 +29,7 @@ int main()
for (;;)
{
// moving sine
const uint16_t fc = frame_counter;
const uint16_t fc = vga_get_frame_counter();
const uint16_t x = fc % 640;
const uint16_t y = 380 + 100 * (abs(320 - x) / 640.0) * sin((fc % 640) / 12.738);

View File

@ -26,7 +26,7 @@ static PIORun vga_hsync, vga_vsync, vga_pixel;
static bool dma_ready = false;
static int dma_channel;
unsigned long int frame_counter = 0;
static unsigned long int frame_counter = 0;
static void setup_clocks(void)
{
@ -213,3 +213,8 @@ void vga_machines_init(void)
printf("Now running.\n");
}
unsigned long int vga_get_frame_counter(void)
{
return frame_counter;
}

View File

@ -2,7 +2,6 @@
#define VGA_H
void vga_machines_init(void);
extern unsigned long int frame_counter;
unsigned long int vga_get_frame_counter(void);
#endif // VGA_H