Skip to content
Merged
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: 0 additions & 1 deletion Devices/btt-panda-touch/bigtreetech,panda-touch.dts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/cyd-4848s040c/cyd,4848s040c.dts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/cyd-8048s043c/cyd,8048s043c.dts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/es3c28p/es3c28p.dts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/guition-jc1060p470ciwy/guition,jc1060p470ciwy.dts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/guition-jc8048w550c/guition,jc8048w550c.dts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/heltec-wifi-lora-32-v3/heltec,wifi-lora-32-v3.dts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/lilygo-tdeck-plus/lilygo,tdeck-plus.dts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/lilygo-tdeck/lilygo,tdeck.dts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/lilygo-tdisplay-s3/lilygo,tdisplay-s3.dts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/lilygo-tdongle-s3/lilygo,tdongle-s3.dts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/lilygo-thmi/lilygo,thmi.dts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/lilygo-tlora-pager/lilygo,tlora-pager.dts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/m5stack-cardputer-adv/m5stack,cardputer-adv.dts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/m5stack-cardputer/m5stack,cardputer.dts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/m5stack-cores3/m5stack,cores3.dts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/m5stack-papers3/m5stack,papers3.dts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/m5stack-stackchan/m5stack,stackchan.dts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/m5stack-sticks3/m5stack,sticks3.dts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/m5stack-tab5/m5stack,tab5.dts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/tulip-4r11/tulip-4r11.dts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/unphone/unphone.dts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
1 change: 0 additions & 1 deletion Devices/waveshare-s3-lcd-13/waveshare,s3-lcd-13.dts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

ble0 {
compatible = "espressif,esp32-ble";
status = "disabled";
};

gpio0 {
Expand Down
2 changes: 1 addition & 1 deletion Documentation/ideas.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
- Improve Setup: Show "Step done" screen
- Improve Setup: Add keyboard/keypad navigation explanation
- display.h API: get_backlight does not change ref counting, but it should
- bluetooth: various getters for child devices do not change ref counting, but they should
- bluetooth: various getters for child devices do not change ref counting, but they should (e.g. bluetooth_hid_device_get_device())
- Improve kernel_init.cpp (and other modules): create driver_ensure_added() and driver_ensure_destructed()
- Drivers/audio-codec-module is not a module. Move it somewhere else. Or make it an actual module.
- LilyGO T-Dongle S3: 1 button control, stop auto-launching web server
Expand Down
23 changes: 11 additions & 12 deletions Platforms/platform-esp32/private/bluetooth/esp32_ble_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,26 @@
#include <bluetooth/esp32_ble_midi.h>
#include <bluetooth/esp32_ble_hid.h>

#define BLE_MAX_CALLBACKS 8

struct BleCallbackEntry {
BtEventCallback fn;
void* ctx;
};

struct BleCtx {
// Mutexes
SemaphoreHandle_t radio_mutex; // guards radio state transitions
SemaphoreHandle_t cb_mutex; // guards callbacks array
// Guards GAP/GATT advertising & profile-switch calls (on_sync()'s advertising decision vs.
// hid/spp/midi's _start()/_stop()). Deliberately separate from radio_mutex: radio_mutex can
// be held for the duration of nimble_port_stop(), which blocks waiting for the NimBLE host
// task to exit its run loop - taking that same mutex from code that can run ON the host task
// (on_sync()) would deadlock disable against it. Nothing held under gap_mutex ever waits on
// host-task progress, so it's safe to take from the host task itself.
SemaphoreHandle_t gap_mutex;

// Radio / scan state (atomic — read from multiple tasks)
std::atomic<BtRadioState> radio_state;
std::atomic<bool> scan_active;
// Set by Tactility HID host to prevent simultaneous central connection during name resolution
std::atomic<bool> hid_host_active;

// Event callbacks (guarded by cb_mutex)
BleCallbackEntry callbacks[BLE_MAX_CALLBACKS];
size_t callback_count;
// Event subscriptions (guarded by subscriptionsMutex)
Mutex subscriptionsMutex;
BtEventSubscription* subscriptions;

// Connection handles + active flags (atomic — accessed from multiple tasks)
std::atomic<uint16_t> spp_conn_handle;
Expand Down Expand Up @@ -98,7 +97,7 @@ struct BleCtx {
ble_addr_t scan_addrs[64];
size_t scan_count;

// Device reference (passed to BtEventCallback)
// Device reference (passed to subscribers via BtEvent delivery)
struct Device* device;

// Child devices (created by esp32_ble_start_device, destroyed by stop_device)
Expand Down
Loading
Loading