drivers: rtc: rtc_ll_stm32: add rtc calibration out support
implementation rtc calibration output frequency set routine. Signed-off-by: Mustafa Abdullah Kus <mustafa.kus@sparsetechnology.com>
This commit is contained in:
parent
689e3216fc
commit
c9e908d7f3
|
@ -71,6 +71,9 @@ struct rtc_stm32_config {
|
|||
uint32_t async_prescaler;
|
||||
uint32_t sync_prescaler;
|
||||
const struct stm32_pclken *pclken;
|
||||
#if DT_INST_NODE_HAS_PROP(0, calib_out_freq)
|
||||
uint32_t cal_out_freq;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct rtc_stm32_data {
|
||||
|
@ -108,6 +111,12 @@ static int rtc_stm32_configure(const struct device *dev)
|
|||
LL_RTC_DisableInitMode(RTC);
|
||||
}
|
||||
|
||||
#if DT_INST_NODE_HAS_PROP(0, calib_out_freq)
|
||||
LL_RTC_CAL_SetOutputFreq(RTC, cfg->cal_out_freq);
|
||||
#else
|
||||
LL_RTC_CAL_SetOutputFreq(RTC, LL_RTC_CALIB_OUTPUT_NONE);
|
||||
#endif
|
||||
|
||||
#ifdef RTC_CR_BYPSHAD
|
||||
LL_RTC_EnableShadowRegBypass(RTC);
|
||||
#endif /* RTC_CR_BYPSHAD */
|
||||
|
@ -422,6 +431,9 @@ static const struct rtc_stm32_config rtc_config = {
|
|||
.sync_prescaler = 0x00FF,
|
||||
#endif
|
||||
.pclken = rtc_clk,
|
||||
#if DT_INST_NODE_HAS_PROP(0, calib_out_freq)
|
||||
.cal_out_freq = _CONCAT(_CONCAT(LL_RTC_CALIB_OUTPUT_, DT_INST_PROP(0, calib_out_freq)), HZ),
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct rtc_stm32_data rtc_data;
|
||||
|
|
Loading…
Reference in a new issue