Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.0.0rc2
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel 8.0.0 is out, need to switch to that.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ _deps
cmake-*
build
build-*
bazel-*
.DS_Store
*.pdf
# Ignore for now to avoid churn.
MODULE.bazel.lock
53 changes: 53 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
module(
name = "pico-examples",
version = "0.0.1-20241114",
)

bazel_dep(name = "pico-sdk", version = "2.1.0")
bazel_dep(name = "rules_platform", version = "0.1.0")
bazel_dep(name = "rules_cc", version = "0.1.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_python", version = "0.36.0")

git_override(
module_name = "pico-sdk",
remote = "https://github.com/armandomontanez/pico-sdk.git",
commit = "fd64ca39f58317213033b9e46f19846c0541fc22",
)

register_toolchains(
"@pico-sdk//bazel/toolchain:linux-x86_64-rp2040",
"@pico-sdk//bazel/toolchain:linux-x86_64-rp2350",
"@pico-sdk//bazel/toolchain:win-x86_64-rp2040",
"@pico-sdk//bazel/toolchain:win-x86_64-rp2350",
"@pico-sdk//bazel/toolchain:mac-x86_64-rp2040",
"@pico-sdk//bazel/toolchain:mac-x86_64-rp2350",
"@pico-sdk//bazel/toolchain:mac-aarch64-rp2040",
"@pico-sdk//bazel/toolchain:mac-aarch64-rp2350",
)

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
configure_coverage_tool = True,
python_version = "3.9",
)

use_repo(python, "pythons_hub")
register_toolchains(
"@pythons_hub//:all",
dev_dependency = True,
)
register_toolchains(
"@rules_python//python/runtime_env_toolchains:all",
dev_dependency = True,
)

new_git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")

# TODO: Provide btstack as a proper Bazel module.
new_git_repository(
name = "btstack",
build_file = "//pico_w/bt:btstack_examples.BUILD",
commit = "2b49e57bd1fae85ac32ac1f41cdb7c794de335f6", # keep-in-sync-with-submodule: lib/btstack
remote = "https://github.com/bluekitchen/btstack.git",
)
19 changes: 19 additions & 0 deletions pico_w/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package(default_visibility = [":__subpackages__"])

platform(
name = "test_pico_w",
parents = ["@pico-sdk//bazel/platform:rp2040"],
flags = [
"--@pico-sdk//bazel/config:PICO_BOARD=pico_w",
"--@pico-sdk//bazel/config:PICO_MULTICORE_ENABLED=False",
],
)

platform(
name = "test_pico2_w",
parents = ["@pico-sdk//bazel/platform:rp2350"],
flags = [
"--@pico-sdk//bazel/config:PICO_BOARD=pico2_w",
"--@pico-sdk//bazel/config:PICO_MULTICORE_ENABLED=False",
],
)
75 changes: 75 additions & 0 deletions pico_w/bt/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package(default_visibility = ["//pico_w/bt:__subpackages__"])

cc_library(
name = "lwip_config",
strip_include_prefix = "config",
hdrs = ["config/lwipopts.h"],
)

cc_library(
name = "btstack_config",
strip_include_prefix = "config",
hdrs = ["config/btstack_config.h"],
)

cc_library(
name = "freertos_config",
strip_include_prefix = "config",
hdrs = ["config/FreeRTOSConfig.h"],
)

cc_library(
name = "picow_bt_example_common",
srcs = ["picow_bt_example_common.c"],
strip_include_prefix = ".",
hdrs = ["picow_bt_example_common.h"],
deps = [
"@pico-sdk//src/rp2_common/pico_btstack",
"@pico-sdk//src/rp2_common/pico_btstack:pico_btstack_sbc_encoder",
"@pico-sdk//src/rp2_common/pico_btstack:pico_btstack_sbc_decoder",
"@pico-sdk//src/rp2_common/pico_btstack:pico_btstack_stdin",
"@pico-sdk//src/rp2_common/pico_cyw43_driver:pico_btstack_cyw43",
"@pico-sdk//src/rp2_common/pico_stdlib",
"@pico-sdk//src/rp2_common/pico_cyw43_arch",
],
)

cc_library(
name = "picow_bt_example_poll",
srcs = ["picow_bt_example_poll.c"],
deps = [
":picow_bt_example_common",
"@pico-sdk//src/rp2_common/pico_cyw43_driver:pico_btstack_cyw43",
"@pico-sdk//src/rp2_common/pico_stdlib",
]
)

cc_library(
name = "picow_bt_example_background",
srcs = ["picow_bt_example_background.c"],
deps = [
":picow_bt_example_common",
"@pico-sdk//src/rp2_common/pico_cyw43_driver:pico_btstack_cyw43",
"@pico-sdk//src/rp2_common/pico_stdlib",
]
)

platform(
name = "test_pico_w",
parents = ["//pico_w:test_pico_w"],
flags = [
"--@pico-sdk//bazel/config:PICO_BTSTACK_CONFIG=//pico_w/bt:btstack_config",
"--@pico-sdk//bazel/config:PICO_BT_ENABLE_BLE=True",
"--@pico-sdk//bazel/config:PICO_BT_ENABLE_CLASSIC=True",
],
)

platform(
name = "test_pico2_w",
parents = ["//pico_w:test_pico2_w"],
flags = [
"--@pico-sdk//bazel/config:PICO_BTSTACK_CONFIG=//pico_w/bt:btstack_config",
"--@pico-sdk//bazel/config:PICO_BT_ENABLE_BLE=True",
"--@pico-sdk//bazel/config:PICO_BT_ENABLE_CLASSIC=True",
],
)
8 changes: 8 additions & 0 deletions pico_w/bt/a2dp_sink_demo/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example(
extra_defines = [
"PICO_AUDIO_I2S_DATA_PIN=9",
"PICO_AUDIO_I2S_CLOCK_PIN_BASE=10",
],
)
5 changes: 5 additions & 0 deletions pico_w/bt/ancs_client_demo/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example(
has_gatt_header = True,
)
5 changes: 5 additions & 0 deletions pico_w/bt/att_delayed_response/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example(
has_gatt_header = True,
)
3 changes: 3 additions & 0 deletions pico_w/bt/avrcp_browsing_client/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
7 changes: 7 additions & 0 deletions pico_w/bt/btstack_examples.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
exports_files(
glob([
"**/example/*.c",
"**/example/*.gatt",
"**/example/*.h",
]),
)
3 changes: 3 additions & 0 deletions pico_w/bt/dut_mode_classic/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
3 changes: 3 additions & 0 deletions pico_w/bt/gap_dedicated_bonding/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
3 changes: 3 additions & 0 deletions pico_w/bt/gap_inquiry/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
3 changes: 3 additions & 0 deletions pico_w/bt/gap_le_advertisements/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
3 changes: 3 additions & 0 deletions pico_w/bt/gap_link_keys/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
5 changes: 5 additions & 0 deletions pico_w/bt/gatt_battery_query/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example(
has_gatt_header = True,
)
5 changes: 5 additions & 0 deletions pico_w/bt/gatt_browser/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example(
has_gatt_header = True,
)
6 changes: 6 additions & 0 deletions pico_w/bt/gatt_counter/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

# Needs battery_service.gatt.
# picow_bt_example(
# has_gatt_header = True,
# )
5 changes: 5 additions & 0 deletions pico_w/bt/gatt_device_information_query/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example(
has_gatt_header = True,
)
3 changes: 3 additions & 0 deletions pico_w/bt/gatt_heart_rate_client/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
5 changes: 5 additions & 0 deletions pico_w/bt/gatt_streamer_server/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example(
has_gatt_header = True,
)
8 changes: 8 additions & 0 deletions pico_w/bt/hfp_hf_demo/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")
# TODO: Needs sco_demo_util.gatt.
# picow_bt_example(
# extra_defines = [
# "PICO_AUDIO_I2S_DATA_PIN=9",
# "PICO_AUDIO_I2S_CLOCK_PIN_BASE=10",
# ],
# )
3 changes: 3 additions & 0 deletions pico_w/bt/hid_host_demo/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
3 changes: 3 additions & 0 deletions pico_w/bt/hid_keyboard_demo/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
3 changes: 3 additions & 0 deletions pico_w/bt/hid_mouse_demo/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
3 changes: 3 additions & 0 deletions pico_w/bt/hog_boot_host_demo/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
5 changes: 5 additions & 0 deletions pico_w/bt/hog_host_demo/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example(
has_gatt_header = True,
)
6 changes: 6 additions & 0 deletions pico_w/bt/hog_keyboard_demo/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

# Needs battery_service.gatt.
# picow_bt_example(
# has_gatt_header = True,
# )
6 changes: 6 additions & 0 deletions pico_w/bt/hog_mouse_demo/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

# Needs battery_service.gatt.
# picow_bt_example(
# has_gatt_header = True,
# )
4 changes: 4 additions & 0 deletions pico_w/bt/hsp_ag_demo/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

# TODO: Slightly more complicated.
# picow_bt_example()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example(
has_gatt_header = True,
)
3 changes: 3 additions & 0 deletions pico_w/bt/le_mitm/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
3 changes: 3 additions & 0 deletions pico_w/bt/le_streamer_client/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
3 changes: 3 additions & 0 deletions pico_w/bt/led_counter/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
9 changes: 9 additions & 0 deletions pico_w/bt/mod_player/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

# TODO: Needs hxcmod.h?
# picow_bt_example(
# extra_defines = [
# "PICO_AUDIO_I2S_DATA_PIN=9",
# "PICO_AUDIO_I2S_CLOCK_PIN_BASE=10",
# ],
# )
6 changes: 6 additions & 0 deletions pico_w/bt/nordic_spp_le_counter/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

# TODO: Needs nordic_spp_service.gatt
# picow_bt_example(
# has_gatt_header = True,
# )
6 changes: 6 additions & 0 deletions pico_w/bt/nordic_spp_le_streamer/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

# TODO: Needs nordic_spp_service.gatt
# picow_bt_example(
# has_gatt_header = True,
# )
3 changes: 3 additions & 0 deletions pico_w/bt/pbap_client_demo/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//pico_w/bt:picow_bt_example.bzl", "picow_bt_example")

picow_bt_example()
Loading