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

Fix invocation of esp32_update_cpu_freq #124

Merged
merged 2 commits into from
Jul 27, 2022
Merged
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions esp-hal-common/src/clocks_ll/esp32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,16 +360,16 @@ pub(crate) fn set_cpu_freq(cpu_freq_mhz: crate::clock::CpuClock) {
.store5
.modify(|_, w| w.scratch5().bits(value as u32));

esp32_update_cpu_freq(cpu_freq_mhz.frequency().to_Hz());
esp32_update_cpu_freq(cpu_freq_mhz.mhz());
}
}

/// Set the real CPU ticks per us to the ets, so that ets_delay_us
MabezDev marked this conversation as resolved.
Show resolved Hide resolved
/// will be accurate. Call this function when CPU frequency is changed.
fn esp32_update_cpu_freq(ticks_per_us: u32) {
fn esp32_update_cpu_freq(mhz: u32) {
const G_TICKS_PER_US_PRO: u32 = 0x3ffe01e0;
unsafe {
// Update scale factors used by esp_rom_delay_us
(G_TICKS_PER_US_PRO as *mut u32).write_volatile(ticks_per_us);
(G_TICKS_PER_US_PRO as *mut u32).write_volatile(mhz);
}
}