kopia lustrzana https://github.com/pimoroni/pimoroni-pico
added copy step for embedded resources to limit symbol name length. wrapped add resource functionality into a cmake function for easy use.
rodzic
fb5a26d4ac
commit
5a7125f803
|
@ -10,6 +10,24 @@ set(CMAKE_CXX_STANDARD 17)
|
||||||
# Initialize the SDK
|
# Initialize the SDK
|
||||||
pico_sdk_init()
|
pico_sdk_init()
|
||||||
|
|
||||||
|
function(add_resource target file)
|
||||||
|
get_filename_component(NAME ${ARGV1} NAME_WE)
|
||||||
|
set(FILENAME ${ARGV1})
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${NAME}.o
|
||||||
|
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
|
||||||
|
COMMAND arm-none-eabi-ld -r -b binary -o ${NAME}.o ${FILENAME}
|
||||||
|
DEPENDS ${FILENAME}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_sources(${ARGV0} PRIVATE ${NAME}.o)
|
||||||
|
endfunction(add_resource)
|
||||||
|
|
||||||
add_subdirectory(drivers)
|
add_subdirectory(drivers)
|
||||||
add_subdirectory(libraries)
|
add_subdirectory(libraries)
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
add_custom_command(
|
|
||||||
OUTPUT fox.o
|
|
||||||
COMMAND arm-none-eabi-ld -r -b binary -o fox.o ${CMAKE_CURRENT_SOURCE_DIR}/fox.tga
|
|
||||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/fox.tga
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(
|
add_executable(
|
||||||
explorer
|
explorer
|
||||||
demo.cpp
|
demo.cpp
|
||||||
fox.o
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_resource(explorer fox.tga)
|
||||||
|
|
||||||
# Pull in pico libraries that we need
|
# Pull in pico libraries that we need
|
||||||
target_link_libraries(explorer pico_stdlib pico_explorer msa301)
|
target_link_libraries(explorer pico_stdlib pico_explorer msa301)
|
||||||
|
|
||||||
# create map/bin/hex file etc.
|
# create map/bin/hex file etc.
|
||||||
pico_add_extra_outputs(explorer)
|
pico_add_extra_outputs(explorer)
|
|
@ -8,10 +8,7 @@
|
||||||
|
|
||||||
using namespace pimoroni;
|
using namespace pimoroni;
|
||||||
|
|
||||||
extern unsigned char image_tif[];
|
extern unsigned char _binary_fox_tga_start[];
|
||||||
extern unsigned int image_tif_len;
|
|
||||||
|
|
||||||
extern unsigned char _binary__home_jon_pimoroni_pico_examples_pico_explorer_fox_tga_start[];
|
|
||||||
|
|
||||||
PicoExplorer pico_explorer;
|
PicoExplorer pico_explorer;
|
||||||
MSA301 msa301;
|
MSA301 msa301;
|
||||||
|
@ -147,7 +144,7 @@ int main() {
|
||||||
yoff += 120 - (68 / 2);
|
yoff += 120 - (68 / 2);
|
||||||
for(int y = 0; y < 68; y++) {
|
for(int y = 0; y < 68; y++) {
|
||||||
uint16_t *dest = pico_explorer.frame_buffer + (y * 240);
|
uint16_t *dest = pico_explorer.frame_buffer + (y * 240);
|
||||||
uint8_t *src = _binary__home_jon_pimoroni_pico_examples_pico_explorer_fox_tga_start + 18 + (y * 81 * 3);
|
uint8_t *src = _binary_fox_tga_start + 18 + (y * 81 * 3);
|
||||||
for(int x = 0; x < 81; x++) {
|
for(int x = 0; x < 81; x++) {
|
||||||
uint8_t r = *src++;
|
uint8_t r = *src++;
|
||||||
uint8_t g = *src++;
|
uint8_t g = *src++;
|
||||||
|
|
Ładowanie…
Reference in New Issue