mirror of
https://github.com/stasenso/rp_pico_display_engine.git
synced 2026-06-26 21:32:41 +03:00
Migrate root app to display/render pipeline
This commit is contained in:
+6
-2
@@ -9,14 +9,18 @@ pico_sdk_init()
|
|||||||
|
|
||||||
add_executable(${PROJECT_NAME}
|
add_executable(${PROJECT_NAME}
|
||||||
main.c
|
main.c
|
||||||
Thread.c
|
|
||||||
src/Font/font_data.c
|
src/Font/font_data.c
|
||||||
|
src/core/display.c
|
||||||
src/render/context.c
|
src/render/context.c
|
||||||
BackBuffer.c
|
src/render/line.c
|
||||||
|
src/render/grid.c
|
||||||
|
src/render/sine_wave.c
|
||||||
|
src/render/bezier.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||||
include
|
include
|
||||||
|
include/display
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
|
|||||||
@@ -1,79 +1,52 @@
|
|||||||
#include "main.h"
|
|
||||||
#include "Thread.h"
|
|
||||||
#include "pico/multicore.h"
|
|
||||||
#include "pico/stdlib.h"
|
#include "pico/stdlib.h"
|
||||||
#include "Font/font_data.h"
|
#include "display/display.h"
|
||||||
#include "display/render/context.h"
|
#include "display/render/context.h"
|
||||||
#include "BackBuffer.h"
|
#include "display/render/grid.h"
|
||||||
|
#include "display/render/sine_wave.h"
|
||||||
|
#include "Font/font_data.h"
|
||||||
|
|
||||||
int main() {
|
#define WIDTH 320
|
||||||
uint16_t red = 0;
|
#define HEIGHT 240
|
||||||
uint16_t green = 0;
|
|
||||||
uint16_t blue = 0;
|
static void on_frame_done(void)
|
||||||
uint16_t summcolor=0;
|
{
|
||||||
uint32_t data;
|
display_submit();
|
||||||
// Точки для кривой Безье
|
}
|
||||||
int points_x[60];
|
|
||||||
int points_y[60];
|
int main(void)
|
||||||
size_t num_points = 1600;
|
{
|
||||||
uint16_t color = reverse(0b0000011111100000);
|
|
||||||
stdio_init_all();
|
stdio_init_all();
|
||||||
|
|
||||||
// Настройка GPIO25 как выход
|
display_config_t cfg = {
|
||||||
gpio_init(25);
|
.width = WIDTH,
|
||||||
gpio_set_dir(25, GPIO_OUT);
|
.height = HEIGHT,
|
||||||
|
.buffer_count = 1,
|
||||||
|
.mode = DISPLAY_MODE_SAFE,
|
||||||
|
.frame_done_cb = on_frame_done
|
||||||
|
};
|
||||||
|
|
||||||
// Включение светодиода
|
display_init(&cfg);
|
||||||
gpio_put(25, 1);
|
display_submit();
|
||||||
|
|
||||||
multicore_launch_core1(coreEntry); //Запускаю в ядре 1 процесс вывода на экран
|
float phase = 0.0f;
|
||||||
float x=0.0;
|
|
||||||
float freq=1.0;
|
|
||||||
bool minmax=false;
|
|
||||||
render_ctx_t rc;
|
render_ctx_t rc;
|
||||||
wchar_t buffer[100];
|
|
||||||
while (x<500)
|
while (1)
|
||||||
{
|
{
|
||||||
data = multicore_fifo_pop_blocking();
|
display_poll();
|
||||||
|
|
||||||
fillBufer(frame_buffer,reverse(0x4A69));//
|
uint16_t* buf = display_get_draw_buffer();
|
||||||
grid(20,20,40,0x634d);
|
render_begin(&rc, buf, WIDTH, HEIGHT);
|
||||||
generate_sine_wave_points(num_points, 50, freq, 0, HEIGHT / 2,x);
|
|
||||||
render_begin(&rc, frame_buffer, WIDTH, HEIGHT);
|
render_clear(&rc, RGB16(9, 19, 9));
|
||||||
swprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), L"Value of pi: %.2f", temperature);
|
render_grid(&rc, 20, 20, 40, RGB16(12, 26, 13));
|
||||||
draw_string(&rc, 20,110,buffer,0b1111111111111111); //
|
render_sine_wave(&rc, WIDTH, 50, 2.0f, 0, HEIGHT / 2, phase, RGB16(0, 255, 0));
|
||||||
multicore_fifo_push_blocking(0); //Экран 0 нарисован
|
draw_string(&rc, 12, 12, L"rp_pico_display_engine", RGB565(255, 255, 255));
|
||||||
x+=0.03;
|
|
||||||
if (minmax)
|
phase += 0.08f;
|
||||||
|
if (phase > 6.2831853f)
|
||||||
{
|
{
|
||||||
if (freq<=0.0){
|
phase -= 6.2831853f;
|
||||||
minmax=false;}
|
|
||||||
else freq-=0.05;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (freq>=10.0){
|
|
||||||
minmax=true;}
|
|
||||||
else freq+=0.05;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//sleep_ms(20);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
tight_loop_contents();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fillBufer (uint16_t* buffer,uint16_t color){
|
|
||||||
for (uint16_t y = 0; y < HEIGHT; y++)
|
|
||||||
{
|
|
||||||
for (uint16_t x = 0; x < WIDTH; x++)
|
|
||||||
{
|
|
||||||
buffer[y*WIDTH+x]=color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user