esp32h2: add rtc clock support

This commit is contained in:
sly
2021-07-07 11:28:07 +08:00
committed by Shu Chen
parent 6ab495b4dc
commit 11dfd802e0
23 changed files with 1818 additions and 623 deletions

View File

@@ -6,6 +6,7 @@
#include <freertos/FreeRTOS.h>
#include "soc/clk_ctrl_os.h"
#include "sdkconfig.h"
#define DELAY_RTC_CLK_SWITCH 5
@@ -19,7 +20,11 @@ bool periph_rtc_dig_clk8m_enable(void)
portENTER_CRITICAL(&periph_spinlock);
if (s_periph_ref_counts == 0) {
rtc_dig_clk8m_enable();
#if CONFIG_IDF_TARGET_ESP32H2
s_rtc_clk_freq = rtc_clk_freq_cal(rtc_clk_cal(RTC_CAL_RC32K, 100));
#else
s_rtc_clk_freq = rtc_clk_freq_cal(rtc_clk_cal(RTC_CAL_8MD256, 100));
#endif
if (s_rtc_clk_freq == 0) {
portEXIT_CRITICAL(&periph_spinlock);
return false;