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(mhz);
    }
}
Pass the CPU clock in MHz so that ets_delay_us
will be accurate. Call this function when CPU frequency is changed.
esp-hal/src/clock/clocks_ll/esp32.rs