Skip to content

Commit

Permalink
pico: don't use latest btstack
Browse files Browse the repository at this point in the history
since BLE connections don't finish (?)
  • Loading branch information
ricardoquesada committed Dec 21, 2024
1 parent a14ab1d commit 1c11e0b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 31 deletions.
24 changes: 5 additions & 19 deletions .github/workflows/esp-idf-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,23 @@ jobs:
esp_idf_version: release-v5.3
target: esp32
path: 'examples/esp32'
command: |
rm sdkconfig
idf.py fullclean
idf.py build
command: "idf.py set-target esp32 && idf.py build"

- name: Example ESP32-S3 build
uses: espressif/esp-idf-ci-action@main
with:
esp_idf_version: release-v5.3
target: esp32-s3
path: 'examples/esp32'
command: |
rm sdkconfig
idf.py fullclean
idf.py build
command: "idf.py set-target esp32s3 && idf.py build"

- name: Example ESP32-C3 build
uses: espressif/esp-idf-ci-action@main
with:
esp_idf_version: release-v5.3
target: esp32-c3
path: 'examples/esp32'
command: |
rm sdkconfig
idf.py fullclean
idf.py build
command: "idf.py set-target esp32c3 && idf.py build"

- name: Example ESP32-C6 build
uses: espressif/esp-idf-ci-action@main
Expand All @@ -73,19 +64,14 @@ jobs:
target: esp32-c6
path: 'examples/esp32'
command: |
rm sdkconfig
idf.py fullclean
idf.py build
command: "idf.py set-target esp32c6 && idf.py build"

- name: Example ESP32-H2 build
uses: espressif/esp-idf-ci-action@main
with:
esp_idf_version: release-v5.3
target: esp32-h2
path: 'examples/esp32'
command: |
rm sdkconfig
idf.py fullclean
idf.py build
command: "idf.py set-target esp32h2 && idf.py build"


24 changes: 14 additions & 10 deletions examples/pico_w/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@ endif()
set(BLUEPAD32_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..)

# To use BTstack from Pico SDK do
#set(BTSTACK_ROOT ${PICO_SDK_PATH}/lib/btstack)
# To use it from Bluepad32 (up-to-date, with custom patches for controllers):
set(BTSTACK_ROOT ${BLUEPAD32_ROOT}/external/btstack)
set(PICO_BTSTACK_PATH ${BTSTACK_ROOT})
set(BTSTACK_ROOT ${PICO_SDK_PATH}/lib/btstack)

# If you want to use latest BTstack (included in Bluepad32 repo),
# uncomment the following lines, and comment the one above this one.
#set(BTSTACK_ROOT ${BLUEPAD32_ROOT}/external/btstack)
# Add missing files here. See:
# https://github.com/bluekitchen/btstack/issues/649
# https://github.com/raspberrypi/pico-sdk/issues/2142
#set(BTSTACK_MISSING_SOURCES
# ${BTSTACK_ROOT}/src/hci_event_builder.c
#)
#set(PICO_BTSTACK_PATH ${BTSTACK_ROOT})

# initialize the SDK based on PICO_SDK_PATH
# note: this must happen before project()
Expand All @@ -27,12 +35,6 @@ set(CMAKE_CXX_STANDARD 17)
# initialize the Raspberry Pi Pico SDK
pico_sdk_init()

# Add missing files here. See:
# https://github.com/bluekitchen/btstack/issues/649
# https://github.com/raspberrypi/pico-sdk/issues/2142
set(BTSTACK_MISSING_SOURCES
${BTSTACK_ROOT}/src/hci_event_builder.c
)

add_executable(bluepad32_picow_example_app
src/main.c
Expand All @@ -51,6 +53,8 @@ include_directories(bluepad32_picow_example_app src)
# Needed when using BTstack from our branch
include_directories(${BTSTACK_ROOT}/3rd-party/bluedroid/encoder/include)
include_directories(${BTSTACK_ROOT}/3rd-party/bluedroid/decoder/include)
# Need for certain IDEs, like CLion. Otherwise it won't find btstack
include_directories(${BTSTACK_ROOT}/src)

target_link_libraries(bluepad32_picow_example_app PUBLIC
pico_stdlib
Expand Down
4 changes: 2 additions & 2 deletions examples/pico_w/src/my_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ static void my_platform_on_controller_data(uni_hid_device_t* d, uni_controller_t
// Toggle Bluetooth connections
if ((gp->buttons & BUTTON_SHOULDER_L) && enabled) {
logi("*** Disabling Bluetooth connections\n");
uni_bt_enable_new_connections_safe(false);
uni_bt_stop_scanning_safe();
enabled = false;
}
if ((gp->buttons & BUTTON_SHOULDER_R) && !enabled) {
logi("*** Enabling Bluetooth connections\n");
uni_bt_enable_new_connections_safe(true);
uni_bt_start_scanning_and_autoconnect_safe();
enabled = true;
}
break;
Expand Down

0 comments on commit 1c11e0b

Please sign in to comment.