File tree 2 files changed +31
-0
lines changed
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)
117
117
{
118
118
if (IS_CLOCK_SOURCE (source)) {
119
119
_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);
120
136
}
121
137
}
122
138
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
+
123
151
/* *
124
152
* @brief enable the RTC alarm.
125
153
* @param match: Alarm_Match configuration
Original file line number Diff line number Diff line change @@ -166,6 +166,9 @@ class STM32RTC {
166
166
void setY2kEpoch (uint32_t ts);
167
167
void setAlarmEpoch (uint32_t ts, Alarm_Match match = MATCH_DHHMMSS);
168
168
169
+ void getPrediv (int8_t *predivA, int16_t *predivS);
170
+ void setPrediv (int8_t predivA, int16_t predivS);
171
+
169
172
bool isConfigured (void ) {
170
173
return _configured;
171
174
}
You can’t perform that action at this time.
0 commit comments