From 3721fb24ce4fff64b73a5c56f9ba5e0eb6cf9c27 Mon Sep 17 00:00:00 2001 From: Stanislav N Mikhailov Date: Fri, 27 Dec 2024 19:42:34 +0300 Subject: [PATCH] Display checked --- Thread.c | 40 ++++++++++++++++++++++++++++-- main.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 100 insertions(+), 15 deletions(-) diff --git a/Thread.c b/Thread.c index 45e8512..3f584c9 100644 --- a/Thread.c +++ b/Thread.c @@ -64,13 +64,49 @@ void st7789_init() { st7789_send_command(0x11); // Exit sleep mode sleep_ms(150); - st7789_send_command(0x36); // Memory data access control - st7789_send_data(0x20); // RGB + st7789_send_command(0x36); // Memory data access control 215 + st7789_send_data(0b00110000); // RGB //st7789_send_data(0b00101000); // BGR st7789_send_command(0x3A); // Interface pixel format st7789_send_data(0b01010101); // 16-bit/pixel + /*/ Настройка гаммы + st7789_send_command(0x26); // Gamma set + st7789_send_data(0x02); // Gamma curve 1 (User-defined) + + st7789_send_command(0xE0); // Positive gamma correction + st7789_send_data(0xD0); // V0 + st7789_send_data(0x00); // V1 + st7789_send_data(0x02); // V2 + st7789_send_data(0x07); // V4 + st7789_send_data(0x0a); // V6 + st7789_send_data(0x29); // V13 + st7789_send_data(0x32); // V20 + st7789_send_data(0x44); // V36 + st7789_send_data(0x42); // V43 + st7789_send_data(0x06); // V50 + st7789_send_data(0x0e); // V57 + st7789_send_data(0x12); // V64 + st7789_send_data(0x14); // V71 + st7789_send_data(0x17); // V78 + + st7789_send_command(0xE1); // Negative gamma correction + st7789_send_data(0xD0); // V0 + st7789_send_data(0x00); // V1 + st7789_send_data(0x02); // V2 + st7789_send_data(0x07); // V4 + st7789_send_data(0x0a); // V6 + st7789_send_data(0x28); // V13 + st7789_send_data(0x31); // V20 + st7789_send_data(0x54); // V36 + st7789_send_data(0x47); // V43 + st7789_send_data(0x0e); // V50 + st7789_send_data(0x1c); // V57 + st7789_send_data(0x17); // V64 + st7789_send_data(0x1b); // V71 + st7789_send_data(0x1e); // V78*/ + st7789_send_command(0x21); //INVON (21h): Display Inversion On st7789_send_command(0x29); // Display ON } diff --git a/main.c b/main.c index 161bbde..c0c6c67 100644 --- a/main.c +++ b/main.c @@ -12,36 +12,85 @@ int main() { stdio_init_all(); multicore_launch_core1(coreEntry); //Запускаю в ядре 1 процесс вывода на экран - while (red<32) + while (red<32) //Red ++ { - //uint8_t red_value = (pixel & red_mask) >> 11; - //uint8_t green_value = (pixel & green_mask) >> 5; - //uint8_t blue_value = (pixel & blue_mask); + data = multicore_fifo_pop_blocking(); - fillBufer(frame_buffer,reverse(summcolor & 0b0000011111111111 | red << 11));//; + summcolor=summcolor & 0b0000011111111111 | red << 11; + fillBufer(frame_buffer,reverse(summcolor));//; multicore_fifo_push_blocking(0); //Экран 0 нарисован - /*data = multicore_fifo_pop_blocking(); - fillBufer(frame_buffer1,0x0000); - multicore_fifo_push_blocking(1); //Экран 0 нарисован*/ red+=1; - sleep_ms(20); + sleep_ms(40); } - while (green<64) + sleep_ms (1000); + while (green<64) //Red+Green { data = multicore_fifo_pop_blocking(); - fillBufer(frame_buffer,reverse(summcolor & 0b1111100000011111 | green << 5)); // + summcolor=summcolor & 0b1111100000011111 | green << 5; + fillBufer(frame_buffer,reverse(summcolor)); // multicore_fifo_push_blocking(0); //Экран 0 нарисован green+=1; sleep_ms(20); } - while (blue<32) + sleep_ms (1000); + red=32; + while (red!=0) //Green++ + { + red-=1; + data = multicore_fifo_pop_blocking(); + summcolor=(summcolor & 0b0000011111111111) | (red << 11); + fillBufer(frame_buffer,reverse(summcolor));//; + multicore_fifo_push_blocking(0); //Экран 0 нарисован + sleep_ms(20); + } + + sleep_ms (1000); + while (blue<32) //Green+blue { data = multicore_fifo_pop_blocking(); - fillBufer(frame_buffer,reverse(summcolor & 0b1111111111100000 | blue)); // + summcolor=summcolor & 0b1111111111100000 | blue; + fillBufer(frame_buffer,reverse(summcolor)); // multicore_fifo_push_blocking(0); //Экран 0 нарисован blue+=1; + sleep_ms(40); + } + + sleep_ms (1000); + green=64; + while (green!=0) //blue++ + { + green-=1; + data = multicore_fifo_pop_blocking(); + summcolor=summcolor & 0b1111100000011111 | green << 5; + fillBufer(frame_buffer,reverse(summcolor));//; + multicore_fifo_push_blocking(0); //Экран 0 нарисован + sleep_ms(20); + } + + sleep_ms (1000); + red=0; + while (red<32) //Red+Blue + { + + data = multicore_fifo_pop_blocking(); + summcolor=summcolor & 0b0000011111111111 | red << 11; + fillBufer(frame_buffer,reverse(summcolor));//; + multicore_fifo_push_blocking(0); //Экран 0 нарисован + red+=1; + sleep_ms(40); + } + + sleep_ms (1000); + green=0; + while (green<64) //Red+Green + { + data = multicore_fifo_pop_blocking(); + summcolor=summcolor & 0b1111100000011111 | green << 5; + fillBufer(frame_buffer,reverse(summcolor)); // + multicore_fifo_push_blocking(0); //Экран 0 нарисован + green+=1; sleep_ms(20); }