ivmarkov / rust-esp32-std-demo

Rust on ESP32 STD demo app. A demo STD binary crate for the ESP32[XX] and ESP-IDF, which connects to WiFi, Ethernet, drives a small HTTP server and draws on a LED screen.
Apache License 2.0
784 stars 105 forks source link

Add Bluetooth BLE scan example #90

Closed svenstaro closed 1 year ago

svenstaro commented 2 years ago

This adds an example for BLE scanning. It doesn't actually set up any GATTs nor does it actually connect via Bluetooth to anything. It merely scans its surroundings for 2 seconds and then continues with the rest of the demo as everything else seemed to verbose to me. I think this is about the simplest Bluetooth example one can currently get away with.

I think this also shows a clear way for how some of the more obvious things could be upstreamed into esp_idf_svc in order to streamline usage in the most common cases. It's a start and I hope it inspires some people to maybe carry the torch. :)

Fixes #85.

svenstaro commented 2 years ago

@ivmarkov I have no idea why this fails to build for this target. For xtensa-esp32-espidf it works just fine. Any idea?

pyaillet commented 2 years ago

Hi ! I tried to fix the problem with esp32c3 in your PR on my own fork, you should be able to see it there.

kauly commented 1 year ago

To make the bluetooth() function work I had to put the following piece of code at main.rs:

    unsafe {
        esp_idf_sys::nvs_flash_init();
    }
cwoolum commented 1 year ago

image

I'm getting an error that many of the fields on esp_bt_controller_config_t don't exist.

EDIT: @pyaillet 's branch worked for me

svenstaro commented 1 year ago

Closing in favor of https://github.com/esp-rs/esp-idf-svc/pull/247.