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

Go to the source code of this file.

Functions

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

Variables

const uint8_t
mhv_daysInMonthArray[] 
PROGMEM

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.


Variable Documentation

const uint32_t mhv_secondsFromYearStart [] PROGMEM
Initial value:
 {
                31,     
                28,     
                31,     
                30, 
                31, 
                30, 
                31, 
                30, 
                30, 
                31, 
                30, 
                31 
}

Definition at line 130 of file MHV_RTC.cpp.