Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit d418048

Browse files
fix mispelling of RTC methods
1 parent c0bafb8 commit d418048

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

examples/RTC/RTC.ino

+9-9
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
#include <Arduino_MachineControl.h>
1515

16-
int years = 20;
17-
int months = 9;
18-
int days = 24;
16+
int year = 20;
17+
int month = 9;
18+
int day = 24;
1919
int hours = 12;
2020
int minutes = 43;
2121
int seconds = 31;
@@ -36,9 +36,9 @@ void setup() {
3636
// The RTC time can be set as epoch, using one of the following two options:
3737
// - Calendar time: MachineControl_RTCController.setEpoch(years, months, days, hours, minutes, seconds);
3838
// - UTC time: MachineControl_RTCController.setEpoch(date_in_seconds);
39-
MachineControl_RTCController.setYears(years);
40-
MachineControl_RTCController.setMonths(months);
41-
MachineControl_RTCController.setDays(days);
39+
MachineControl_RTCController.setYear(year);
40+
MachineControl_RTCController.setMonth(month);
41+
MachineControl_RTCController.setDay(day);
4242
MachineControl_RTCController.setHours(hours);
4343
MachineControl_RTCController.setMinutes(minutes);
4444
MachineControl_RTCController.setSeconds(seconds);
@@ -48,11 +48,11 @@ void setup() {
4848
void loop() {
4949
// APIs to get date's fields
5050
Serial.print("Date: ");
51-
Serial.print(MachineControl_RTCController.getYears());
51+
Serial.print(MachineControl_RTCController.getYear());
5252
Serial.print("/");
53-
Serial.print(MachineControl_RTCController.getMonths());
53+
Serial.print(MachineControl_RTCController.getMonth());
5454
Serial.print("/");
55-
Serial.print(MachineControl_RTCController.getDays());
55+
Serial.print(MachineControl_RTCController.getDay());
5656
Serial.print(" - ");
5757
Serial.print(MachineControl_RTCController.getHours());
5858
Serial.print(":");

src/utility/RTC/PCF8563T.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ bool PCF8563TClass::begin()
7979
* Save an unsigned byte with the Year's value
8080
* @param years Year's unsigned byte
8181
*/
82-
void PCF8563TClass::setYears(uint8_t years) {
82+
void PCF8563TClass::setYear(uint8_t years) {
8383
uint8_t dec = years / 10;
8484
uint8_t unit = years - (dec * 10);
8585
writeByte(PCF8563T_YEARS_REG, ((dec << 4) + unit));
@@ -90,7 +90,7 @@ void PCF8563TClass::setYears(uint8_t years) {
9090
* Save an unsigned byte with the Month's value
9191
* @param months Month's unsigned byte (0 to 12)
9292
*/
93-
void PCF8563TClass::setMonths(uint8_t months) {
93+
void PCF8563TClass::setMonth(uint8_t months) {
9494
uint8_t offset = 0;
9595
if (months > 9) {
9696
offset = 6;
@@ -103,7 +103,7 @@ void PCF8563TClass::setMonths(uint8_t months) {
103103
* Save an unsigned byte with the Day's value
104104
* @param days day's unsigned byte
105105
*/
106-
void PCF8563TClass::setDays(uint8_t days) {
106+
void PCF8563TClass::setDay(uint8_t days) {
107107
uint8_t dec = days / 10;
108108
uint8_t unit = days - (dec * 10);
109109
writeByte(PCF8563T_DAYS_REG, ((dec << 4) + unit));
@@ -147,7 +147,7 @@ void PCF8563TClass::setSeconds(uint8_t seconds) {
147147
* Get unsigned byte with the Year(s) value
148148
* @return byte with Year(s) value
149149
*/
150-
uint8_t PCF8563TClass::getYears() {
150+
uint8_t PCF8563TClass::getYear() {
151151
uint8_t years = readByte(PCF8563T_YEARS_REG);
152152
return (years & 0x0F) + ((years >> 4)*10);
153153
}
@@ -157,7 +157,7 @@ uint8_t PCF8563TClass::getYears() {
157157
* Get unsigned byte with the month(s) value
158158
* @return byte with Month(s) value
159159
*/
160-
uint8_t PCF8563TClass::getMonths() {
160+
uint8_t PCF8563TClass::getMonth() {
161161
uint8_t months = readByte(PCF8563T_MONTHS_REG) & 0x1F;
162162
if(months > 9) {
163163
return months - 6;
@@ -171,7 +171,7 @@ uint8_t PCF8563TClass::getMonths() {
171171
* Get unsigned byte with the Day(s) value
172172
* @return byte with Day(s) value
173173
*/
174-
uint8_t PCF8563TClass::getDays() {
174+
uint8_t PCF8563TClass::getDay() {
175175
uint8_t days = readByte(PCF8563T_DAYS_REG) & 0x3F;
176176
return (days & 0x0F) + ((days >> 4)*10);
177177
}
@@ -215,9 +215,9 @@ void PCF8563TClass::setEpoch() {
215215
time.tm_sec = getSeconds();
216216
time.tm_min = getMinutes();
217217
time.tm_hour = getHours();
218-
time.tm_mday = getDays();
219-
time.tm_mon = getMonths() - 1;
220-
time.tm_year = getYears() + 100;
218+
time.tm_mday = getDay();
219+
time.tm_mon = getMonth() - 1;
220+
time.tm_year = getYear() + 100;
221221
time_t seconds;
222222
_rtc_maketime(&time, &seconds, RTC_FULL_LEAP_YEAR_SUPPORT);
223223
set_time(seconds);
@@ -236,9 +236,9 @@ void PCF8563TClass::setEpoch(time_t seconds) {
236236
setSeconds(time.tm_sec);
237237
setMinutes(time.tm_min);
238238
setHours( time.tm_hour);
239-
setDays(time.tm_mday);
240-
setMonths(time.tm_mon + 1);
241-
setYears((time.tm_year - 100));
239+
setDay(time.tm_mday);
240+
setMonth(time.tm_mon + 1);
241+
setYear((time.tm_year - 100));
242242
set_time(seconds);
243243
}
244244

@@ -286,9 +286,9 @@ time_t PCF8563TClass::getEpoch() {
286286
time.tm_sec = getSeconds();
287287
time.tm_min = getMinutes();
288288
time.tm_hour = getHours();
289-
time.tm_mday = getDays();
290-
time.tm_mon = getMonths() - 1;
291-
time.tm_year = getYears() + 100; // year since 1900
289+
time.tm_mday = getDay();
290+
time.tm_mon = getMonth() - 1;
291+
time.tm_year = getYear() + 100; // year since 1900
292292

293293
_rtc_maketime(&time, &seconds, RTC_FULL_LEAP_YEAR_SUPPORT);
294294
return seconds;

src/utility/RTC/PCF8563T.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ class PCF8563TClass {
3131
public:
3232
PCF8563TClass();
3333
bool begin();
34-
void setYears(uint8_t years);
35-
void setMonths(uint8_t months);
36-
void setDays(uint8_t days);
34+
void setYear(uint8_t years);
35+
void setMonth(uint8_t months);
36+
void setDay(uint8_t days);
3737
void setHours(uint8_t hours);
3838
void setMinutes(uint8_t minutes);
3939
void setSeconds(uint8_t seconds);
4040

41-
uint8_t getYears();
42-
uint8_t getMonths();
43-
uint8_t getDays();
41+
uint8_t getYear();
42+
uint8_t getMonth();
43+
uint8_t getDay();
4444
uint8_t getHours();
4545
uint8_t getMinutes();
4646
uint8_t getSeconds();

0 commit comments

Comments
 (0)