diff --git a/esp-radio/CHANGELOG.md b/esp-radio/CHANGELOG.md index 1040c759c9b..610bb6afb84 100644 --- a/esp-radio/CHANGELOG.md +++ b/esp-radio/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - `AccessPointInfo::country` to access the Country Code from the Wi-Fi scan results (#3837) +- Added `reinit` method to `BleConnector` to properly reset the BLE modem (#3877) ### Changed diff --git a/esp-radio/src/ble/controller/mod.rs b/esp-radio/src/ble/controller/mod.rs index f94033473a2..edf8c311138 100644 --- a/esp-radio/src/ble/controller/mod.rs +++ b/esp-radio/src/ble/controller/mod.rs @@ -24,6 +24,12 @@ impl<'d> BleConnector<'d> { Self { _device: device } } + pub fn reinit(&mut self) { + // Reinitialize the BLE controller + crate::ble::ble_deinit(); + crate::ble::ble_init(); + } + pub fn next(&mut self, buf: &mut [u8]) -> Result { Ok(read_next(buf)) }