Skip to content

Commit

Permalink
H2: prepare modem clocks for BLE (#953)
Browse files Browse the repository at this point in the history
* H2: prepare modem clocks for BLE

* changelog
  • Loading branch information
JurajSadel authored Nov 17, 2023
1 parent 8c5fda2 commit 4d87e75
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improve DMA documentation & clean up module (#915)
- Only allow a single version of `esp-hal-common` to be present in an application (#934)
- C3, C6 and H2 can now use the `zero-rtc-bss` feature to enable `esp-hal-common/rv-zero-rtc-bss` (#867)
- Reuse `ieee802154_clock_enable/disable()` functions for BLE and rename `ble_ieee802154_clock_enable()` (#953)

### Fixed

Expand Down
10 changes: 4 additions & 6 deletions esp-hal-common/src/soc/esp32h2/radio_clocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ impl RadioClockController for RadioClockControl {
fn enable(&mut self, peripheral: RadioPeripherals) {
match peripheral {
RadioPeripherals::Phy => enable_phy(),
RadioPeripherals::Bt => todo!("BLE not yet supported"),
RadioPeripherals::Ieee802154 => ieee802154_clock_enable(),
RadioPeripherals::Bt | RadioPeripherals::Ieee802154 => ble_ieee802154_clock_enable(),
}
}

fn disable(&mut self, peripheral: RadioPeripherals) {
match peripheral {
RadioPeripherals::Phy => disable_phy(),
RadioPeripherals::Bt => todo!("BLE not yet supported"),
RadioPeripherals::Ieee802154 => ieee802154_clock_disable(),
RadioPeripherals::Bt | RadioPeripherals::Ieee802154 => ble_ieee802154_clock_disable(),
}
}

Expand Down Expand Up @@ -59,7 +57,7 @@ fn disable_phy() {
.modify(|_, w| w.clk_i2c_mst_en().clear_bit());
}

fn ieee802154_clock_enable() {
fn ble_ieee802154_clock_enable() {
let modem_lpcon = unsafe { &*esp32h2::MODEM_LPCON::PTR };
let modem_syscon = unsafe { &*esp32h2::MODEM_SYSCON::PTR };

Expand Down Expand Up @@ -89,7 +87,7 @@ fn ieee802154_clock_enable() {
.modify(|_, w| w.clk_coex_en().set_bit());
}

fn ieee802154_clock_disable() {
fn ble_ieee802154_clock_disable() {
let modem_lpcon = unsafe { &*esp32h2::MODEM_LPCON::PTR };
let modem_syscon = unsafe { &*esp32h2::MODEM_SYSCON::PTR };

Expand Down

0 comments on commit 4d87e75

Please sign in to comment.