@@ -30,15 +30,7 @@ extern "C" {
30
30
#endif
31
31
32
32
/* Exported macro ------------------------------------------------------------*/
33
- #if (!defined(STM32F0xx ) && !defined(STM32F3xx ) && !defined(STM32L0xx ) && \
34
- !defined(STM32L1xx ) && !defined(STM32L4xx ) && !defined(STM32MP1xx )) || \
35
- defined(RTC_BACKUP_SUPPORT )
36
- #if !defined(STM32L412xx ) && !defined(STM32L422xx )
37
- #define ENABLE_BACKUP_SUPPORT
38
- #endif
39
- #endif
40
-
41
- #if !defined(RTC_BKP_INDEX ) && defined(ENABLE_BACKUP_SUPPORT )
33
+ #if !defined(RTC_BKP_INDEX ) && defined(LL_RTC_BKP_DR1 )
42
34
#define RTC_BKP_INDEX LL_RTC_BKP_DR1
43
35
#else
44
36
#define RTC_BKP_INDEX 0
@@ -109,38 +101,42 @@ static inline void disableBackupDomain(void)
109
101
110
102
static inline void setBackupRegister (uint32_t index , uint32_t value )
111
103
{
112
- #if defined(STM32F1xx )
104
+ #if defined(BKP_BASE )
113
105
LL_RTC_BKP_SetRegister (BKP , index , value );
114
- #elif defined(STM32G0xx )
115
- LL_RTC_BKP_SetRegister (TAMP , index , value );
116
- #elif defined(STM32G4xx ) || defined(STM32L5xx )
106
+ #elif defined(RTC_BKP0R )
107
+ LL_RTC_BAK_SetRegister (RTC , index , value );
108
+ #elif defined(TAMP_BKP0R )
109
+ #if defined(STM32G4xx ) || defined(STM32L5xx ) || defined(STM32MP1xx )
110
+ /* For those series this API requires RTC even if it is not used
111
+ and TAMP is used instead */
117
112
LL_RTC_BKP_SetRegister (RTC , index , value );
118
113
#else
119
- #ifdef ENABLE_BACKUP_SUPPORT
120
- LL_RTC_BAK_SetRegister ( RTC , index , value );
114
+ LL_RTC_BKP_SetRegister ( TAMP , index , value );
115
+ #endif
121
116
#else
122
117
UNUSED (index );
123
118
UNUSED (value );
124
119
#endif
125
- #endif
126
120
}
127
121
128
122
static inline uint32_t getBackupRegister (uint32_t index )
129
123
{
130
- #if defined(STM32F1xx )
124
+ #if defined(BKP_BASE )
131
125
return LL_RTC_BKP_GetRegister (BKP , index );
132
- #elif defined(STM32G0xx )
133
- return LL_RTC_BKP_GetRegister (TAMP , index );
134
- #elif defined(STM32G4xx ) || defined(STM32L5xx )
126
+ #elif defined(RTC_BKP0R )
127
+ return LL_RTC_BAK_GetRegister (RTC , index );
128
+ #elif defined(TAMP_BKP0R )
129
+ #if defined(STM32G4xx ) || defined(STM32L5xx ) || defined(STM32MP1xx )
130
+ /* For those series this API requires RTC even if it is not used
131
+ and TAMP is used instead */
135
132
return LL_RTC_BKP_GetRegister (RTC , index );
136
133
#else
137
- #ifdef ENABLE_BACKUP_SUPPORT
138
- return LL_RTC_BAK_GetRegister ( RTC , index );
134
+ return LL_RTC_BKP_GetRegister ( TAMP , index );
135
+ #endif
139
136
#else
140
137
UNUSED (index );
141
138
return 0 ;
142
139
#endif
143
- #endif
144
140
}
145
141
146
142
static inline void writeBackupSRAM (uint32_t offset , uint32_t * data , uint32_t length )
0 commit comments