Syntax:
bool begin(I2C_Class* i2c = nullptr);
Description:
Parameters:
Return:
Syntax:
bool getVoltLow(void);
Description:
Parameters:
Return:
Syntax:
bool getTime(rtc_time_t* time) const;
Description:
Parameters:
Return:
Syntax:
rtc_time_t getTime(void) const
Description:
Parameters:
Return:
struct __attribute__((packed)) rtc_time_t
{
std::int8_t hours;
std::int8_t minutes;
std::int8_t seconds;
rtc_time_t(std::int8_t hours_ = -1, std::int8_t minutes_ = -1, std::int8_t seconds_ = -1)
: hours { hours_ }
, minutes { minutes_ }
, seconds { seconds_ }
{}
rtc_time_t(const tm& t)
: hours { (int8_t)t.tm_hour }
, minutes { (int8_t)t.tm_min }
, seconds { (int8_t)t.tm_sec }
{}
};
Syntax:
bool getDate(rtc_date_t* date) const;
Description:
Parameters:
Return:
Syntax:
rtc_date_t getDate(void) const;
Description:
Parameters:
Return:
struct __attribute__((packed)) rtc_date_t
{
/// year 1900-2099
std::int16_t year;
/// month 1-12
std::int8_t month;
/// date 1-31
std::int8_t date;
/// weekDay 0:sun / 1:mon / 2:tue / 3:wed / 4:thu / 5:fri / 6:sat
std::int8_t weekDay;
rtc_date_t(std::int16_t year_ = 2000, std::int8_t month_ = 1, std::int8_t date_ = -1, std::int8_t weekDay_ = -1)
: year { year_ }
, month { month_ }
, date { date_ }
, weekDay { weekDay_ }
{}
rtc_date_t(const tm& t)
: year { (int16_t)(t.tm_year + 1900) }
, month { (int8_t )(t.tm_mon + 1 ) }
, date { (int8_t ) t.tm_mday }
, weekDay { (int8_t ) t.tm_wday }
{}
};
Syntax:
bool getDateTime(rtc_datetime_t* datetime) const;
Description:
Parameters:
Return:
Syntax:
rtc_datetime_t getDateTime(void) const
{
rtc_datetime_t res;
getDateTime(&res);
return res;
}
Description:
Parameters:
Return:
struct __attribute__((packed)) rtc_datetime_t
{
rtc_date_t date;
rtc_time_t time;
rtc_datetime_t() = default;
rtc_datetime_t(const rtc_date_t& d, const rtc_time_t& t) : date { d }, time { t } {};
rtc_datetime_t(const tm& t) : date { t }, time { t } {}
tm get_tm(void) const;
void set_tm(tm& time);
void set_tm(tm* t) { if (t) set_tm(*t); }
};
Syntax:
void setTime(const rtc_time_t &time);
Description:
Parameters:
Return:
Syntax:
void setTime(const rtc_time_t* const time);
Description:
Parameters:
Return:
Syntax:
void setDate(const rtc_date_t &date);
Description:
Parameters:
Return:
Syntax:
void setDate(const rtc_date_t* const date);
Description:
Parameters:
Return:
Syntax:
void setDateTime(const rtc_datetime_t &datetime);
Description:
Parameters:
Return:
Syntax:
void setDateTime(const rtc_datetime_t* const datetime);
Description:
Parameters:
Return:
Syntax:
void setDateTime(const tm* const datetime);
Description:
Parameters:
Return:
Note: |IRQ implements timed interrupt signals, timed wake-up operations, etc. After triggering the signal, it is necessary to execute clearIRQ, disableIRQ to clear the interrupt flag, and then it can be set again.
Syntax:
int setAlarmIRQ(int afterSeconds);
Description:
Parameters:
Return:
Syntax:
int setAlarmIRQ(const rtc_time_t &time);
Description:
Parameters:
Return:
Syntax:
int setAlarmIRQ(const rtc_date_t &date, const rtc_time_t &time);
Description:
Parameters:
Return:
Syntax:
void setSystemTimeFromRtc(struct timezone* tz = nullptr);
Description:
Parameters:
Return:
Syntax:
bool getIRQstatus(void);
Description:
Parameters:
Return:
Syntax:
void clearIRQ(void);
Description:
Parameters:
Return:
Syntax:
void disableIRQ(void);
Description:
Parameters:
Return: