diff --git a/src/rp2_common/hardware_clocks/clocks.c b/src/rp2_common/hardware_clocks/clocks.c index 0a679b61..86c5e8db 100644 --- a/src/rp2_common/hardware_clocks/clocks.c +++ b/src/rp2_common/hardware_clocks/clocks.c @@ -216,10 +216,6 @@ void clock_set_reported_hz(enum clock_index clk_index, uint hz) { /// \tag::frequency_count_khz[] uint32_t frequency_count_khz(uint src) { - return frequency_count_raw(src, clock_get_hz(clk_ref) / 1000) >> CLOCKS_FC0_RESULT_KHZ_LSB; -} - -uint32_t frequency_count_raw(uint src, uint ref_khz) { fc_hw_t *fc = &clocks_hw->fc0; // If frequency counter is running need to wait for it. It runs even if the source is NULL @@ -228,7 +224,7 @@ uint32_t frequency_count_raw(uint src, uint ref_khz) { } // Set reference freq - fc->ref_khz = ref_khz; + fc->ref_khz = clock_get_hz(clk_ref) / 1000; // FIXME: Don't pick random interval. Use best interval fc->interval = 10; @@ -245,11 +241,10 @@ uint32_t frequency_count_raw(uint src, uint ref_khz) { } // Return the result - return fc->result; + return fc->result >> CLOCKS_FC0_RESULT_KHZ_LSB; } /// \end::frequency_count_khz[] - static void clocks_handle_resus(void) { // Set clk_sys back to the ref clock rather than it being forced to clk_ref // by resus. Call the user's resus callback if they have set one diff --git a/src/rp2_common/hardware_clocks/include/hardware/clocks.h b/src/rp2_common/hardware_clocks/include/hardware/clocks.h index 03d5e54d..bc4d9ac1 100644 --- a/src/rp2_common/hardware_clocks/include/hardware/clocks.h +++ b/src/rp2_common/hardware_clocks/include/hardware/clocks.h @@ -137,15 +137,6 @@ uint32_t clock_get_hz(enum clock_index clk_index); */ uint32_t frequency_count_khz(uint src); -/*! \brief Measure a clocks frequency using the Frequency counter, returning the raw register value - * \ingroup hardware_clocks - * - * Uses the inbuilt frequency counter to measure the specified clocks frequency. - * - * \return the value of the CLOCKS_FC0_RESULT register - */ -uint32_t frequency_count_raw(uint src, uint ref_khz); - /*! \brief Set the "current frequency" of the clock as reported by clock_get_hz without actually changing the clock * \ingroup hardware_clocks *