@@ -59,8 +59,8 @@ PCF8563TClass::PCF8563TClass()
59
59
60
60
/* *
61
61
* Start the communication with the RTC
62
- *
63
- * @return true if the RTC Controller is on the I2C bus, false in case it is not in the bus .
62
+ * Initialize I2C (Wire1) bus and check if the chip is connected trhoug sending an ACK on the I2C bus.
63
+ * @return true if the RTC Controller is on the I2C bus, false if it is not.
64
64
*
65
65
*/
66
66
bool PCF8563TClass::begin ()
@@ -75,9 +75,9 @@ bool PCF8563TClass::begin()
75
75
}
76
76
77
77
/* *
78
- * Set Year number
79
- *
80
- * @param years Year's number
78
+ * Set Year number's value
79
+ * Save an unsigned byte with the Year's value
80
+ * @param years Year's unsigned byte
81
81
*/
82
82
void PCF8563TClass::setYears (uint8_t years) {
83
83
uint8_t dec = years / 10 ;
@@ -86,9 +86,9 @@ void PCF8563TClass::setYears(uint8_t years) {
86
86
}
87
87
88
88
/* *
89
- * Set Month number
90
- *
91
- * @param months Month's number (0 to 12)
89
+ * Set Month number's value
90
+ * Save an unsigned byte with the Month's value
91
+ * @param months Month's unsigned byte (0 to 12)
92
92
*/
93
93
void PCF8563TClass::setMonths (uint8_t months) {
94
94
uint8_t offset = 0 ;
@@ -99,9 +99,9 @@ void PCF8563TClass::setMonths(uint8_t months) {
99
99
}
100
100
101
101
/* *
102
- * Set Day number
103
- *
104
- * @param days day's number
102
+ * Set Day number's value
103
+ * Save an unsigned byte with the Day's value
104
+ * @param days day's unsigned byte
105
105
*/
106
106
void PCF8563TClass::setDays (uint8_t days) {
107
107
uint8_t dec = days / 10 ;
@@ -110,9 +110,9 @@ void PCF8563TClass::setDays(uint8_t days) {
110
110
}
111
111
112
112
/* *
113
- * Set Hour
114
- *
115
- * @param hours hour number
113
+ * Set Hour(s) number's value
114
+ * Save an unsigned byte with the Hour(s) value
115
+ * @param hours hour unsigned byte (0 - 23)
116
116
*/
117
117
void PCF8563TClass::setHours (uint8_t hours) {
118
118
uint8_t dec = hours / 10 ;
@@ -121,9 +121,9 @@ void PCF8563TClass::setHours(uint8_t hours) {
121
121
}
122
122
123
123
/* *
124
- * Set Minute
125
- *
126
- * @param minutes minute number
124
+ * Set Minute(s) number's value
125
+ * Save an unsigned byte with the Minute(s) value
126
+ * @param minutes minute unsigned byte (0-60)
127
127
*/
128
128
void PCF8563TClass::setMinutes (uint8_t minutes) {
129
129
uint8_t dec = minutes / 10 ;
@@ -132,9 +132,9 @@ void PCF8563TClass::setMinutes(uint8_t minutes) {
132
132
}
133
133
134
134
/* *
135
- * Set Second number
136
- *
137
- * @param seconds Second number
135
+ * Set Second(s) number's value
136
+ * Save an unsigned byte with the Second(s) value
137
+ * @param seconds Second(s) unsigned byte (0-60)
138
138
*/
139
139
void PCF8563TClass::setSeconds (uint8_t seconds) {
140
140
uint8_t dec = seconds / 10 ;
@@ -143,20 +143,20 @@ void PCF8563TClass::setSeconds(uint8_t seconds) {
143
143
}
144
144
145
145
/* *
146
- * Get Year number
147
- *
148
- * @return number of years
146
+ * Get Year(s) number's value
147
+ * Get unsigned byte with the Year(s) value
148
+ * @return byte with Year(s) value
149
149
*/
150
150
uint8_t PCF8563TClass::getYears () {
151
151
uint8_t years = readByte (PCF8563T_YEARS_REG);
152
152
return (years & 0x0F ) + ((years >> 4 )*10 );
153
153
}
154
154
155
155
/* *
156
- * Get Month number
157
- *
158
- * @return number of month
159
- */
156
+ * Get Month(s) month's value
157
+ * Get unsigned byte with the month(s) value
158
+ * @return byte with Month(s) value
159
+ */
160
160
uint8_t PCF8563TClass::getMonths () {
161
161
uint8_t months = readByte (PCF8563T_MONTHS_REG) & 0x1F ;
162
162
if (months > 9 ) {
@@ -167,47 +167,47 @@ uint8_t PCF8563TClass::getMonths() {
167
167
}
168
168
169
169
/* *
170
- * Get Day number
171
- *
172
- * @return number of days
173
- */
170
+ * Get Day(s) number's value
171
+ * Get unsigned byte with the Day(s) value
172
+ * @return byte with Day(s) value
173
+ */
174
174
uint8_t PCF8563TClass::getDays () {
175
175
uint8_t days = readByte (PCF8563T_DAYS_REG);
176
176
return (days & 0x0F ) + ((days >> 4 )*10 );
177
177
}
178
178
179
179
/* *
180
- * Get Hour number
181
- *
182
- * @return number of hours
183
- */
180
+ * Get Hour(s) number's value
181
+ * Get unsigned byte with the Hour(s) value
182
+ * @return byte with Hour(s) value
183
+ */
184
184
uint8_t PCF8563TClass::getHours () {
185
185
uint8_t hours = readByte (PCF8563T_HOURS_REG) & 0x3F ;
186
186
return (hours & 0x0F ) + ((hours >> 4 )*10 );
187
187
}
188
188
189
189
/* *
190
- * Get Minute number
191
- *
192
- * @return number of minutes
193
- */
190
+ * Get Minute(s) number's value
191
+ * Get unsigned byte with the Minute(s) value
192
+ * @return byte with Minute(s) value
193
+ */
194
194
uint8_t PCF8563TClass::getMinutes () {
195
195
uint8_t minutes = (readByte (PCF8563T_MINUTES_REG)) & 0x7F ;
196
196
return (minutes & 0x0F ) + ((minutes >> 4 )*10 );
197
197
}
198
198
199
199
/* *
200
- * Get Second number
201
- *
202
- * @return number of seconds
203
- */
200
+ * Get Second(s) number's value
201
+ * Get unsigned byte with the Second(s) value
202
+ * @return byte with Second(s) value
203
+ */
204
204
uint8_t PCF8563TClass::getSeconds () {
205
205
uint8_t seconds = readByte (PCF8563T_VL_SECONDS_REG) & 0x7F ;
206
206
return (seconds & 0x0F ) + ((seconds >> 4 )*10 );
207
207
}
208
208
209
209
/* *
210
- * Set time by epoch
210
+ * Set time Epoch format
211
211
*
212
212
*/
213
213
void PCF8563TClass::setEpoch () {
@@ -224,9 +224,10 @@ void PCF8563TClass::setEpoch() {
224
224
}
225
225
226
226
/* *
227
- * Set time by epoch
227
+ * Set time with Epoch format
228
+ *
228
229
*
229
- * @param seconds number of seconds
230
+ * @param seconds number of seconds (time_t type)
230
231
*/
231
232
void PCF8563TClass::setEpoch (time_t seconds) {
232
233
struct tm time;
@@ -242,8 +243,11 @@ void PCF8563TClass::setEpoch(time_t seconds) {
242
243
}
243
244
244
245
/* *
245
- * Set time by epoch
246
+ * Set time with Epoch format
246
247
*
248
+ * Convert the input values to Epoch format
249
+ * example: Tue, 06 Jul 2021 11:55:27 GMT -> 1625572527
250
+ *
247
251
* @param years number of years
248
252
* @param mohths number of months
249
253
* @param days number of days
@@ -267,9 +271,13 @@ void PCF8563TClass::setEpoch(uint8_t years, uint8_t months, uint8_t days, uint8_
267
271
}
268
272
269
273
/* *
270
- * Get epoch number, convert real time to difference between actual time and epoch(Unix time)
271
- *
272
- * @return number of seconds after Unix time
274
+ * Get epoch number
275
+ * Convert real time to difference between actual time and Epoch(Unix time)
276
+ * Saved into time_t type
277
+ *
278
+ * example: 1625572527 -> Tue, 06 Jul 2021 11:55:27 GMT
279
+ *
280
+ * @return number of seconds after Unix time (time_t type)
273
281
*/
274
282
time_t PCF8563TClass::getEpoch () {
275
283
struct tm time;
@@ -287,15 +295,15 @@ time_t PCF8563TClass::getEpoch() {
287
295
}
288
296
289
297
/* *
290
- * Enable alarm mode
298
+ * Enable alarm
291
299
*
292
300
*/
293
301
void PCF8563TClass::enableAlarm () {
294
302
writeByte (PCF8563T_STATUS_2_REG, (readByte (PCF8563T_STATUS_2_REG) & PCF8563T_STATUS_2_CLEAR_INT) | PCF8563T_STATUS_2_AIE_MASK);
295
303
}
296
304
297
305
/* *
298
- * Disable alarm mode
306
+ * Disable alarm
299
307
*
300
308
*/
301
309
void PCF8563TClass::disableAlarm () {
@@ -313,8 +321,7 @@ void PCF8563TClass::clearAlarm() {
313
321
/* *
314
322
* Set alarm's minute
315
323
*
316
- * @param minutes minute number for the Aarm
317
- * @return none
324
+ * @param minutes minute(s) value for the Alarm (byte type)
318
325
*/
319
326
void PCF8563TClass::setMinuteAlarm (uint8_t minutes) {
320
327
uint8_t dec = minutes / 10 ;
@@ -334,7 +341,7 @@ void PCF8563TClass::disableMinuteAlarm() {
334
341
/* *
335
342
* Set Alarm's hour
336
343
*
337
- * @param hours hour number for the Alarm
344
+ * @param hours hour(s) value for the Alarm (byte type)
338
345
*/
339
346
void PCF8563TClass::setHourAlarm (uint8_t hours) {
340
347
uint8_t dec = hours / 10 ;
@@ -354,7 +361,7 @@ void PCF8563TClass::disableHourAlarm() {
354
361
/* *
355
362
* Set Alarm's day
356
363
*
357
- * @param days day number for the Alarm
364
+ * @param days day value for the Alarm (byte type)
358
365
*/
359
366
void PCF8563TClass::setDayAlarm (uint8_t days) {
360
367
uint8_t dec = days / 10 ;
0 commit comments