mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-10 04:43:33 +00:00
esp_clk.h: add esp_clk_xtal_freq
This adds a user API for getting the XTAL frequency
This commit is contained in:
@@ -109,12 +109,17 @@ void esp_clk_init(void)
|
|||||||
|
|
||||||
int IRAM_ATTR esp_clk_cpu_freq(void)
|
int IRAM_ATTR esp_clk_cpu_freq(void)
|
||||||
{
|
{
|
||||||
return g_ticks_per_us_pro * 1000000;
|
return g_ticks_per_us_pro * MHZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IRAM_ATTR esp_clk_apb_freq(void)
|
int IRAM_ATTR esp_clk_apb_freq(void)
|
||||||
{
|
{
|
||||||
return MIN(g_ticks_per_us_pro, 80) * 1000000;
|
return MIN(g_ticks_per_us_pro, 80) * MHZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
int IRAM_ATTR esp_clk_xtal_freq(void)
|
||||||
|
{
|
||||||
|
return rtc_clk_xtal_freq_get() * MHZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRAM_ATTR ets_update_cpu_frequency(uint32_t ticks_per_us)
|
void IRAM_ATTR ets_update_cpu_frequency(uint32_t ticks_per_us)
|
||||||
|
@@ -62,6 +62,17 @@ int esp_clk_cpu_freq(void);
|
|||||||
*/
|
*/
|
||||||
int esp_clk_apb_freq(void);
|
int esp_clk_apb_freq(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return frequency of the main XTAL
|
||||||
|
*
|
||||||
|
* Frequency of the main XTAL can be either auto-detected or set at compile
|
||||||
|
* time (see CONFIG_ESP32_XTAL_FREQ_SEL sdkconfig option). In both cases, this
|
||||||
|
* function returns the actual value at run time.
|
||||||
|
*
|
||||||
|
* @return XTAL frequency, in Hz
|
||||||
|
*/
|
||||||
|
int esp_clk_xtal_freq(void);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read value of RTC counter, converting it to microseconds
|
* @brief Read value of RTC counter, converting it to microseconds
|
||||||
|
Reference in New Issue
Block a user