-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9375f89
commit 9cc3282
Showing
20 changed files
with
1,625 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ extern "C"{ | |
#undef DAC1 | ||
#undef SPI1 | ||
#undef SPI2 | ||
#undef RTC | ||
|
||
#define F_CPU SystemCoreClock | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
Epoch time example for Arduino Zero and MKR1000 | ||
Demonstrates how to set time using epoch for the Arduino Zero and MKR1000 | ||
This example code is in the public domain | ||
created by Sandeep Mistry <[email protected]> | ||
31 Dec 2015 | ||
modified | ||
18 Feb 2016 | ||
*/ | ||
|
||
#include <RTC.h> | ||
|
||
void setup() { | ||
Serial.begin(9600); | ||
|
||
RTC.setEpoch(1451606400); // Jan 1, 2016 | ||
} | ||
|
||
void loop() { | ||
Serial.print("Unix time = "); | ||
Serial.println(RTC.getEpoch()); | ||
|
||
Serial.print("Seconds since Jan 1 2000 = "); | ||
Serial.println(RTC.getY2kEpoch()); | ||
|
||
// Print date... | ||
Serial.print(RTC.getDay()); | ||
Serial.print("/"); | ||
Serial.print(RTC.getMonth()); | ||
Serial.print("/"); | ||
Serial.print(RTC.getYear()); | ||
Serial.print("\t"); | ||
|
||
// ...and time | ||
print2digits(RTC.getHours()); | ||
Serial.print(":"); | ||
print2digits(RTC.getMinutes()); | ||
Serial.print(":"); | ||
print2digits(RTC.getSeconds()); | ||
|
||
Serial.println(); | ||
|
||
delay(1000); | ||
} | ||
|
||
void print2digits(int number) { | ||
if (number < 10) { | ||
Serial.print("0"); | ||
} | ||
Serial.print(number); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
Simple RTC for Arduino Zero and MKR1000 | ||
Demonstrates the use of the RTC library for the Arduino Zero and MKR1000 | ||
This example code is in the public domain | ||
http://arduino.cc/en/Tutorial/SimpleRTC | ||
created by Arturo Guadalupi <[email protected]> | ||
15 Jun 2015 | ||
modified | ||
18 Feb 2016 | ||
modified by Andrea Richetta <[email protected]> | ||
24 Aug 2016 | ||
*/ | ||
|
||
#include <RTC.h> | ||
|
||
/* Change these values to set the current initial time */ | ||
const byte seconds = 0; | ||
const byte minutes = 0; | ||
const byte hours = 16; | ||
|
||
/* Change these values to set the current initial date */ | ||
const byte day = 15; | ||
const byte month = 6; | ||
const byte year = 15; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
|
||
// Set the time | ||
RTC.setHours(hours); | ||
RTC.setMinutes(minutes); | ||
RTC.setSeconds(seconds); | ||
|
||
// Set the date | ||
RTC.setDay(day); | ||
RTC.setMonth(month); | ||
RTC.setYear(year); | ||
|
||
// you can use also | ||
//RTC.setTime(hours, minutes, seconds); | ||
//RTC.setDate(day, month, year); | ||
} | ||
|
||
void loop() | ||
{ | ||
// Print date... | ||
print2digits(RTC.getDay()); | ||
Serial.print("/"); | ||
print2digits(RTC.getMonth()); | ||
Serial.print("/"); | ||
print2digits(RTC.getYear()); | ||
Serial.print(" "); | ||
|
||
// ...and time | ||
print2digits(RTC.getHours()); | ||
Serial.print(":"); | ||
print2digits(RTC.getMinutes()); | ||
Serial.print(":"); | ||
print2digits(RTC.getSeconds()); | ||
|
||
Serial.println(); | ||
|
||
delay(1000); | ||
} | ||
|
||
|
||
|
||
void print2digits(int number) { | ||
if (number < 10) { | ||
Serial.print("0"); // print a 0 before if the number is < than 10 | ||
} | ||
Serial.print(number); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
Simple RTC Alarm for Arduino Zero and MKR1000 | ||
Demonstrates how to set an RTC alarm for the Arduino Zero and MKR1000 | ||
This example code is in the public domain | ||
http://arduino.cc/en/Tutorial/SimpleRTCAlarm | ||
created by Arturo Guadalupi <[email protected]> | ||
25 Sept 2015 | ||
modified | ||
21 Oct 2015 | ||
*/ | ||
|
||
#include <RTC.h> | ||
|
||
/* Change these values to set the current initial time */ | ||
const byte seconds = 0; | ||
const byte minutes = 0; | ||
const byte hours = 16; | ||
|
||
/* Change these values to set the current initial date */ | ||
const byte day = 25; | ||
const byte month = 9; | ||
const byte year = 15; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
|
||
RTC.setTime(hours, minutes, seconds); | ||
RTC.setDate(day, month, year); | ||
|
||
RTC.setAlarmTime(16, 0, 10); | ||
RTC.enableAlarm(RTC.MATCH_HHMMSS); | ||
|
||
RTC.attachInterrupt(alarmMatch); | ||
} | ||
|
||
void loop() | ||
{ | ||
|
||
} | ||
|
||
void alarmMatch() | ||
{ | ||
Serial.println("Alarm Match!"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
####################################### | ||
# Syntax Coloring Map For RTC | ||
####################################### | ||
|
||
####################################### | ||
# Datatypes (KEYWORD1) | ||
####################################### | ||
|
||
RTCZero KEYWORD1 | ||
|
||
####################################### | ||
# Methods and Functions (KEYWORD2) | ||
####################################### | ||
|
||
getDay KEYWORD2 | ||
getMonth KEYWORD2 | ||
getYear KEYWORD2 | ||
getHours KEYWORD2 | ||
getMinutes KEYWORD2 | ||
getSeconds KEYWORD2 | ||
|
||
setDay KEYWORD2 | ||
setMonth KEYWORD2 | ||
setYear KEYWORD2 | ||
setHours KEYWORD2 | ||
setMinutes KEYWORD2 | ||
setSeconds KEYWORD2 | ||
setDate KEYWORD2 | ||
setTime KEYWORD2 | ||
|
||
getEpoch KEYWORD2 | ||
getY2kEpoch KEYWORD2 | ||
setEpoch KEYWORD2 | ||
setY2kEpoch KEYWORD2 | ||
|
||
getAlarmDay KEYWORD2 | ||
getAlarmMonth KEYWORD2 | ||
getAlarmYear KEYWORD2 | ||
getAlarmHours KEYWORD2 | ||
getAlarmMinutes KEYWORD2 | ||
getAlarmSeconds KEYWORD2 | ||
|
||
setAlarmDay KEYWORD2 | ||
setAlarmMonth KEYWORD2 | ||
setAlarmYear KEYWORD2 | ||
setAlarmHours KEYWORD2 | ||
setAlarmMinutes KEYWORD2 | ||
setAlarmSeconds KEYWORD2 | ||
setAlarmDate KEYWORD2 | ||
setAlarmTime KEYWORD2 | ||
|
||
enableAlarm KEYWORD2 | ||
disableAlarm KEYWORD2 | ||
|
||
####################################### | ||
# Constants (LITERAL1) | ||
####################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name=RTC | ||
version=1.0 | ||
author=Thomas Roell | ||
maintainer[email protected] | ||
sentence=Allows to use the RTC functionalities. | ||
paragraph=With this library you can use the RTC peripheral to program actions related to date and time. | ||
category=Timing | ||
url=http://www.arduino.cc/en/Reference/RTCZero | ||
architectures=stm32l4 |
Oops, something went wrong.