Arduino RTC Library

Description

RTC library gives you opportunity to use the internal RTC of ATSAMD21G18A, the microcontroller mounted on M0 and M0PRO boards. This library use RTC in clock calendar mode with alarm. Time can be represented in 12h mode or 24h mode. The library class is “__RTCInt__” and when you want to use this library you have to type at top of sketch: “__#include __”.

Constants and internal structures

This library has some constants for time representation and for alarm.

Time representation constants: TIME_H24: time is represented in h24 mode then hour is in the range 0 – 23. TIME_H12: time is represented in h12 mode then hour is in the range 0 – 12 ANTI_MERIDIAN: used when time is represented in h12 mode. It's used when time is less than or equal to 12. POST_MERIDIAN: used when time is represented in h12 mode. It's used to represent time greater than 12:00.

This library has two internal structures available to store date and time. These structures are useful when you set date, time and also when you get them.

local_time structure: this structure has four fields: hour,minute,second and Tmode. Hour,minute and second are self explanatory, Tmode shows if time is AM or PM in case of representation mode is 12 hour format. Tmode field can be assume these values: ANTI_MERIDIAN or POST_MERIDIAN. When time representation is 24 hour mode, this field is useless.

local_date structure: this structure has three fields: day, month and year. These fields are self explanatory but keep in mind that the year is represented without offset than you have to add the correct offset when print out this field.