feature: bt classic a2dp sink external codec api bindings - #660
feature: bt classic a2dp sink external codec api bindings#660billylindeman wants to merge 7 commits into
Conversation
add a2dp external codec support (v6.1 feature) bt config
ivmarkov
left a comment
There was a problem hiding this comment.
This is very good.
I have a couple of nits but we can also merge as is.
Marking as approved so you can either merge-as is or address the nits - up to you.
ivmarkov
left a comment
There was a problem hiding this comment.
Ah sorry - one is not nit - the pcnt-legacy thing. This you need to remove. All others are optional.
I see the issue, if we set ESP_IDF_VERSION=master this build fails even on esp-idf-svc git:(master) MCU=esp32 ESP_IDF_VERSION=master ESP_IDF_SDKCONFIG_DEFAULTS=.github/configs/sdkconfig.defaults cargo +esp espflash flash --target xtensa-esp32-espidf --example bt_ble_gap_scanner --monitorerror: could not compile `esp-idf-hal` (lib) due to 5 previous errors
error[E0422]: cannot find struct, variant or union type `pcnt_unit_config_t__bindgen_ty_1` in this scope
--> /home/billy/.cargo/git/checkouts/esp-idf-hal-29c73b2ac8ab537b/24e99b8/src/pcnt.rs:192:24
|
192 | flags: pcnt_unit_config_t__bindgen_ty_1 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
::: /home/billy/Development/esp/esp-idf-svc/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-ef8bf2065ee11924/out/bindings.rs:88903:1
|
88903 | pub union parlio_tx_unit_config_t__bindgen_ty_1 {
| ----------------------------------------------- similarly named union `parlio_tx_unit_config_t__bindgen_ty_1` defined here
|
help: a union with a similar name exists
|
192 - flags: pcnt_unit_config_t__bindgen_ty_1 {
192 + flags: parlio_tx_unit_config_t__bindgen_ty_1 {
|
error[E0422]: cannot find struct, variant or union type `pcnt_chan_config_t__bindgen_ty_1` in this scope
--> /home/billy/.cargo/git/checkouts/esp-idf-hal-29c73b2ac8ab537b/24e99b8/src/pcnt.rs:375:20
|
375 | flags: pcnt_chan_config_t__bindgen_ty_1 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
::: /home/billy/Development/esp/esp-idf-svc/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-ef8bf2065ee11924/out/bindings.rs:82166:1
|
82166 | pub union i2s_chan_config_t__bindgen_ty_1 {
| ----------------------------------------- similarly named union `i2s_chan_config_t__bindgen_ty_1` defined here
|
help: a union with a similar name exists
|
375 - flags: pcnt_chan_config_t__bindgen_ty_1 {
375 + flags: i2s_chan_config_t__bindgen_ty_1 {
|
error[E0433]: cannot find module or crate `pcnt_unit_config_t__bindgen_ty_1` in this scope
--> /home/billy/.cargo/git/checkouts/esp-idf-hal-29c73b2ac8ab537b/24e99b8/src/pcnt.rs:193:34
|
193 | _bitfield_1: pcnt_unit_config_t__bindgen_ty_1::new_bitfield_1(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `pcnt_unit_config_t__bindgen_ty_1`
|
= help: if you wanted to use a crate named `pcnt_unit_config_t__bindgen_ty_1`, use `cargo add pcnt_unit_config_t__bindgen_ty_1` to add it to your `Cargo.toml`
help: a union with a similar name exists
|
193 - _bitfield_1: pcnt_unit_config_t__bindgen_ty_1::new_bitfield_1(
193 + _bitfield_1: parlio_tx_unit_config_t__bindgen_ty_1::new_bitfield_1(
|
error[E0063]: missing field `group_id` in initializer of `esp_idf_sys::pcnt_unit_config_t`
--> /home/billy/.cargo/git/checkouts/esp-idf-hal-29c73b2ac8ab537b/24e99b8/src/pcnt.rs:183:13
|
183 | pcnt_unit_config_t {
| ^^^^^^^^^^^^^^^^^^ missing `group_id`
error[E0433]: cannot find module or crate `pcnt_chan_config_t__bindgen_ty_1` in this scope
--> /home/billy/.cargo/git/checkouts/esp-idf-hal-29c73b2ac8ab537b/24e99b8/src/pcnt.rs:376:30
|
376 | _bitfield_1: pcnt_chan_config_t__bindgen_ty_1::new_bitfield_1(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `pcnt_chan_config_t__bindgen_ty_1`
|
= help: if you wanted to use a crate named `pcnt_chan_config_t__bindgen_ty_1`, use `cargo add pcnt_chan_config_t__bindgen_ty_1` to add it to your `Cargo.toml`
help: a union with a similar name exists
|
376 - _bitfield_1: pcnt_chan_config_t__bindgen_ty_1::new_bitfield_1(
376 + _bitfield_1: i2s_chan_config_t__bindgen_ty_1::new_bitfield_1(
|
Some errors have detailed explanations: E0063, E0422, E0433.
For more information about an error, try `rustc --explain E0063`. |
|
I could add this: [[example]]
name = "bt_a2dp_sink_external_codec"
required-features = ["esp-idf-hal/pcnt-legacy"]and update the example comment to include in the command |
|
The esp-idf-* crates do not yet claim compatibility with ESP-IDF 6.1. We build up to 6.0: esp-idf-svc/.github/workflows/ci.yml Line 36 in 79dd634 Do you absolutely need to use 6.1? If not (and I guess not) - you can downgrade your crate to 6.0 or even latest 5.x. |
|
... let alone ESP-IDF |
|
@ivmarkov yes actually, this support was just merged in the last couple weeks |
OK but then this PR cannot be merged until we do support 6.1 OR as part of this PR, the support for 6.1 is also brought in. Perhaps you can ask your LLM to look into it? |
|
(Sorry I over-assumed you use an LLM, perhaps you don't.) In any case, the PCNT issue should not be super difficult to resolve. The reason why |
Recent ESP-IDF added a flexible-array-member field (`configs[]`) to `wifi_event_dpp_config_received_t`. Bindgen now surfaces it as `__IncompleteArrayField`, which (correctly) isn't `Clone` — a variable-size struct can't be passed by value. The derive on the newtype wrapper became impossible to satisfy. `DppCfgRecvdRef` is only ever held as `&'a DppCfgRecvdRef` inside event callbacks (see `WifiEvent::DppCfgRecvd`), so the derive was never load-bearing. Drop it and document why.
1157cb8 to
6a04344
Compare
Submission Checklist 📝
cargo fmtcommand to ensure that all changed code is formatted correctly.cargo clippycommand to ensure that all changed code passes latest Clippy nightly lints.CHANGELOG.mdin the proper section.Pull Request Details 📖
Description
The latest build of esp-idf supports a new bt classic a2dp sink mode for external codec integration. It has a new api surface, that plumbs the encoded audio to the application for decoding using your own codecs (or esp_audio_codec). I have added support for this api, and I have added an example that shows pairing a2dp with an iphone using AAC codec params, and a callback triggers with the encoded aac data.
I do have this working with https://github.com/billylindeman/esp-audio-codec-rs decoding AAC from my iphone on a project I'm working on
Testing
To run the example: