Skip to content

Commit ad71918

Browse files
committed
Revert "Added ability to set multiple alarms"
This reverts commit 863adf2.
1 parent 863adf2 commit ad71918

File tree

5 files changed

+2
-191
lines changed

5 files changed

+2
-191
lines changed

examples/MultipleRTCAlarm/MultipleRTCAlarm.ino

Lines changed: 0 additions & 91 deletions
This file was deleted.

keywords.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ disableAlarm KEYWORD2
5454

5555
standbyMode KEYWORD2
5656

57-
addAlarm KEYWORD2
58-
updateAlarms KEYWORD2
59-
6057
#######################################
6158
# Constants (LITERAL1)
6259
#######################################

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=RTCZero
2-
version=1.5.0
2+
version=1.4.1
33
author=Arduino
44
maintainer=Arduino <[email protected]>
55
sentence=Allows to use the RTC functionalities. For Arduino Zero only.

src/RTCZero.cpp

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ void RTCZero::begin()
7272

7373
RTCenable();
7474
RTCresetRemove();
75-
76-
_alarmsStartPtr = NULL;
77-
isFirstAlarm = true;
7875
}
7976

8077
void RTC_Handler(void)
@@ -345,33 +342,11 @@ void RTCZero::setY2kEpoch(uint32_t ts)
345342
setEpoch(ts + EPOCH_TIME_OFF);
346343
}
347344

348-
349-
void RTCZero::addAlarm(uint8_t hours, uint8_t minutes, uint8_t seconds, uint8_t day, uint8_t month, uint8_t year, uint8_t typeOfMatch, voidFuncPtr callback){
350-
_alarmsEndPtr = insertAlarm ( hours, minutes, seconds, day, month, year, typeOfMatch, callback);
351-
}
352-
353-
void RTCZero::updateAlarms(void){
354-
if(_alarmsStartPtr != NULL){
355-
setAlarmTime(_alarmsStartPtr->hours, _alarmsStartPtr->minutes, _alarmsStartPtr->seconds);
356-
setAlarmDate(_alarmsStartPtr->day, _alarmsStartPtr->month, _alarmsStartPtr->year);
357-
enableAlarm((Alarm_Match) _alarmsStartPtr->typeOfMatch);
358-
attachInterrupt(_alarmsStartPtr->thisCallback);
359-
}
360-
else{
361-
setAlarmTime(0, 0, 0);
362-
setAlarmDate(0, 0, 0);
363-
enableAlarm(MATCH_OFF);
364-
}
365-
366-
destroyAlarm();
367-
}
368-
369345
/*
370346
* Private Utility Functions
371347
*/
372348

373349
/* Configure the 32768Hz Oscillator */
374-
375350
void RTCZero::config32kOSC()
376351
{
377352
SYSCTRL->XOSC32K.reg = SYSCTRL_XOSC32K_ONDEMAND |
@@ -415,52 +390,3 @@ void RTCZero::RTCresetRemove()
415390
while (RTCisSyncing())
416391
;
417392
}
418-
419-
alarms* RTCZero::insertAlarm (uint8_t hours, uint8_t minutes, uint8_t seconds, uint8_t day, uint8_t month, uint8_t year, uint8_t typeOfMatch, voidFuncPtr callback){
420-
421-
alarms *currentPtr, *newPtr;
422-
423-
currentPtr = _alarmsStartPtr;
424-
425-
if(isFirstAlarm){
426-
_alarmsStartPtr = (alarms*) malloc(sizeof (alarms));
427-
_alarmsStartPtr->hours = hours;
428-
_alarmsStartPtr->minutes = minutes;
429-
_alarmsStartPtr->seconds = seconds;
430-
_alarmsStartPtr->day = day;
431-
_alarmsStartPtr->month = month;
432-
_alarmsStartPtr->year = year;
433-
_alarmsStartPtr->typeOfMatch = (Alarm_Match) typeOfMatch;
434-
_alarmsStartPtr->thisCallback = callback;
435-
_alarmsStartPtr->nextAlarmPtr = NULL;
436-
isFirstAlarm = false;
437-
}
438-
else{
439-
while (currentPtr->nextAlarmPtr != NULL){
440-
currentPtr = currentPtr->nextAlarmPtr;
441-
}
442-
443-
newPtr = (alarms*) malloc(sizeof (alarms));
444-
newPtr->hours = hours;
445-
newPtr->minutes = minutes;
446-
newPtr->seconds = seconds;
447-
newPtr->day = day;
448-
newPtr->month = month;
449-
newPtr->year = year;
450-
newPtr->typeOfMatch = typeOfMatch;
451-
newPtr->thisCallback = callback;
452-
newPtr->nextAlarmPtr = NULL;
453-
}
454-
currentPtr->nextAlarmPtr = newPtr;
455-
456-
return newPtr;
457-
}
458-
459-
void RTCZero::destroyAlarm(void){
460-
alarms *currentPtr;
461-
462-
currentPtr = _alarmsStartPtr;
463-
_alarmsStartPtr = currentPtr->nextAlarmPtr;
464-
free(currentPtr);
465-
466-
}

src/RTCZero.h

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,6 @@
2424

2525
typedef void(*voidFuncPtr)(void);
2626

27-
typedef struct ALARMS{
28-
uint8_t seconds;
29-
uint8_t minutes;
30-
uint8_t hours;
31-
uint8_t day;
32-
uint8_t month;
33-
uint8_t year;
34-
uint8_t typeOfMatch;
35-
voidFuncPtr thisCallback;
36-
struct ALARMS *nextAlarmPtr;
37-
} alarms;
38-
3927
class RTCZero {
4028
public:
4129

@@ -50,10 +38,6 @@ class RTCZero {
5038
MATCH_YYMMDDHHMMSS = RTC_MODE2_MASK_SEL_YYMMDDHHMMSS_Val // Once, on a specific date and a specific time
5139
};
5240

53-
alarms *_alarmsStartPtr, *_alarmsEndPtr;
54-
55-
bool isFirstAlarm;
56-
5741
RTCZero() {};
5842
void begin();
5943

@@ -106,9 +90,7 @@ class RTCZero {
10690
void setAlarmMonth(uint8_t month);
10791
void setAlarmYear(uint8_t year);
10892
void setAlarmDate(uint8_t day, uint8_t month, uint8_t year);
109-
110-
void addAlarm(uint8_t hours, uint8_t minutes, uint8_t seconds, uint8_t day, uint8_t month, uint8_t year, uint8_t typeOfMatch, voidFuncPtr callback);
111-
void updateAlarms(void);
93+
11294
/* Epoch Functions */
11395

11496
uint32_t getEpoch();
@@ -123,9 +105,6 @@ class RTCZero {
123105
void RTCenable();
124106
void RTCreset();
125107
void RTCresetRemove();
126-
127-
alarms* insertAlarm (uint8_t hours, uint8_t minutes, uint8_t seconds, uint8_t day, uint8_t month, uint8_t year, uint8_t typeOfMatch, voidFuncPtr callback);
128-
void destroyAlarm(void);
129108
};
130109

131110
#endif // RTC_ZERO_H

0 commit comments

Comments
 (0)