Skip to content

Commit 5b31514

Browse files
committed
Support auto calibration compilation for other platforms
1 parent 3fdb296 commit 5b31514

File tree

1 file changed

+7
-1
lines changed
  • libraries/SrcWrapper/src/stm32

1 file changed

+7
-1
lines changed

libraries/SrcWrapper/src/stm32/rtc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ static uint8_t HSEDiv = 0;
6666
/* Custom user values */
6767
static int8_t userPredivAsync = -1;
6868
static int16_t userPredivSync = -1;
69+
static uint32_t userCalib = 0;
6970

7071
static hourFormat_t initFormat = HOUR_FORMAT_12;
7172

@@ -316,7 +317,8 @@ void RTC_setCalib(uint32_t minusPulsesValue) // sakinit
316317
#elif defined(STM32F1xx)
317318
const uint32_t Calib_Mask = 0x7FU;
318319
#endif
319-
HAL_RTCEx_SetSmoothCalib(&RtcHandle, 0, 0, minusPulsesValue & Calib_Mask);
320+
userCalib = minusPulsesValue & Calib_Mask;
321+
HAL_RTCEx_SetSmoothCalib(&RtcHandle, 0, 0, userCalib);
320322
}
321323

322324
/**
@@ -336,7 +338,11 @@ uint32_t RTC_getDefaultClockFrequency() //sakinit
336338
*/
337339
uint32_t RTC_getCalib() // sakinit
338340
{
341+
#if defined(STM32F1xx)
339342
return LL_RTC_CAL_GetCoarseDigital(BKP);
343+
#else
344+
return userCalib;
345+
#endif
340346
}
341347

342348
/**

0 commit comments

Comments
 (0)