[G4] Persistent object support
This commit is contained in:
parent
ff1df466f3
commit
49cf92f5e6
|
@ -51,18 +51,33 @@ void persistentObjectWrite(persistentObjectId_e id, uint32_t value)
|
|||
|
||||
void persistentObjectRTCEnable(void)
|
||||
{
|
||||
#if !defined(STM32G4)
|
||||
// G4 library V1.0.0 __HAL_RTC_WRITEPROTECTION_ENABLE/DISABLE macro does not use handle parameter
|
||||
RTC_HandleTypeDef rtcHandle = { .Instance = RTC };
|
||||
#endif
|
||||
|
||||
#if !defined(STM32H7)
|
||||
__HAL_RCC_PWR_CLK_ENABLE(); // Enable Access to PWR
|
||||
#endif
|
||||
|
||||
HAL_PWR_EnableBkUpAccess(); // Disable backup domain protection
|
||||
|
||||
#if defined(STM32G4)
|
||||
/* Enable RTC APB clock */
|
||||
__HAL_RCC_RTCAPB_CLK_ENABLE();
|
||||
|
||||
/* Peripheral clock enable */
|
||||
__HAL_RCC_RTC_ENABLE();
|
||||
|
||||
#else // !STM32G4, F7 and H7 case
|
||||
|
||||
#if defined(__HAL_RCC_RTC_CLK_ENABLE)
|
||||
// For those MCUs with RTCAPBEN bit in RCC clock enable register, turn it on.
|
||||
__HAL_RCC_RTC_CLK_ENABLE(); // Enable RTC module
|
||||
#endif
|
||||
|
||||
#endif // STM32G4
|
||||
|
||||
// We don't need a clock source for RTC itself. Skip it.
|
||||
|
||||
__HAL_RTC_WRITEPROTECTION_ENABLE(&rtcHandle); // Reset sequence
|
||||
|
|
|
@ -66,7 +66,7 @@ bool isMPUSoftReset(void);
|
|||
void cycleCounterInit(void);
|
||||
uint32_t clockCyclesToMicros(uint32_t clockCycles);
|
||||
uint32_t getCycleCounter(void);
|
||||
#if defined(STM32H7)
|
||||
#if defined(STM32H7) || defined(STM32G4)
|
||||
void systemCheckResetReason(void);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue