mirror of
https://github.com/taigrr/arduinolibs
synced 2025-01-18 04:33:12 -08:00
Update alarm clock to support DS3232
This commit is contained in:
@@ -27,10 +27,11 @@
|
||||
#include <BoolField.h>
|
||||
#include <IntField.h>
|
||||
#include <SoftI2C.h>
|
||||
#include <DS1307RTC.h>
|
||||
#include <RTC.h>
|
||||
#include <Melody.h>
|
||||
#include <PowerSave.h>
|
||||
#include <avr/power.h>
|
||||
#include "Clock.h"
|
||||
#include "FrontScreen.h"
|
||||
#include "SetAlarm.h"
|
||||
#include "SetTime.h"
|
||||
@@ -59,7 +60,7 @@ LCD lcd;
|
||||
|
||||
// Activate the realtime clock chip.
|
||||
SoftI2C bus(RTC_DATA, RTC_CLOCK);
|
||||
DS1307RTC rtc(bus, RTC_ONE_HZ);
|
||||
Clock rtc(bus, RTC_ONE_HZ);
|
||||
|
||||
// Melody to play when the alarm sounds.
|
||||
int defaultMelodyNotes[5] = {NOTE_C6, NOTE_C6, NOTE_C6, NOTE_C6, NOTE_REST};
|
||||
|
||||
35
libraries/RTC/examples/AlarmClock/Clock.h
Normal file
35
libraries/RTC/examples/AlarmClock/Clock.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Southern Storm Software, Pty Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef Clock_h
|
||||
#define Clock_h
|
||||
|
||||
#include <DS1307RTC.h>
|
||||
#include <DS3232RTC.h>
|
||||
|
||||
// Select the specific type of realtime clock chip to use.
|
||||
typedef DS1307RTC Clock;
|
||||
//typedef DS3232RTC Clock;
|
||||
|
||||
extern Clock rtc;
|
||||
|
||||
#endif
|
||||
@@ -21,9 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "SetAlarm.h"
|
||||
#include <DS1307RTC.h>
|
||||
|
||||
extern DS1307RTC rtc;
|
||||
#include "Clock.h"
|
||||
|
||||
SetAlarm::SetAlarm(Form &form, const String &label, uint8_t alarmNum)
|
||||
: EditTime(form, label)
|
||||
|
||||
@@ -21,14 +21,12 @@
|
||||
*/
|
||||
|
||||
#include "SetDate.h"
|
||||
#include <DS1307RTC.h>
|
||||
#include "Clock.h"
|
||||
|
||||
#define EDIT_DAY 0
|
||||
#define EDIT_MONTH 1
|
||||
#define EDIT_YEAR 2
|
||||
|
||||
extern DS1307RTC rtc;
|
||||
|
||||
SetDate::SetDate(Form &form, const String &label)
|
||||
: Field(form, label)
|
||||
, editField(EDIT_DAY)
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "SetTime.h"
|
||||
#include <DS1307RTC.h>
|
||||
|
||||
extern DS1307RTC rtc;
|
||||
#include "Clock.h"
|
||||
|
||||
SetTime::SetTime(Form &form, const String &label)
|
||||
: EditTime(form, label)
|
||||
|
||||
Reference in New Issue
Block a user