Just trying to debug

This commit is contained in:
Neale Pickett 2014-01-11 21:54:50 -07:00
parent b95c4aa485
commit 70baa5e4c4
3 changed files with 10 additions and 9 deletions

9
avr.c
View File

@ -6,8 +6,8 @@
#include "config.h" #include "config.h"
/* Clock must be a multiple of 2MHz or there will be clock drift */ /* Clock must be a multiple of 2MHz or there will be clock drift */
#define TICKS_PER_SECOND (CLOCK_HZ / 64) #define TICK_HZ (CLOCK_HZ / 8 / 64)
#define TICKS_PER_JIFFY (TICKS_PER_SECOND / 10) #define TICKS_PER_JIFFY (TICK_HZ / 10)
#define cbi(byt, bit) (byt &= ~_BV(bit)) #define cbi(byt, bit) (byt &= ~_BV(bit))
#define sbi(byt, bit) (byt |= _BV(bit)) #define sbi(byt, bit) (byt |= _BV(bit))
@ -32,10 +32,11 @@ init(void)
TCCR1A = 0; TCCR1A = 0;
TCCR1B = 0; TCCR1B = 0;
TCNT1 = 0; TCNT1 = 0; // reset counter
OCR1A = TICKS_PER_JIFFY - 1; OCR1A = TICKS_PER_JIFFY - 1;
TCCR1B |= _BV(WGM12); TCCR1B |= _BV(WGM12);
TCCR1B |= _BV(CS11) | _BV(CS10); TCCR1B |= _BV(CS11) | _BV(CS10); // prescale: clk_io / 64
TIMSK1 |= _BV(OCIE1A); TIMSK1 |= _BV(OCIE1A);
bit(PORTA, _BV(7), true); bit(PORTA, _BV(7), true);

View File

@ -1,7 +1,7 @@
#ifndef __CONFIG_H__ #ifndef __CONFIG_H__
#define __CONFIG_H__ #define __CONFIG_H__
#define CLOCK_HZ 2000000 #define CLOCK_HZ 1600000
#define SCORE_DIGITS 2 #define SCORE_DIGITS 2
#define JAM_INDICATOR 1 #define JAM_INDICATOR 1

8
main.c
View File

@ -34,7 +34,7 @@ int16_t jam_duration = -(2 * 60 * 10);
int16_t lineup_duration = (-30 * 10); int16_t lineup_duration = (-30 * 10);
int16_t jam_clock = 0; int16_t jam_clock = 0;
enum { enum {
SETUP, SETUP = 0,
JAM, JAM,
LINEUP, LINEUP,
TIMEOUT, TIMEOUT,
@ -140,9 +140,9 @@ draw()
uint16_t jclk; uint16_t jclk;
uint16_t pclk; uint16_t pclk;
bool blank = ((state == TIMEOUT) && (jiffies % 8 == 0)); bool blank = ((state == TIMEOUT) && (jiffies % 8 == 0));
// Segments test mode // Segments test mode
if (KONAMI == state) { if (1 || (KONAMI == state)) {
int i; int i;
for (i = 0; i < 12; i += 1) { for (i = 0; i < 12; i += 1) {
@ -339,7 +339,7 @@ loop()
if (tick) { if (tick) {
tick = false; tick = false;
if (jiffies % 5 == 0) { if (1 && (jiffies % 50 == 0)) {
PORTB ^= 0xff; PORTB ^= 0xff;
} }