Skip to content

Commit ce1122e

Browse files
committed
feat(WBA): Add RTC STM32WBAxx support
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 5da16e6 commit ce1122e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/rtc.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,9 @@ bool RTC_init(hourFormat_t format, binaryMode_t mode, sourceClock_t source, bool
441441
#ifdef __HAL_RCC_RTCAPB_CLK_ENABLE
442442
__HAL_RCC_RTCAPB_CLK_ENABLE();
443443
#endif
444+
#ifdef __HAL_RCC_RTC_ENABLE
444445
__HAL_RCC_RTC_ENABLE();
445-
446+
#endif
446447
isAlarmASet = RTC_IsAlarmSet(ALARM_A);
447448
#ifdef RTC_ALARM_B
448449
isAlarmBSet = RTC_IsAlarmSet(ALARM_B);
@@ -591,7 +592,9 @@ void RTC_DeInit(bool reset_cb)
591592
{
592593
HAL_RTC_DeInit(&RtcHandle);
593594
/* Peripheral clock disable */
595+
#ifdef __HAL_RCC_RTC_DISABLE
594596
__HAL_RCC_RTC_DISABLE();
597+
#endif
595598
#ifdef __HAL_RCC_RTCAPB_CLK_DISABLE
596599
__HAL_RCC_RTCAPB_CLK_DISABLE();
597600
#endif
@@ -1124,7 +1127,8 @@ void RTC_Alarm_IRQHandler(void)
11241127
#if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
11251128
defined(STM32F091xC) || defined(STM32F098xx) || defined(STM32F070xB) || \
11261129
defined(STM32F030xC) || defined(STM32G0xx) || defined(STM32H5xx) || \
1127-
defined(STM32L0xx) || defined(STM32L5xx) || defined(STM32U5xx)
1130+
defined(STM32L0xx) || defined(STM32L5xx) || defined(STM32U5xx) || \
1131+
defined(STM32WBAxx)
11281132
// In some cases, the same vector is used to manage WakeupTimer,
11291133
// but with a dedicated HAL IRQHandler
11301134
HAL_RTCEx_WakeUpTimerIRQHandler(&RtcHandle);

src/rtc.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ typedef void(*voidCallbackPtr)(void *);
129129
#endif /* !STM32F1xx */
130130

131131
#if defined(STM32C0xx) || defined(STM32F0xx) || defined(STM32H5xx) || \
132-
defined(STM32L0xx) || defined(STM32L5xx) || defined(STM32U5xx)
132+
defined(STM32L0xx) || defined(STM32L5xx) || defined(STM32U5xx) || \
133+
defined(STM32WBAxx)
133134
#define RTC_Alarm_IRQn RTC_IRQn
134135
#define RTC_Alarm_IRQHandler RTC_IRQHandler
135136
#endif
@@ -141,7 +142,7 @@ typedef void(*voidCallbackPtr)(void *);
141142
/* mapping the IRQn for the one-second interrupt depending on the soc */
142143
#if defined(STM32F1xx) || (defined(STM32F0xx) && defined(RTC_CR_WUTE)) || \
143144
defined(STM32H5xx) || defined(STM32L0xx) || defined(STM32L5xx) || \
144-
defined(STM32U5xx)
145+
defined(STM32U5xx) || defined(STM32WBAxx)
145146
// specific WakeUp interrupt
146147
#define ONESECOND_IRQn RTC_IRQn
147148
#elif defined(STM32MP1xx)

0 commit comments

Comments
 (0)