From 70baa5e4c4d1dd5f03bbec9ffb4dfe31f7f67c13 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Sat, 11 Jan 2014 21:54:50 -0700 Subject: [PATCH] Just trying to debug --- avr.c | 9 +++++---- config.h | 2 +- main.c | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/avr.c b/avr.c index e9b9155..63ab3b0 100644 --- a/avr.c +++ b/avr.c @@ -6,8 +6,8 @@ #include "config.h" /* Clock must be a multiple of 2MHz or there will be clock drift */ -#define TICKS_PER_SECOND (CLOCK_HZ / 64) -#define TICKS_PER_JIFFY (TICKS_PER_SECOND / 10) +#define TICK_HZ (CLOCK_HZ / 8 / 64) +#define TICKS_PER_JIFFY (TICK_HZ / 10) #define cbi(byt, bit) (byt &= ~_BV(bit)) #define sbi(byt, bit) (byt |= _BV(bit)) @@ -32,10 +32,11 @@ init(void) TCCR1A = 0; TCCR1B = 0; - TCNT1 = 0; + TCNT1 = 0; // reset counter + OCR1A = TICKS_PER_JIFFY - 1; TCCR1B |= _BV(WGM12); - TCCR1B |= _BV(CS11) | _BV(CS10); + TCCR1B |= _BV(CS11) | _BV(CS10); // prescale: clk_io / 64 TIMSK1 |= _BV(OCIE1A); bit(PORTA, _BV(7), true); diff --git a/config.h b/config.h index e8a4417..4253322 100644 --- a/config.h +++ b/config.h @@ -1,7 +1,7 @@ #ifndef __CONFIG_H__ #define __CONFIG_H__ -#define CLOCK_HZ 2000000 +#define CLOCK_HZ 1600000 #define SCORE_DIGITS 2 #define JAM_INDICATOR 1 diff --git a/main.c b/main.c index dab5f49..c44c105 100644 --- a/main.c +++ b/main.c @@ -34,7 +34,7 @@ int16_t jam_duration = -(2 * 60 * 10); int16_t lineup_duration = (-30 * 10); int16_t jam_clock = 0; enum { - SETUP, + SETUP = 0, JAM, LINEUP, TIMEOUT, @@ -140,9 +140,9 @@ draw() uint16_t jclk; uint16_t pclk; bool blank = ((state == TIMEOUT) && (jiffies % 8 == 0)); - + // Segments test mode - if (KONAMI == state) { + if (1 || (KONAMI == state)) { int i; for (i = 0; i < 12; i += 1) { @@ -339,7 +339,7 @@ loop() if (tick) { tick = false; - if (jiffies % 5 == 0) { + if (1 && (jiffies % 50 == 0)) { PORTB ^= 0xff; }