Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Detektor_Pokreta Dino_Martic_Programski
RtcCls.h
- Committer:
- leihen
- Date:
- 2013-06-23
- Revision:
- 4:d2cc690aaac7
- Child:
- 5:30531f2121a2
File content as of revision 4:d2cc690aaac7:
#ifndef __RTC_H__
#define __RTC_H__
#include "Rtc_Ds1307.h"
#include "mbed.h"
typedef void (*callback_t)(void);
class RtcCls : public Rtc_Ds1307
{
protected:
InterruptIn m_sqw;
bool m_bUseSqw;
time_t m_time; // Only used in case of SQW use
bool m_bAlarmEnabled;
callback_t m_alarmfunc;
time_t m_alarmTime;
public:
RtcCls(PinName sda, PinName scl, PinName sqw, bool bUseSqw);
protected:
static void _callback(void);
public:
time_t getTime();
void setTime(time_t t);
public:
void setAlarm(int nSeconds, callback_t alarmfunc)
{
m_alarmfunc = alarmfunc;
m_alarmTime = m_time + nSeconds;
m_bAlarmEnabled = (alarmfunc == NULL) ? false : true;
}
};
#endif // __RTC_H__