Skip to content

Commit bc940f2

Browse files
committed
change the set/get prescaler divider Interface in case of stm32F1
The stm32F1 prescaler is asynchronous and mapped on a 32bit param. Signed-off-by: Francois Ramu <[email protected]>
1 parent 79d8b5f commit bc940f2

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/STM32RTC.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,20 @@ void STM32RTC::setClockSource(Source_Clock source)
140140
* @param predivS: pointer to the current Synchronous prescaler value
141141
* @retval None
142142
*/
143+
#if defined(STM32F1xx)
144+
void STM32RTC::getPrediv(int32_t *predivA, int16_t *predivS)
145+
{
146+
UNUSED(predivS);
147+
RTC_getPrediv(predivA, 0);
148+
}
149+
#else
143150
void STM32RTC::getPrediv(int8_t *predivA, int16_t *predivS)
144151
{
145152
if ((predivA != nullptr) && (predivS != nullptr)) {
146153
RTC_getPrediv(predivA, predivS);
147154
}
148155
}
156+
#endif /* STM32F1xx */
149157

150158
/**
151159
* @brief set user (a)synchronous prescalers value.
@@ -154,10 +162,18 @@ void STM32RTC::getPrediv(int8_t *predivA, int16_t *predivS)
154162
* @param predivS: Synchronous prescaler value. Reset value: -1
155163
* @retval None
156164
*/
165+
#if defined(STM32F1xx)
166+
void STM32RTC::setPrediv(int32_t predivA, int16_t predivS)
167+
{
168+
UNUSED(predivS);
169+
RTC_setPrediv(predivA, 0);
170+
}
171+
#else
157172
void STM32RTC::setPrediv(int8_t predivA, int16_t predivS)
158173
{
159174
RTC_setPrediv(predivA, predivS);
160175
}
176+
#endif /* STM32F1xx */
161177

162178
/**
163179
* @brief enable the RTC alarm.

src/STM32RTC.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,13 @@ class STM32RTC {
189189
void setY2kEpoch(uint32_t ts);
190190
void setAlarmEpoch(uint32_t ts, Alarm_Match match = MATCH_DHHMMSS, uint32_t subSeconds = 0);
191191

192+
#if defined(STM32F1xx)
193+
void getPrediv(int32_t *predivA, int16_t *predivS = nullptr);
194+
void setPrediv(int32_t predivA, int16_t predivS);
195+
#else
192196
void getPrediv(int8_t *predivA, int16_t *predivS);
193197
void setPrediv(int8_t predivA, int16_t predivS);
194-
198+
#endif /* STM32F1xx */
195199
bool isConfigured(void)
196200
{
197201
return _configured;

0 commit comments

Comments
 (0)