Skip to content

Commit 4db6f84

Browse files
committed
export the RTC Handle as a global
Set the subsecond for the alarm value.
1 parent 7a44bfc commit 4db6f84

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/rtc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ extern "C" {
5656
/* Private define ------------------------------------------------------------*/
5757
/* Private macro -------------------------------------------------------------*/
5858
/* Private variables ---------------------------------------------------------*/
59-
static RTC_HandleTypeDef RtcHandle = {0};
6059
static voidCallbackPtr RTCUserCallback = NULL;
6160
static void *callbackUserData = NULL;
6261
#ifdef RTC_ALARM_B
@@ -90,6 +89,9 @@ static inline int _log2(int x)
9089
return (x > 0) ? (sizeof(int) * 8 - __builtin_clz(x) - 1) : 0;
9190
}
9291

92+
/* Exported variable --------------------------------------------------------*/
93+
RTC_HandleTypeDef RtcHandle = {0};
94+
9395
/* Exported functions --------------------------------------------------------*/
9496

9597
/**
@@ -694,7 +696,7 @@ void RTC_GetDate(uint8_t *year, uint8_t *month, uint8_t *day, uint8_t *wday)
694696
*/
695697
void RTC_StartAlarm(alarm_t name, uint8_t day, uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t subSeconds, hourAM_PM_t period, uint8_t mask)
696698
{
697-
RTC_AlarmTypeDef RTC_AlarmStructure;
699+
RTC_AlarmTypeDef RTC_AlarmStructure = {0};
698700

699701
/* Ignore time AM PM configuration if in 24 hours format */
700702
if (initFormat == HOUR_FORMAT_24) {

src/rtc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ typedef enum {
7777
are kept for compatibility but are ignored inside enableAlarm(). */
7878
M_MSK = 16,
7979
Y_MSK = 32,
80-
SUBSEC_MSK = 64
80+
SUBSEC_MSK = 64,
81+
ALL_MSK = 0xFF
8182
} alarmMask_t;
8283

8384
typedef enum {

0 commit comments

Comments
 (0)