|
StuBS
|
The Clock implements the device for the real time clock, providing an interface to retrieve the current date/time. More...
#include <device/clock.h>
Public Member Functions | |
| Clock () | |
| Constructor. | |
| void | init () |
| Initialize Clock and its interrupts. | |
| uint32_t | getTimestamp () const |
| Get current time stamp. | |
| DateTime | getDateTime () const |
| Get current date and time. | |
| bool | prologue () override |
| Prologue for Real Time Clock Since the RTC can cause three different interrupts, the prologue is required to determine the source. | |
| void | epilogue () override |
| Epilogue for Real Time Clock. | |
Public Member Functions inherited from Gate | |
| Gate () | |
| Constructor. | |
| virtual | ~Gate () |
| Destructor. | |
| bool | is_queued () const |
| Status about the epilogue. | |
| void | set_queued (bool val) |
| Set epilogue status. | |
Private Attributes | |
| volatile uint32_t | current_timestamp |
| volatile bool | alarm |
| volatile bool | periodic |
| volatile bool | update |
Additional Inherited Members | |
Protected Types inherited from RTC | |
| enum | Interrupt { NONE = 0 , UPDATE = 1 << 4 , ALARM = 1 << 5 , PERIODIC = 1 << 6 } |
| Possible Interrupt sources. More... | |
| enum | PeriodicFrequency { FREQ_NONE = 0 , FREQ_8192HZ = 3 , FREQ_4096HZ = 4 , FREQ_2048HZ = 5 , FREQ_1024HZ = 6 , FREQ_512HZ = 7 , FREQ_256HZ = 8 , FREQ_128HZ = 9 , FREQ_64HZ = 10 , FREQ_32HZ = 11 , FREQ_16HZ = 12 , FREQ_8HZ = 13 , FREQ_4HZ = 14 , FREQ_2HZ = 15 } |
| Frequencies for periodic interval. More... | |
Protected Member Functions inherited from Queue< T, ContainerType >::Node | |
| Node () | |
Static Protected Member Functions inherited from RTC | |
| static void | setPeriodic (enum PeriodicFrequency freq) |
| Set a periodic interrupt interval. | |
| static void | setAlarm (uint8_t hour, uint8_t minute, uint8_t second) |
| Set an alarm. | |
| static void | receiveInterrupt (Interrupt i, bool enable) |
| Enable or disable an interrupt source. | |
| static Interrupt | getSource () |
| Get the source of the last interrupt. | |
| static DateTime | getDateTime () |
| Get current date and time. | |
The Clock implements the device for the real time clock, providing an interface to retrieve the current date/time.
Instead of reading several CMOS registers on each call to Clock::getDateTime / Clock::getTimestamp() (which is quite expensive), the update interrupt is used to keep track of the current timestamp in a local variable.
|
inline |
Constructor.
| void Clock::init | ( | ) |
Initialize Clock and its interrupts.
|
inline |
Get current time stamp.
|
inline |
Get current date and time.
|
overridevirtual |
|
overridevirtual |