pimoroni-pico/examples/inky_frame/inky_frame7_test.cpp

50 lines
1.0 KiB
C++
Raw Normal View History

2023-02-01 11:31:49 +00:00
#include <cstdio>
#include <math.h>
#include <stdio.h>
#include "drivers/psram_display/psram_display.hpp"
2023-02-03 09:53:04 +00:00
#include "drivers/inky73/inky73.hpp"
2023-02-01 11:31:49 +00:00
using namespace pimoroni;
2023-02-03 11:13:47 +00:00
uint LED_PIN = 8;
2023-02-01 11:31:49 +00:00
int main() {
stdio_init_all();
2023-02-03 11:13:47 +00:00
gpio_init(LED_PIN);
gpio_set_function(LED_PIN, GPIO_FUNC_SIO);
gpio_set_dir(LED_PIN, GPIO_OUT);
2023-02-01 11:31:49 +00:00
PSRamDisplay ramDisplay(800, 480);
PicoGraphics_PenInky7 graphics(800, 480, ramDisplay);
2023-02-03 11:13:47 +00:00
UC8159Inky7 inky7(800,400);
while (true) {
while(!inky7.is_pressed(UC8159Inky7::BUTTON_A)) {
sleep_ms(10);
}
graphics.set_pen(1);
graphics.clear();
for(int i =0 ; i < 100 ; i++)
{
uint size = 25 + (rand() % 50);
uint x = rand() % graphics.bounds.w;
uint y = rand() % graphics.bounds.h;
graphics.set_pen(0);
graphics.circle(Point(x, y), size);
graphics.set_pen(2+(i%5));
graphics.circle(Point(x, y), size-2);
}
2023-02-01 11:31:49 +00:00
2023-02-03 11:13:47 +00:00
gpio_put(LED_PIN, 1);
inky7.update(&graphics);
gpio_put(LED_PIN, 0);
}
2023-02-01 11:31:49 +00:00
return 0;
}