@@ -66,6 +66,8 @@ static uint8_t HSEDiv = 0;
66
66
static uint8_t predivSync_bits = 0xFF ;
67
67
static int8_t predivAsync = -1 ;
68
68
static int16_t predivSync = -1 ;
69
+ #else
70
+ static int32_t prediv = -1 ;
69
71
#endif /* !STM32F1xx */
70
72
71
73
static hourFormat_t initFormat = HOUR_FORMAT_12 ;
@@ -210,9 +212,18 @@ static void RTC_initClock(sourceClock_t source)
210
212
* @param synch: synchronous prescaler value in range 0 - PREDIVS_MAX
211
213
* @retval None
212
214
*/
215
+ #if defined(STM32F1xx )
216
+ void RTC_setPrediv (int32_t asynch , int16_t synch )
217
+ {
218
+ /* the synch param is not used there */
219
+ UNUSED (synch );
220
+ /* set the prescaler for a stm32F1 (value is hold by 1st param) */
221
+ prediv = asynch ;
222
+ LL_RTC_SetAsynchPrescaler (RTC , (uint32_t )asynch );
223
+ }
224
+ #else
213
225
void RTC_setPrediv (int8_t asynch , int16_t synch )
214
226
{
215
- #if !defined(STM32F1xx )
216
227
if ((asynch >= -1 ) && ((uint32_t )asynch <= PREDIVA_MAX ) && \
217
228
(synch >= -1 ) && ((uint32_t )synch <= PREDIVS_MAX )) {
218
229
predivAsync = asynch ;
@@ -221,11 +232,8 @@ void RTC_setPrediv(int8_t asynch, int16_t synch)
221
232
RTC_computePrediv (& predivAsync , & predivSync );
222
233
}
223
234
predivSync_bits = (uint8_t )_log2 (predivSync ) + 1 ;
224
- #else
225
- UNUSED (asynch );
226
- UNUSED (synch );
227
- #endif /* !STM32F1xx */
228
235
}
236
+ #endif /* !STM32F1xx */
229
237
230
238
/**
231
239
* @brief get user (a)synchronous prescaler values if set else computed ones
@@ -234,9 +242,18 @@ void RTC_setPrediv(int8_t asynch, int16_t synch)
234
242
* @param synch: pointer where return synchronous prescaler value.
235
243
* @retval None
236
244
*/
245
+ #if defined(STM32F1xx )
246
+ void RTC_getPrediv (int32_t * asynch , int16_t * synch )
247
+ {
248
+ /* the synch param is not used there */
249
+ UNUSED (synch );
250
+ /* get the prescaler for a stm32F1 (value is hold by 1st param)*/
251
+ prediv = (int32_t )LL_RTC_GetDivider (RTC );
252
+ * asynch = prediv ;
253
+ }
254
+ #else
237
255
void RTC_getPrediv (int8_t * asynch , int16_t * synch )
238
256
{
239
- #if !defined(STM32F1xx )
240
257
if ((predivAsync == -1 ) || (predivSync == -1 )) {
241
258
RTC_computePrediv (& predivAsync , & predivSync );
242
259
}
@@ -245,11 +262,8 @@ void RTC_getPrediv(int8_t *asynch, int16_t *synch)
245
262
* synch = predivSync ;
246
263
}
247
264
predivSync_bits = (uint8_t )_log2 (predivSync ) + 1 ;
248
- #else
249
- UNUSED (asynch );
250
- UNUSED (synch );
251
- #endif /* !STM32F1xx */
252
265
}
266
+ #endif /* !STM32F1xx */
253
267
254
268
#if !defined(STM32F1xx )
255
269
/**
0 commit comments