uRTCLib
https://github.com/Naguissa/uRTCLib
Loading...
Searching...
No Matches
Classes | Macros
uRTCLib.h File Reference

uRTCLib header file More...

#include "Arduino.h"
#include <Wire.h>
Include dependency graph for uRTCLib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  uRTCLib
 DS1307, DS3231 and DS3232 RTCs basic library. More...
 

Macros

#define URTCLIB
 Prevent multiple inclussion.
 
#define URTCLIB_WIRE   Wire
 
#define URTCLIB_ADDRESS   0x68
 Default RTC I2C address.
 
#define URTCLIB_MODEL_DS1307   1
 Model definition, DS1307.
 
#define URTCLIB_MODEL_DS3231   2
 Model definition, DS3231.
 
#define URTCLIB_MODEL_DS3232   3
 Model definition, DS3232.
 
#define URTCLIB_WEEKDAY_SUNDAY   1
 Week day definition, [Mon..Sun] as [1..7]. Sunday.
 
#define URTCLIB_WEEKDAY_MONDAY   2
 Week day definition, [Mon..Sun] as [1..7]. Monday.
 
#define URTCLIB_WEEKDAY_TUESDAY   3
 Week day definition, [Mon..Sun] as [1..7]. Tuesday.
 
#define URTCLIB_WEEKDAY_WEDNESDAY   4
 Week day definition, [Mon..Sun] as [1..7]. Wednesday.
 
#define URTCLIB_WEEKDAY_THURSDAY   5
 Week day definition, [Mon..Sun] as [1..7]. Thursday.
 
#define URTCLIB_WEEKDAY_FRIDAY   6
 Week day definition, [Mon..Sun] as [1..7]. Friday.
 
#define URTCLIB_WEEKDAY_SATURDAY   7
 Week day definition, [Mon..Sun] as [1..7]. Saturday.
 
#define URTCLIB_ALARM_TYPE_1_NONE   0b00000000
 Alarm 1 - Disabled.
 
#define URTCLIB_ALARM_TYPE_1_ALL_S   0b00101111
 Alarm 1 - Trigger every second.
 
#define URTCLIB_ALARM_TYPE_1_FIXED_S   0b00101110
 Alarm 1 - Trigger every minute at a fixed second.
 
#define URTCLIB_ALARM_TYPE_1_FIXED_MS   0b00101100
 Alarm 1 - Trigger every hour at a fixed minute and second.
 
#define URTCLIB_ALARM_TYPE_1_FIXED_HMS   0b00101000
 Alarm 1 - Trigger every day at a fixed hour, minute and second.
 
#define URTCLIB_ALARM_TYPE_1_FIXED_DHMS   0b00100000
 Alarm 1 - Trigger every month at a fixed day, hour, minute and second.
 
#define URTCLIB_ALARM_TYPE_1_FIXED_DOWHMS   0b00110000
 Alarm 1 - Trigger every week at a fixed day-of-week, hour, minute and second.
 
#define URTCLIB_ALARM_TYPE_2_NONE   0b10000000
 Alarm 2 - Disabled.
 
#define URTCLIB_ALARM_TYPE_2_ALL_M   0b10101110
 Alarm 2 - Trigger every minute at 00 seconds.
 
#define URTCLIB_ALARM_TYPE_2_FIXED_M   0b10101100
 Alarm 2 - Trigger every hour at minute and 00 seconds.
 
#define URTCLIB_ALARM_TYPE_2_FIXED_HM   0b10101000
 Alarm 2 - Trigger every day at hour, minute and 00 seconds.
 
#define URTCLIB_ALARM_TYPE_2_FIXED_DHM   0b10100000
 Alarm 2 - Trigger every month at day, hour, minute and 00 seconds.
 
#define URTCLIB_ALARM_TYPE_2_FIXED_DOWHM   0b10110000
 Alarm 2 - Trigger every week at day-of-week, hour, minute and 00 seconds.
 
#define URTCLIB_ALARM_1   URTCLIB_ALARM_TYPE_1_NONE
 When requesting for Alarm 1.
 
#define URTCLIB_ALARM_2   URTCLIB_ALARM_TYPE_2_NONE
 When requesting for Alarm 2.
 
#define URTCLIB_ALARM_ANY   0b01010101
 When requesting for any of both alarms, for triggered alarms.
 
#define URTCLIB_SQWG_OFF_0   0b11111111
 SQWG OFF, keeps output low.
 
#define URTCLIB_SQWG_OFF_1   0b11111110
 SQWG OFF, keeps output hight.
 
#define URTCLIB_SQWG_1H   0b00000000
 SQWG running at 1Hz.
 
#define URTCLIB_SQWG_1024H   0b00001000
 SQWG running at 1024Hz.
 
#define URTCLIB_SQWG_4096H   0b00010000
 SQWG running at 4096Hz.
 
#define URTCLIB_SQWG_8192H   0b00011000
 SQWG running at 8192Hz.
 
#define URTCLIB_SQWG_32768H   0b00000011
 SQWG running at 32768Hz.
 
#define URTCLIB_TEMP_ERROR   32767
 Temperarure read error indicator return value.
 
#define uRTCLIB_decToBcd(val)   ((uint8_t) ((val / 10 * 16) + (val % 10)))
 Convert normal decimal numbers to binary coded decimal.
 
#define uRTCLIB_bcdToDec(val)   ((uint8_t) ((val / 16 * 10) + (val % 16)))
 Convert binary coded decimal to normal decimal numbers.
 
#define uRTCLIB_YIELD
 

Detailed Description

uRTCLib header file

Macro Definition Documentation

◆ URTCLIB_ADDRESS

#define URTCLIB_ADDRESS   0x68

Default RTC I2C address.

Usual address is 0x68

◆ URTCLIB_ALARM_TYPE_1_NONE

#define URTCLIB_ALARM_TYPE_1_NONE   0b00000000

Alarm 1 - Disabled.

Alarm1 structure:

bit 0 - A1M1 bit 1 - A1M2 bit 2 - A1M3 bit 3 - A1M4 bit 4 - A1 DT/DY bit 5 - A1 Enabled bit 6 - Unused, always 0 bit 7 - Always 0

◆ URTCLIB_ALARM_TYPE_2_NONE

#define URTCLIB_ALARM_TYPE_2_NONE   0b10000000

Alarm 2 - Disabled.

Alarm1 structure:

bit 0 - A2M1 - Unused, always 0 bit 1 - A2M2 bit 2 - A2M3 bit 3 - A2M4 bit 4 - A2 DT/DY bit 5 - A2 Enabled bit 6 - Unused, always 0 bit 7 - Always 1

◆ URTCLIB_SQWG_1024H

#define URTCLIB_SQWG_1024H   0b00001000

SQWG running at 1024Hz.

Not valid for DS1307

◆ URTCLIB_SQWG_32768H

#define URTCLIB_SQWG_32768H   0b00000011

SQWG running at 32768Hz.

Only valid for DS1307

◆ URTCLIB_SQWG_OFF_0

#define URTCLIB_SQWG_OFF_0   0b11111111

SQWG OFF, keeps output low.

Only valid for DS1307

◆ URTCLIB_TEMP_ERROR

#define URTCLIB_TEMP_ERROR   32767

Temperarure read error indicator return value.

327.67ยบ, obviously erroneous