beautifying

This commit is contained in:
hg
2013-01-29 16:06:40 +01:00
parent ea178ca5c4
commit 7654302a94

View File

@ -12,6 +12,30 @@ volatile uint8_t useLocalClock = 1;
volatile uint8_t nextSecond = 0;
volatile uint8_t nextMinute = 0;
volatile uint8_t tack = 0;
volatile uint8_t step = 0;
void clockInit() {
clock.hour = 0;
clock.minute = 0;
clock.second = 0;
opTime.hour = 0;
opTime.minute = 0;
opTime.second = 0;
// seconds
TCCR2 = 0b00000101;
ASSR |= (1 << AS2);
TIMSK |= (1 << TOIE2) | (1 << TICIE1);
// heartbeat
TCCR0 = (1 << CS02) | (1 << CS00);
TIMSK |= (1 << TOIE0);
}
@ -50,25 +74,23 @@ ISR(TIMER2_OVF_vect) {
}
}
void clockInit() {
clock.hour = 0;
clock.minute = 0;
clock.second = 0;
ISR(TIMER0_OVF_vect) {
static uint8_t subDivTack = 0;
subDivTack++;
if (subDivTack >= SUB_DIV_LED) {
subDivTack = 0;
tack = 1;
}
opTime.hour = 0;
opTime.minute = 0;
opTime.second = 0;
// seconds
TCCR2 = 0b00000101;
ASSR |= (1 << AS2);
TIMSK |= (1 << TOIE2) | (1 << TICIE1);
// heartbeat
TCCR0 = (1 << CS02) | (1 << CS00);
TIMSK |= (1 << TOIE0);
static uint8_t subDivStepper = 0;
subDivStepper++;
if (subDivStepper >= SUB_DIV_STEPPER) {
subDivStepper = 0;
step = 1;
}
}
opTime_t clockGetOpTime() {
return opTime;
}
@ -120,9 +142,6 @@ uint8_t clockNextMinute() {
}
volatile uint8_t tack = 0;
volatile uint8_t step = 0;
uint8_t clockNextStep() {
if (step != 0) {
@ -142,20 +161,4 @@ uint8_t clockNextBlink() {
}
}
ISR(TIMER0_OVF_vect) {
static uint8_t subDivTack = 0;
subDivTack++;
if (subDivTack >= SUB_DIV_LED) {
subDivTack = 0;
tack = 1;
}
static uint8_t subDivStepper = 0;
subDivStepper++;
if (subDivStepper >= SUB_DIV_STEPPER) {
subDivStepper = 0;
step = 1;
}
}