StuBS
RTC Class Reference

Real Time Clock. More...

#include <machine/rtc.h>

Inheritance diagram for RTC:
[legend]

Static Public Member Functions

static DateTime getDateTime ()
 Get current date and time. More...
 

Protected Types

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...
 

Static Protected Member Functions

static void setPeriodic (enum PeriodicFrequency freq)
 Set a periodic interrupt interval. More...
 
static void setAlarm (uint8_t hour, uint8_t minute, uint8_t second)
 Set an alarm. More...
 
static void receiveInterrupt (Interrupt i, bool enable)
 Enable or disable an interrupt source. More...
 
static Interrupt getSource ()
 Get the source of the last interrupt. More...
 

Detailed Description

Real Time Clock.

Member Enumeration Documentation

◆ Interrupt

enum RTC::Interrupt
protected

Possible Interrupt sources.

Enumerator
UPDATE 

Time Update Ended Interrupt.

ALARM 

Alarm Interrupt.

PERIODIC 

Periodic Timer Interrupt.

◆ PeriodicFrequency

enum RTC::PeriodicFrequency
protected

Frequencies for periodic interval.

Enumerator
FREQ_8192HZ 

122.070 µs

FREQ_4096HZ 

244.141 µs

FREQ_2048HZ 

488.281 µs

FREQ_1024HZ 

976.562 µs

FREQ_512HZ 

1.953125 ms

FREQ_256HZ 

3.90625 ms

FREQ_128HZ 

7.8125 ms

FREQ_64HZ 

15.625 ms

FREQ_32HZ 

31.25 ms

FREQ_16HZ 

62.5 ms

FREQ_8HZ 

125 ms

FREQ_4HZ 

250 ms

FREQ_2HZ 

500 ms

Member Function Documentation

◆ setPeriodic()

void RTC::setPeriodic ( enum PeriodicFrequency  freq)
staticprotected

Set a periodic interrupt interval.

Note
You can safely ignore this method
Parameters
freqFrequency

◆ setAlarm()

void RTC::setAlarm ( uint8_t  hour,
uint8_t  minute,
uint8_t  second 
)
staticprotected

Set an alarm.

Note
You can safely ignore this method
Parameters
hourHour
minuteMinute
secondSecond

◆ receiveInterrupt()

void RTC::receiveInterrupt ( Interrupt  i,
bool  enable 
)
staticprotected

Enable or disable an interrupt source.

Parameters
iInterrupt source
enabletrue to enable source, false to disable it.

◆ getSource()

RTC::Interrupt RTC::getSource ( )
staticprotected

Get the source of the last interrupt.

Returns
Interrupt source

◆ getDateTime()

DateTime RTC::getDateTime ( )
static

Get current date and time.

Note
You have to detect clock updates while fetching the time, or you might have an error.
Returns
current date and time

The documentation for this class was generated from the following files: