/*
 * timer.c
 *
 *  Created on: Mar 16, 2012
 *      Author: RomanM
 */
#include <inttypes.h>
#include "drivers/RTC/RTC.h"

uint8_t setValue = 0;
uint8_t lastSecond;

void timerSet(uint8_t seconds) {
	setValue = seconds;
	lastSecond = RTC_GetSecond();
}

uint8_t timerExpired(void) {
	uint8_t currentSecond = RTC_GetSecond();

	if (lastSecond != currentSecond) {
		setValue --;
		lastSecond = currentSecond;
	}

	if (setValue) return 0;
	else return 1;
}

