bablokb / pico-st7735

Pico display library for the ST7735
23 stars 8 forks source link

CMake defines not passed hw.h #1

Open lockencopp opened 2 years ago

lockencopp commented 2 years ago

Configuring Cmake defines for pins are not passed to hw.h, making it impossible to configure pins through this mechanism.

lockencopp commented 2 years ago

Fixed by appending

target_compile_definitions(
  lib-st7735
  PUBLIC
  PIN_TFT_RST=${SPI_TFT_RST}
  PIN_TFT_DC=${SPI_TFT_DC}
  PIN_TFT_CS=${SPI_TFT_CS}
  )

to parent CMakeLists.txt

bablokb commented 2 years ago

Strange, but I will check. According to the CMake documentation everything I add with add_compile_definition is propagated to all targets. So your code would be redundant. And I use this library in various projects and I never encountered any problems.

cedric-h commented 1 year ago

can confirm. lost a day to this + forgetting to tie my backlight pin to high

target_compile_definitions(
  st7735
  PUBLIC
  PIN_TFT_RST=${SPI_TFT_RST}
  PIN_TFT_DC=${SPI_TFT_DC}
  PIN_TFT_CS=${SPI_TFT_CS}
)

stick it in your demo CMakeLists.txt

thanks for the library!

bablokb commented 1 year ago

Are you using the newest version and the new version of the demo?

BTW, to cite the c-make documentation: "The preprocessor definitions are added to the COMPILE_DEFINITIONS directory property for the current CMakeLists file. They are also added to the COMPILE_DEFINITIONS target property for each target in the current CMakeLists file."

zdebel commented 8 months ago

Oh for christ's sake, lost 30 minutes due to this. I am new to RP2040 so I'm not passing blame, thanks for the fix @cedric-h !