pico: allow builds to use PWM audio with -DAUDIO_PWM
Specify `-DAUDIO_PWM:bool=true` when configuring and builds will use AUDIO_PWM instead of AUDIO_BEEP.
This is intended for PicoSystems which have been end-user modified with a 20x15mm .7w 8Ohm speaker.
@@ -7,7 +7,6 @@ set(32BLIT_PICO 1 PARENT_SCOPE)
add_library(BlitHalPico INTERFACE)
target_sources(BlitHalPico INTERFACE
-
${CMAKE_CURRENT_LIST_DIR}/../3rd-party/fatfs/ff.c
${CMAKE_CURRENT_LIST_DIR}/../3rd-party/fatfs/ffunicode.c
@@ -46,11 +45,22 @@ if(${PICO_BOARD} STREQUAL "vgaboard")
elseif(${PICO_BOARD} STREQUAL "pimoroni_picosystem")
message("Using picosystem...")
target_compile_definitions(BlitHalPico INTERFACE
- AUDIO_BEEP_PIN=11
- AUDIO_BEEP
DISPLAY_ST7789
INPUT_GPIO
)
+ if(AUDIO_PWM)
+ target_link_libraries(BlitHalPico INTERFACE pico_audio_pwm)
+ target_compile_definitions(BlitHalPico INTERFACE
+ PICO_AUDIO_PWM_MONO_PIN=11
+ PICO_AUDIO_PWM_PIO=1
+ AUDIO_PWM
+ )
+ else()
+ target_compile_definitions(BlitHalPico INTERFACE
+ AUDIO_BEEP_PIN=11
+ AUDIO_BEEP
+ )
+ endif()
else()
message(WARNING "Using default config for \"${PICO_BOARD}\"...")
target_link_libraries(BlitHalPico INTERFACE pico_audio_i2s)
