Skip to content

Commit 179677b

Browse files
committed
Update rtc.md
1 parent 77f79b7 commit 179677b

File tree

1 file changed

+2
-206
lines changed
  • content/hardware/02.hero/boards/uno-r4-minima/tutorials/rtc

1 file changed

+2
-206
lines changed

content/hardware/02.hero/boards/uno-r4-minima/tutorials/rtc/rtc.md

Lines changed: 2 additions & 206 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The goals of this project are:
2020
## Hardware & Software Needed
2121

2222
- Arduino IDE ([online](https://create.arduino.cc/) or [offline](https://www.arduino.cc/en/main/software)).
23-
- [Arduino R4 Minima]().
23+
- [Arduino R4 Minima](/hardware/uno-r4-minima).
2424
- [Arduino Renesas Core](https://github.com/bcmi-labs/ArduinoCore-renesas)
2525

2626
## Real-Time Clock (RTC)
@@ -227,8 +227,6 @@ The period can be specified using the following enumerations:
227227

228228
### Alarm Callback
229229

230-
231-
232230
- `RTC.setAlarmCallback(alarm_cbk, alarmtime, am)`
233231

234232
```arduino
@@ -259,206 +257,4 @@ void alarm_cbk() {
259257

260258
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.
261259

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.
288-
- `bool setAlarmCallback(rtc_cbk_t fnc, RTCTime &t, AlarmMatch &m)`
289-
- 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))`
397-
- `int gettimeofday(struct timeval *tv, void *tz)`
398-
- `int settimeofday(const struct timeval *tv, const struct timezone *tz)`
399-
400-
### Helper Functions
401-
- `int Month2int(Month m)`
402-
- `int DayOfWeek2int(D
403-
404-
ayOfWeek dow, bool sunday_first)`
405-
- `bool SaveLigth2bool(SaveLight sl)`
406-
407-
### AlarmMatch Class
408-
The `AlarmMatch` class represents a set of match conditions for alarm triggers.
409-
410-
#### Constructor
411-
- `AlarmMatch()`
412-
- Initializes a new `AlarmMatch` object.
413-
414-
#### Destructor
415-
- `~AlarmMatch()`
416-
- Destroys the `AlarmMatch` object.
417-
418-
#### Member Functions
419-
- `void addMatchSecond()`
420-
- Adds a match condition for seconds.
421-
- `void addMatchMinute()`
422-
- Adds a match condition for minutes.
423-
- `void addMatchHour()`
424-
- Adds a match condition for hours.
425-
- `void addMatchDay()`
426-
- Adds a match condition for days.
427-
- `void addMatchMonth()`
428-
- Adds a match condition for months.
429-
- `void addMatchYear()`
430-
- Adds a match condition for years.
431-
- `void addMatchDayOfWeek()`
432-
- Adds a match condition for days of the week.
433-
- `void removeMatchSecond()`
434-
- Removes the match condition for seconds.
435-
- `void removeMatchMinute()`
436-
- Removes the match condition for minutes.
437-
- `void removeMatchHour()`
438-
- Removes the match condition for hours.
439-
- `void removeMatchDay()`
440-
- Removes the match condition for days.
441-
- `void removeMatchMonth()`
442-
- Removes the match condition for months.
443-
- `void removeMatchYear()`
444-
- Removes the match condition for years.
445-
- `void removeMatchDayOfWeek()`
446-
- Removes the match condition for days of the week.
447-
- `bool isMatchingSecond()`
448-
- Checks if the match condition for seconds is set.
449-
- `bool isMatchingMinute()`
450-
- Checks if the match condition for minutes is set.
451-
- `bool isMatchingHour()`
452-
- Checks if the match condition for hours is set.
453-
- `bool isMatchingDay()`
454-
- Checks if the match condition for days is set.
455-
- `bool isMatchingMonth()`
456-
- Checks if the match condition for months is set.
457-
- `bool isMatchingYear()`
458-
- Checks if the match condition for years is set.
459-
- `bool isMatchingDayOfWeek()`
460-
- Checks if the match condition for days of the week is set.
461-
462-
## Additional Definitions
463-
- `using stime_t = struct tm`
464-
- `using rtc_cbk_t = void (*)()`
260+
Read more about this board in the [Arduino UNO R4 Minima documentation](/hardware/uno-r4-minima).

0 commit comments

Comments
 (0)