mirror of
https://github.com/stasenso/Thermometr_pico.git
synced 2026-06-26 21:42:42 +03:00
Init
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
|||||||
|
# Build directories
|
||||||
|
/build/
|
||||||
|
**/build/
|
||||||
|
/cmake-build-*/
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
/CMakeCache.txt
|
||||||
|
**/CMakeCache.txt
|
||||||
|
/CMakeFiles/
|
||||||
|
**/CMakeFiles/
|
||||||
|
/cmake_install.cmake
|
||||||
|
**/cmake_install.cmake
|
||||||
|
/compile_commands.json
|
||||||
|
**/compile_commands.json
|
||||||
|
/Makefile
|
||||||
|
**/Makefile
|
||||||
|
/CTestTestfile.cmake
|
||||||
|
**/CTestTestfile.cmake
|
||||||
|
/Testing/
|
||||||
|
**/Testing/
|
||||||
|
|
||||||
|
# Pico SDK and linker/generated files
|
||||||
|
*.bin
|
||||||
|
*.dis
|
||||||
|
*.elf
|
||||||
|
*.hex
|
||||||
|
*.map
|
||||||
|
*.uf2
|
||||||
|
*.ld
|
||||||
|
|
||||||
|
# IDE/editor
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "external/rp_pico_display_engine"]
|
||||||
|
path = external/rp_pico_display_engine
|
||||||
|
url = https://github.com/stasenso/rp_pico_display_engine.git
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.18.4)
|
||||||
|
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
|
||||||
|
|
||||||
|
project(my_app C CXX ASM)
|
||||||
|
set(CMAKE_C_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
pico_sdk_init()
|
||||||
|
|
||||||
|
set(DISPLAY_ENGINE_DIR ${CMAKE_CURRENT_LIST_DIR}/external/rp_pico_display_engine)
|
||||||
|
|
||||||
|
add_library(display_engine STATIC
|
||||||
|
${DISPLAY_ENGINE_DIR}/src/Font/font_data.c
|
||||||
|
${DISPLAY_ENGINE_DIR}/src/core/display.c
|
||||||
|
${DISPLAY_ENGINE_DIR}/src/core/display_transport.c
|
||||||
|
${DISPLAY_ENGINE_DIR}/src/core/display_driver.c
|
||||||
|
${DISPLAY_ENGINE_DIR}/src/render/context.c
|
||||||
|
${DISPLAY_ENGINE_DIR}/src/render/line.c
|
||||||
|
# Uncomment if/when you need these primitives:
|
||||||
|
# ${DISPLAY_ENGINE_DIR}/src/render/grid.c
|
||||||
|
# ${DISPLAY_ENGINE_DIR}/src/render/sine_wave.c
|
||||||
|
# ${DISPLAY_ENGINE_DIR}/src/render/bezier.c
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(display_engine PUBLIC
|
||||||
|
${DISPLAY_ENGINE_DIR}/include
|
||||||
|
${DISPLAY_ENGINE_DIR}/include/display
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(display_engine PUBLIC
|
||||||
|
pico_stdlib
|
||||||
|
hardware_spi
|
||||||
|
hardware_dma
|
||||||
|
hardware_timer
|
||||||
|
pico_multicore
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(display_engine PUBLIC
|
||||||
|
DISPLAY_TYPE=DISPLAY_TYPE_ST7789
|
||||||
|
DISPLAY_SPI_PORT=spi1
|
||||||
|
DISPLAY_PIN_MOSI=15
|
||||||
|
DISPLAY_PIN_SCK=14
|
||||||
|
DISPLAY_PIN_CS=13
|
||||||
|
DISPLAY_PIN_DC=12
|
||||||
|
DISPLAY_PIN_RST=11
|
||||||
|
DISPLAY_PIN_BL=10
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(my_app src/main.c)
|
||||||
|
target_link_libraries(my_app PRIVATE display_engine)
|
||||||
|
pico_add_extra_outputs(my_app)
|
||||||
+1
Submodule external/rp_pico_display_engine added at bbde0402af
+40
@@ -0,0 +1,40 @@
|
|||||||
|
#include "pico/stdlib.h"
|
||||||
|
#include "display/display.h"
|
||||||
|
#include "display/render/context.h"
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
stdio_init_all();
|
||||||
|
|
||||||
|
display_config_t cfg = {
|
||||||
|
.width = 320,
|
||||||
|
.height = 240,
|
||||||
|
.buffer_count = 1,
|
||||||
|
.mode = DISPLAY_MODE_SAFE
|
||||||
|
};
|
||||||
|
display_init(&cfg);
|
||||||
|
|
||||||
|
render_ctx_t rc;
|
||||||
|
uint32_t frame = 0;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
uint16_t *buf = display_begin_paint_blocking();
|
||||||
|
render_begin(&rc, buf, 320, 240);
|
||||||
|
switch ((frame / 30u) % 4u) {
|
||||||
|
case 0:
|
||||||
|
render_clear(&rc, RGB16(255, 0, 0));
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
render_clear(&rc, RGB16(0, 255, 0));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
render_clear(&rc, RGB16(0, 0, 255));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
render_clear(&rc, RGB16(255, 255, 255));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
display_end_paint();
|
||||||
|
frame++;
|
||||||
|
sleep_ms(16);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user