Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H2: prepare modem clocks for BLE #953

Merged
merged 2 commits into from
Nov 17, 2023
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: 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