Closed
Description
I got my own (ESP32-C6 only) code up here, but struggled quite extensively in detaching the logic from each other. I wanted to:
- detach the "measuring" (data input) from BLE notifications
- detach each service from the BLE server
I'll walk you through the current design construction, and then ask advice on the remaining (only one) "hot spot". :)
Files
examples/
└── y-emb
├── boot_btn_ble.rs # BLE details for the button (service and characteristic)
├── boot_btn_task.rs # feeds a Signal from the BOOT button on the devkit
├── config.in # some constants
├── main.rs # entry point; hw initialization
└── server_ble.rs # most of the BLE stuff
Remaining trouble pun
The construction on this line is a hack.
any_notify( boot_btn_feed, &server.bb.state, &server, &conn )
boot_btn_feed
is actually an async poll for the nexttrue
/false
value, ready to be placed for BLE notification&server.bb.state
is needed, because I didn't find a way to make code within the service/characteristic file (boot_btn_ble.rs
) to reach its own.state
characteristic. Need to study the macro expansions to understand how everything works...- access to
server
andconn
are needed, for placing a notification
The existing TrouBLE examples don't suffer of this, mostly because they don't even try to detach the Server and Services/Characteristics from each other.
Metadata
Assignees
Labels
No labels