MHVLib  20111011
An efficiency oriented runtime library for AVR microcontrollers
A:/eclipse/mhvlib/MHV_RTC.h File Reference
#include <MHV_Timer8.h>

Go to the source code of this file.

Classes

struct  mhv_timestamp
struct  mhv_time
struct  mhv_alarm
class  MHV_AlarmListener
class  MHV_RTC

Typedefs

typedef struct mhv_timestamp MHV_TIMESTAMP
typedef enum mhv_weekday MHV_WEEKDAY
typedef enum mhv_month MHV_MONTH
typedef struct mhv_time MHV_TIME
typedef struct mhv_alarm MHV_ALARM

Enumerations

enum  mhv_weekday {
  MHV_SUNDAY, MHV_MONDAY, MHV_TUESDAY, MHV_WEDNESDAY,
  MHV_THURSDAY, MHV_FRIDAY, MHV_SATURDAY
}
enum  mhv_month {
  MHV_JANUARY = 1, MHV_FEBRUARY = 2, MHV_MARCH = 3, MHV_APRIL = 4,
  MHV_MAY = 5, MHV_JUNE = 6, MHV_JULY = 7, MHV_AUGUST = 8,
  MHV_SEPTEMBER = 9, MHV_OCTOBER = 10, MHV_NOVEMBER = 11, MHV_DECEMBER = 12
}

Functions

void mhv_timestampIncrement (MHV_TIMESTAMP *timestamp, uint32_t seconds, uint16_t milliseconds)
void mhv_timestampIncrement (MHV_TIMESTAMP *timestamp, MHV_TIMESTAMP *timestamp2)
bool mhv_isLeapYear (uint16_t year)
bool mhv_timestampGreaterThanOrEqual (MHV_TIMESTAMP *first, MHV_TIMESTAMP *second)
bool mhv_timestampLessThan (MHV_TIMESTAMP *first, MHV_TIMESTAMP *second)
uint8_t mhv_daysInMonth (MHV_MONTH month, uint16_t year)

Typedef Documentation

typedef struct mhv_alarm MHV_ALARM

Definition at line 87 of file MHV_RTC.h.

typedef enum mhv_month MHV_MONTH

Definition at line 64 of file MHV_RTC.h.

typedef struct mhv_time MHV_TIME

Definition at line 79 of file MHV_RTC.h.

typedef struct mhv_timestamp MHV_TIMESTAMP

Definition at line 36 of file MHV_RTC.h.

typedef enum mhv_weekday MHV_WEEKDAY

Definition at line 48 of file MHV_RTC.h.


Enumeration Type Documentation

enum mhv_month
Enumerator:
MHV_JANUARY 
MHV_FEBRUARY 
MHV_MARCH 
MHV_APRIL 
MHV_MAY 
MHV_JUNE 
MHV_JULY 
MHV_AUGUST 
MHV_SEPTEMBER 
MHV_OCTOBER 
MHV_NOVEMBER 
MHV_DECEMBER 

Definition at line 50 of file MHV_RTC.h.

Enumerator:
MHV_SUNDAY 
MHV_MONDAY 
MHV_TUESDAY 
MHV_WEDNESDAY 
MHV_THURSDAY 
MHV_FRIDAY 
MHV_SATURDAY 

Definition at line 39 of file MHV_RTC.h.


Function Documentation

uint8_t mhv_daysInMonth ( MHV_MONTH  month,
uint16_t  year 
)

Get the number of days in a month

Parameters:
monththe month
yearthe year
Returns:
the number of days

Definition at line 151 of file MHV_RTC.cpp.

bool mhv_isLeapYear ( uint16_t  year)

Determine if a year is a leap year

Definition at line 89 of file MHV_RTC.cpp.

bool mhv_timestampGreaterThanOrEqual ( MHV_TIMESTAMP first,
MHV_TIMESTAMP second 
)

Compare 2 timestamps

Parameters:
firstthe first timestamp
secondthe second timestamp
Returns:
true if the first timestamp is greater than or equal to the second

Definition at line 72 of file MHV_RTC.cpp.

void mhv_timestampIncrement ( MHV_TIMESTAMP timestamp,
uint32_t  seconds,
uint16_t  milliseconds 
)

Increment a timestamp

Parameters:
timestampthe timestamp to increment
secondsthe number of seconds to increment by
millisecondsthe number of milliseconds to increment by

Definition at line 102 of file MHV_RTC.cpp.

void mhv_timestampIncrement ( MHV_TIMESTAMP timestamp,
MHV_TIMESTAMP timestamp2 
)

Increment a timestamp

Parameters:
timestampthe timestamp to increment
timestamp2the timestamp to increment by

Definition at line 118 of file MHV_RTC.cpp.

bool mhv_timestampLessThan ( MHV_TIMESTAMP first,
MHV_TIMESTAMP second 
)

A Realtime clock

Takes a trigger from a timer, and keeps time.

Recommended values: Clock Prescaler Top Ticks/ms 16MHz 64 249 1 Compare 2 timestamps

Parameters:
firstthe first timestamp
secondthe second timestamp
Returns:
true if the first timestamp is less than the second

Definition at line 52 of file MHV_RTC.cpp.