Skip to content

Commit

Permalink
Fix BT audio examples
Browse files Browse the repository at this point in the history
When audio is initialised twice we get a error and make it more obvious
how to change the pins for audio hat hardware
  • Loading branch information
peterharperuk committed Feb 15, 2024
1 parent 1ed4de5 commit 8eff0ef
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
5 changes: 3 additions & 2 deletions pico_w/bt/btstack_audio_pico.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,9 @@ static int btstack_audio_pico_sink_init(

playback_callback = playback;

btstack_audio_pico_audio_buffer_pool = init_audio(samplerate, channels);

if (!btstack_audio_pico_audio_buffer_pool) {
btstack_audio_pico_audio_buffer_pool = init_audio(samplerate, channels);
}
return 0;
}

Expand Down
7 changes: 6 additions & 1 deletion pico_w/bt/hfp_hf_demo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
picow_bt_example(hfp_hf_demo pico_btstack_sco_demo_util pico_btstack_sbc_encoder)
add_library(hfp_hf_demo_pins INTERFACE)
target_compile_definitions(hfp_hf_demo_pins INTERFACE
PICO_AUDIO_I2S_DATA_PIN=9
PICO_AUDIO_I2S_CLOCK_PIN_BASE=10
)
picow_bt_example(hfp_hf_demo pico_btstack_sco_demo_util pico_btstack_sbc_encoder hfp_hf_demo_pins)
7 changes: 6 additions & 1 deletion pico_w/bt/mod_player/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
picow_bt_example(mod_player pico_btstack_hxcmod_player)
add_library(mod_player_pins INTERFACE)
target_compile_definitions(mod_player_pins INTERFACE
PICO_AUDIO_I2S_DATA_PIN=9
PICO_AUDIO_I2S_CLOCK_PIN_BASE=10
)
picow_bt_example(mod_player pico_btstack_hxcmod_player mod_player_pins)
7 changes: 6 additions & 1 deletion pico_w/bt/sine_player/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
picow_bt_example(sine_player)
add_library(sine_player_pins INTERFACE)
target_compile_definitions(sine_player_pins INTERFACE
PICO_AUDIO_I2S_DATA_PIN=9
PICO_AUDIO_I2S_CLOCK_PIN_BASE=10
)
picow_bt_example(sine_player sine_player_pins)

0 comments on commit 8eff0ef

Please sign in to comment.