You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -227,8 +227,6 @@ The period can be specified using the following enumerations:
227
227
228
228
### Alarm Callback
229
229
230
-
231
-
232
230
-`RTC.setAlarmCallback(alarm_cbk, alarmtime, am)`
233
231
234
232
```arduino
@@ -259,206 +257,4 @@ void alarm_cbk() {
259
257
260
258
This tutorial shows how to use the RTC on the UNO R4 Minima, such as setting a start time, setting an alarm, or obtaining time in calendar or unix format.
261
259
262
-
Read more about this board in the [Arduino UNO R4 Minima documentation]().
263
-
264
-
---
265
-
266
-
## API
267
-
268
-
The API is listed below:
269
-
270
-
## RTClock Class
271
-
The `RTClock` class is responsible for managing the real-time clock. It provides methods for initializing the clock, retrieving the current time, setting periodic callbacks, setting alarm callbacks, checking if the clock is running, and setting the time.
272
-
273
-
### Constructor
274
-
-`RTClock()`
275
-
- Initializes a new `RTClock` object.
276
-
277
-
### Destructor
278
-
-`~RTClock()`
279
-
- Destroys the `RTClock` object.
280
-
281
-
### Member Functions
282
-
-`bool begin()`
283
-
- Initializes the real-time clock. Returns `true` if successful, `false` otherwise.
284
-
-`bool getTime(RTCTime &t)`
285
-
- Retrieves the current time and stores it in the provided `RTCTime` object. Returns `true` if successful, `false` otherwise.
286
-
-`bool setPeriodicCallback(rtc_cbk_t fnc, Period p)`
287
-
- Sets a periodic callback function to be called at the specified interval. The callback function should have the signature `void callback()`. Returns `true` if successful, `false` otherwise.
- Sets an alarm callback function to be called when the specified time and match conditions are met. The callback function should have the signature `void callback()`. Returns `true` if successful, `false` otherwise.
290
-
-`bool isRunning()`
291
-
- Checks if the real-time clock is running. Returns `true` if running, `false` otherwise.
292
-
-`bool setTime(RTCTime &t)`
293
-
- Sets the current time to the specified `RTCTime` object. Returns `true` if successful, `false` otherwise.
294
-
-`bool setTimeIfNotRunning(RTCTime &t)`
295
-
- Sets the current time to the specified `RTCTime` object only if the clock is not already running. Returns `true` if successful, `false` otherwise.
296
-
297
-
### External Object
298
-
-`RTClock RTC`
299
-
- An external instance of the `RTClock` class that can be used to access the real-time clock functionality.
300
-
301
-
## RTCTime Class
302
-
The `RTCTime` class represents a specific time and date. It provides methods for setting and retrieving different components of the time and date.
303
-
304
-
### Constructors
305
-
-`RTCTime()`
306
-
- Initializes a new `RTCTime` object with default values.
307
-
-`RTCTime(struct tm &t)`
308
-
- Initializes a new `RTCTime` object from a `struct tm` object.
309
-
-`RTCTime(int _day, Month _m, int _year, int _hours, int _minutes, int _seconds, DayOfWeek _dow, SaveLight _sl)`
310
-
- Initializes a new `RTCTime` object with the specified day, month, year, hours, minutes, seconds, day of the week, and daylight saving status.
311
-
312
-
### Destructor
313
-
-`~RTCTime()`
314
-
- Destroys the `RTCTime` object.
315
-
316
-
### Setters
317
-
-`bool setDayOfMonth(int day)`
318
-
- Sets the day of the month. Accepts a value from 1 to 31. Returns `true` if successful, `false` otherwise.
319
-
-`bool setMonthOfYear(Month m)`
320
-
- Sets the month of the year. Accepts a value from 1 (January) to 12 (December). Returns `true` if successful, `false` otherwise.
321
-
-`bool setYear(int year)`
322
-
- Sets the year. Accepts the year as a four-digit value (e.g., 1989 or 2022). Returns `true` if successful, `false` otherwise.
323
-
-`bool setHour(int hour)`
324
-
- Sets the hour. Accepts a value from 0 (midnight) to 23. Returns `true` if successful, `false` otherwise.
325
-
-`bool setMinute(int minute)`
326
-
- Sets the minute. Accepts a value from 0 to 59. Returns `true` if successful, `false` otherwise.
327
-
-`bool setSecond(int second)`
328
-
- Sets the second. Accepts a value from 0 to 59. Returns `true` if successful, `false` otherwise.
329
-
-`bool setDayOfWeek(DayOfWeek d)`
330
-
- Sets the day of the week. Accepts a value from 0 (Sunday) to 6 (Saturday). Returns `true` if successful, `false` otherwise.
331
-
-`bool setSaveLight(SaveLight sl)`
332
-
- Sets the daylight saving status. Accepts a `SaveLight` value (`SAVING_TIME_INACTIVE` or `SAVING_TIME_ACTIVE`). Returns `true` if successful, `false` otherwise.
333
-
-`void setTM(struct tm &t)`
334
-
- Sets the time and date using a `struct tm` object.
335
-
336
-
### Getters
337
-
-`int getDayOfMonth()`
338
-
- Returns the day of the month.
339
-
-`Month getMonth()`
340
-
- Returns the month of the year as a `Month` enum value.
341
-
-`int getYear()`
342
-
- Returns the year.
343
-
-`int getHour()`
344
-
- Returns the hour.
345
-
-`int getMinutes()`
346
-
- Returns the minutes.
347
-
-`int getSeconds()`
348
-
- Returns the seconds.
349
-
-`DayOfWeek getDayOfWeek()`
350
-
- Returns the day of the week as a `DayOfWeek` enum value.
351
-
-`time_t getUnixTime()`
352
-
- Returns the time in Unix timestamp format.
353
-
-`struct tm getTmTime()`
354
-
- Returns the time and date as a `struct tm` object.
355
-
356
-
## Enumerations
357
-
358
-
### Month
359
-
-`JANUARY`
360
-
-`FEBRUARY`
361
-
-`MARCH`
362
-
-`APRIL`
363
-
-`MAY`
364
-
-`JUNE`
365
-
-`JULY`
366
-
-`AUGUST`
367
-
-`SEPTEMBER`
368
-
-`OCTOBER`
369
-
-`NOVEMBER`
370
-
-`DECEMBER`
371
-
372
-
### DayOfWeek
373
-
-`MONDAY`
374
-
-`TUESDAY`
375
-
-`WEDNESDAY`
376
-
-`THURSDAY`
377
-
-`FRIDAY`
378
-
-`SATURDAY`
379
-
-`SUNDAY`
380
-
381
-
### SaveLight
382
-
-`SAVING_TIME_INACTIVE`
383
-
-`SAVING_TIME_ACTIVE`
384
-
385
-
## Structures
386
-
387
-
### Timeval
388
-
-`time_t tv_sec`
389
-
-`useconds_t tv_usec`
390
-
391
-
## Functions
392
-
The following functions are declared and defined in the library:
393
-
394
-
### External C Functions
395
-
-`void set_time(time_t t)`
396
-
-`void attach_rtc(time_t (*read_rtc)(void), void (*write_rtc)(time_t), void (*init_rtc)(void), int (*isenabled_rtc)(void))`
0 commit comments