/* flaneth - flash and ethernet - dartboard mod
* version 0.1 date 2008-11-09
* Copyright (C) 2007-2008 Stefan Schuermans <stefan@schuermans.info>
* Copyleft: GNU public license V2 - http://www.gnu.org/copyleft/gpl.html
* a BlinkenArea project - http://www.blinkenarea.org/
*/
#include <avr/io.h>
#include <avr/interrupt.h>
#include "dart.h"
#include "debug.h"
#include "macros.h"
#include "nethelp.h"
#include "udp.h"
// dartboard connection
// - 7 row pins connected via shottky diode (low passes to dartboard)
// - 12 column pins connected directly
// IO-Pins
// PB0: col10
// PB2: col9
// PB3: col8
// PC[0-7]: col[0-7]
// PF[0-6]: row[0-6]
// PF7: col11
// constants
#define DartRows (7)
#define DartCols (12)
#define DartFields (DartRows * DartCols)
#define DartDisableTicks (5)
#define DartQueueSize (16)
// if waiting for a field to be hit
volatile unsigned char DartActive = 1;
// current row being read
volatile unsigned char DartRow = DartRows;
volatile unsigned char DartRowBits = 1 << DartRows; // always 1 << DartRow
// field that has been hit
volatile unsigned char DartField = DartFields;
// ticks dartboard is disabled
// - used after field has been hit to disable board for some time
unsigned char DartDisable = 0;
// destination to send dart UDP packets to
unsigned char DartIp[4];