File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -117,9 +117,37 @@ void STM32RTC::setClockSource(RTC_Source_Clock source)
117117{
118118 if (IS_CLOCK_SOURCE (source)) {
119119 _clockSource = source;
120+ RTC_SetClockSource ((_clockSource == RTC_LSE_CLOCK)? LSE_CLOCK:
121+ (_clockSource == RTC_HSE_CLOCK)? HSE_CLOCK : LSI_CLOCK);
122+ }
123+ }
124+
125+ /* *
126+ * @brief get user (a)synchronous prescaler values if set else computed
127+ * ones for the current clock source.
128+ * @param predivA: pointer to the current Asynchronous prescaler value
129+ * @param predivS: pointer to the current Synchronous prescaler value
130+ * @retval None
131+ */
132+ void STM32RTC::getPrediv (int8_t *predivA, int16_t *predivS)
133+ {
134+ if ((predivA != NULL ) && (predivS != NULL )) {
135+ RTC_getPrediv (predivA, predivS);
120136 }
121137}
122138
139+ /* *
140+ * @brief set user (a)synchronous prescalers value.
141+ * @note This method must be called before begin().
142+ * @param predivA: Asynchronous prescaler value. Reset value: -1
143+ * @param predivS: Synchronous prescaler value. Reset value: -1
144+ * @retval None
145+ */
146+ void STM32RTC::setPrediv (int8_t predivA, int16_t predivS)
147+ {
148+ RTC_setPrediv (predivA, predivS);
149+ }
150+
123151/* *
124152 * @brief enable the RTC alarm.
125153 * @param match: Alarm_Match configuration
Original file line number Diff line number Diff line change @@ -166,6 +166,9 @@ class STM32RTC {
166166 void setY2kEpoch (uint32_t ts);
167167 void setAlarmEpoch (uint32_t ts, Alarm_Match match = MATCH_DHHMMSS);
168168
169+ void getPrediv (int8_t *predivA, int16_t *predivS);
170+ void setPrediv (int8_t predivA, int16_t predivS);
171+
169172 bool isConfigured (void ) {
170173 return _configured;
171174 }
You can’t perform that action at this time.
0 commit comments