diff --git a/drivers/st7567/st7567.cmake b/drivers/st7567/st7567.cmake index 9207751e..85c022a4 100644 --- a/drivers/st7567/st7567.cmake +++ b/drivers/st7567/st7567.cmake @@ -7,4 +7,4 @@ target_sources(${DRIVER_NAME} INTERFACE target_include_directories(${DRIVER_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR}) # Pull in pico libraries that we need -target_link_libraries(${DRIVER_NAME} INTERFACE pico_stdlib pimoroni_bus hardware_spi hardware_pwm hardware_dma) +target_link_libraries(${DRIVER_NAME} INTERFACE pico_stdlib pimoroni_bus hardware_spi hardware_pwm) diff --git a/drivers/st7567/st7567.cpp b/drivers/st7567/st7567.cpp index 00153b89..c03fad58 100644 --- a/drivers/st7567/st7567.cpp +++ b/drivers/st7567/st7567.cpp @@ -1,10 +1,8 @@ #include "st7567.hpp" - +#include "hardware/pwm.h" #include #include -#include "hardware/dma.h" -#include "hardware/pwm.h" #define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" #define BYTE_TO_BINARY(byte) \ diff --git a/examples/gfx_pack/CMakeLists.txt b/examples/gfx_pack/CMakeLists.txt index c12c2118..0e378638 100644 --- a/examples/gfx_pack/CMakeLists.txt +++ b/examples/gfx_pack/CMakeLists.txt @@ -6,7 +6,7 @@ add_executable( ) # Pull in pico libraries that we need -target_link_libraries(${OUTPUT_NAME} pico_stdlib hardware_spi hardware_pwm hardware_dma rgbled button pico_display_2 st7567 pico_graphics) +target_link_libraries(${OUTPUT_NAME} pico_stdlib gfx_pack pico_graphics) # create map/bin/hex file etc. pico_add_extra_outputs(${OUTPUT_NAME}) \ No newline at end of file diff --git a/examples/gfx_pack/gfx_demo.cpp b/examples/gfx_pack/gfx_demo.cpp index ec015567..1ab96c75 100644 --- a/examples/gfx_pack/gfx_demo.cpp +++ b/examples/gfx_pack/gfx_demo.cpp @@ -5,15 +5,11 @@ #include #include "pico/stdlib.h" -#include "libraries/pico_graphics/pico_graphics.hpp" #include "libraries/gfx_pack/gfx_pack.hpp" -#include "drivers/st7567/st7567.hpp" -#include "drivers/button/button.hpp" -#include "drivers/rgbled/rgbled.hpp" using namespace pimoroni; -ST7567 st7567(128, 64, gfx_pack_pins); +ST7567 st7567(128, 64, GfxPack::gfx_pack_pins); PicoGraphics_Pen1Bit graphics(st7567.width, st7567.height, nullptr); RGBLED backlight_rgb(GfxPack::BL_R, GfxPack::BL_G, GfxPack::BL_B, Polarity::ACTIVE_HIGH); Button button_a(GfxPack::A); diff --git a/libraries/gfx_pack/CMakeLists.txt b/libraries/gfx_pack/CMakeLists.txt index 3b2ea54e..69ad037b 100644 --- a/libraries/gfx_pack/CMakeLists.txt +++ b/libraries/gfx_pack/CMakeLists.txt @@ -1,11 +1 @@ -set(LIB_NAME gfx_pack) -add_library(${LIB_NAME} INTERFACE) - -target_sources(${LIB_NAME} INTERFACE - ${CMAKE_CURRENT_LIST_DIR}/${LIB_NAME}.cpp -) - -target_include_directories(${LIB_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR}) - -# Pull in pico libraries that we need -target_link_libraries(${LIB_NAME} INTERFACE pico_stdlib hardware_spi hardware_pwm hardware_dma st7789 pico_graphics) \ No newline at end of file +include(gfx_pack.cmake) \ No newline at end of file diff --git a/libraries/gfx_pack/gfx_pack.cmake b/libraries/gfx_pack/gfx_pack.cmake index b7348688..2985f968 100644 --- a/libraries/gfx_pack/gfx_pack.cmake +++ b/libraries/gfx_pack/gfx_pack.cmake @@ -1,10 +1,11 @@ -add_library(pico_display_2 INTERFACE) +set(LIB_NAME gfx_pack) +add_library(${LIB_NAME} INTERFACE) -target_sources(pico_display_2 INTERFACE - ${CMAKE_CURRENT_LIST_DIR}/pico_display_2.cpp +target_sources(${LIB_NAME} INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/${LIB_NAME}.cpp ) -target_include_directories(pico_display_2 INTERFACE ${CMAKE_CURRENT_LIST_DIR}) +target_include_directories(${LIB_NAME} INTERFACE ${CMAKE_CURRENT_LIST_DIR}) # Pull in pico libraries that we need -target_link_libraries(pico_display_2 INTERFACE pico_stdlib) \ No newline at end of file +target_link_libraries(${LIB_NAME} INTERFACE pico_stdlib hardware_spi pimoroni_bus st7567 pico_graphics button rgbled) \ No newline at end of file diff --git a/libraries/gfx_pack/gfx_pack.cpp b/libraries/gfx_pack/gfx_pack.cpp index 162f2bc7..a2c8e02b 100644 --- a/libraries/gfx_pack/gfx_pack.cpp +++ b/libraries/gfx_pack/gfx_pack.cpp @@ -1 +1,9 @@ -#include "gfx_pack.hpp" \ No newline at end of file +#include "gfx_pack.hpp" + + +using namespace pimoroni; + namespace GfxPack{ + + //SPIPins gfx_pack_pins; + + } \ No newline at end of file diff --git a/libraries/gfx_pack/gfx_pack.hpp b/libraries/gfx_pack/gfx_pack.hpp index 9256e135..bb9734e5 100644 --- a/libraries/gfx_pack/gfx_pack.hpp +++ b/libraries/gfx_pack/gfx_pack.hpp @@ -2,14 +2,17 @@ #include "pico/stdlib.h" #include "common/pimoroni_bus.hpp" +#include "drivers/st7567/st7567.hpp" +#include "drivers/button/button.hpp" +#include "drivers/rgbled/rgbled.hpp" +#include "libraries/pico_graphics/pico_graphics.hpp" + + namespace pimoroni { - SPIPins gfx_pack_pins= {PIMORONI_SPI_DEFAULT_INSTANCE, 17, SPI_DEFAULT_SCK, SPI_DEFAULT_MOSI, PIN_UNUSED, 20, 9}; - - class GfxPack{ - - public: + namespace GfxPack{ + static const SPIPins gfx_pack_pins = {PIMORONI_SPI_DEFAULT_INSTANCE, 17, SPI_DEFAULT_SCK, SPI_DEFAULT_MOSI, PIN_UNUSED, 20, 9}; static const int WIDTH = 128; static const int HEIGHT = 64; static const uint8_t A = 12;