@@ -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,7 +212,7 @@ 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
*/
213
- void RTC_setPrediv (int8_t asynch , int16_t synch )
215
+ void RTC_setPrediv (int32_t asynch , int16_t synch )
214
216
{
215
217
#if !defined(STM32F1xx )
216
218
if ((asynch >= -1 ) && ((uint32_t )asynch <= PREDIVA_MAX ) && \
@@ -222,8 +224,11 @@ void RTC_setPrediv(int8_t asynch, int16_t synch)
222
224
}
223
225
predivSync_bits = (uint8_t )_log2 (predivSync ) + 1 ;
224
226
#else
225
- UNUSED ( asynch );
227
+ /* the synch param is not used there */
226
228
UNUSED (synch );
229
+ /* set the prescaler for a stm32F1 (value is hold by 1st param) */
230
+ prediv = (int32_t )asynch ;
231
+ LL_RTC_SetAsynchPrescaler (RTC , asynch );
227
232
#endif /* !STM32F1xx */
228
233
}
229
234
@@ -234,7 +239,7 @@ void RTC_setPrediv(int8_t asynch, int16_t synch)
234
239
* @param synch: pointer where return synchronous prescaler value.
235
240
* @retval None
236
241
*/
237
- void RTC_getPrediv (int8_t * asynch , int16_t * synch )
242
+ void RTC_getPrediv (int32_t * asynch , int16_t * synch )
238
243
{
239
244
#if !defined(STM32F1xx )
240
245
if ((predivAsync == -1 ) || (predivSync == -1 )) {
@@ -246,8 +251,11 @@ void RTC_getPrediv(int8_t *asynch, int16_t *synch)
246
251
}
247
252
predivSync_bits = (uint8_t )_log2 (predivSync ) + 1 ;
248
253
#else
249
- UNUSED ( asynch );
254
+ /* the synch param is not used there */
250
255
UNUSED (synch );
256
+ /* get the prescaler for a stm32F1 (value is hold by 1st param)*/
257
+ prediv = (int32_t )LL_RTC_GetDivider (RTC );
258
+ * asynch = prediv ;
251
259
#endif /* !STM32F1xx */
252
260
}
253
261
0 commit comments