46 lines
759 B
C
46 lines
759 B
C
/**
|
|
* @file main.c
|
|
* @author giomba@glgprograms.it
|
|
* @brief
|
|
*
|
|
* @copyright Copyright Retrofficina GLG Programs (c) 2022
|
|
*
|
|
*/
|
|
|
|
#include "pico/stdlib.h"
|
|
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <math.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "draw_demo.h"
|
|
#include "framebuffer.h"
|
|
#include "vga.h"
|
|
|
|
int main()
|
|
{
|
|
stdio_init_all();
|
|
|
|
draw_demo();
|
|
|
|
vga_machines_init();
|
|
|
|
for (;;)
|
|
{
|
|
// moving sine
|
|
const uint16_t fc = frame_counter;
|
|
const uint16_t x = fc % 640;
|
|
const uint16_t y = 380 + 100 * (abs(320 - x) / 640.0) * sin((fc % 640) / 12.738);
|
|
|
|
set_pixel(x, y);
|
|
|
|
// 13 ms <=> 75 Hz
|
|
// Actually, there is a point in going in sync with vertical refresh,
|
|
// but let's just forget this for the demo.
|
|
sleep_ms(13);
|
|
|
|
clear_pixel(x, y);
|
|
}
|
|
}
|