DS3231 based on Adafruit RTClib
Go to the source code of this file.
Functions | |
| static uint16_t | date2days (uint16_t y, uint8_t m, uint8_t d) |
| Given a date, return number of days since 2000/01/01, valid for 2001..2099. | |
| static long | time2long (uint16_t days, uint8_t h, uint8_t m, uint8_t s) |
| Given a number of days, hours, minutes, and seconds, return the total seconds. | |
| static uint8_t | conv2d (const char *p) |
| Convert a string containing two digits to uint8_t, e.g. "09" returns 9. | |
| static uint8_t | bcd2bin (uint8_t val) |
| Convert a binary coded decimal value to binary. RTC stores time/date values as BCD. | |
| static uint8_t | bin2bcd (uint8_t val) |
| Convert a binary value to BCD format for the RTC registers. | |
Variables | |
| const uint8_t | daysInMonth [] = { 31,28,31,30,31,30,31,31,30,31,30 } |
| Number of days in each month, from January to November. | |
Detailed Description
Definition in file RTClib.cpp.
Function Documentation
| static uint8_t bcd2bin | ( | uint8_t | val ) | [static] |
Convert a binary coded decimal value to binary. RTC stores time/date values as BCD.
- Parameters:
-
val BCD value
- Returns:
- Binary value
Definition at line 559 of file RTClib.cpp.
| static uint8_t bin2bcd | ( | uint8_t | val ) | [static] |
Convert a binary value to BCD format for the RTC registers.
- Parameters:
-
val Binary value
- Returns:
- BCD value
Definition at line 571 of file RTClib.cpp.
| static uint8_t conv2d | ( | const char * | p ) | [static] |
Convert a string containing two digits to uint8_t, e.g. "09" returns 9.
- Parameters:
-
p Pointer to a string containing two digits
Definition at line 213 of file RTClib.cpp.
| static uint16_t date2days | ( | uint16_t | y, |
| uint8_t | m, | ||
| uint8_t | d | ||
| ) | [static] |
Given a date, return number of days since 2000/01/01, valid for 2001..2099.
- Parameters:
-
y Year m Month d Day
- Returns:
- Number of days
Definition at line 106 of file RTClib.cpp.
| static long time2long | ( | uint16_t | days, |
| uint8_t | h, | ||
| uint8_t | m, | ||
| uint8_t | s | ||
| ) | [static] |
Given a number of days, hours, minutes, and seconds, return the total seconds.
- Parameters:
-
days Days h Hours m Minutes s Seconds
- Returns:
- Number of seconds total
Definition at line 128 of file RTClib.cpp.
Variable Documentation
| const uint8_t daysInMonth[] = { 31,28,31,30,31,30,31,31,30,31,30 } |
Number of days in each month, from January to November.
December is not needed. Omitting it avoids an incompatibility with Paul Stoffregen's Time library. C.f. https://github.com/adafruit/RTClib/issues/114
Definition at line 95 of file RTClib.cpp.
Generated on Wed Jul 13 2022 06:14:12 by
1.7.2