mirror of https://github.com/nealey/Simon-Says
Corrected the hardware mapping to older board versions.
This new mapping system should work but it is untested.
This commit is contained in:
parent
078011212b
commit
64ff505961
|
@ -15,14 +15,11 @@
|
||||||
|
|
||||||
|
|
||||||
// Uncomment one of the following, corresponding to the board you have.
|
// Uncomment one of the following, corresponding to the board you have.
|
||||||
//#define BOARD_REV_6_25_08
|
#define BOARD_REV_2_3_2011 //Works with board label '2-3-2011'
|
||||||
//#define BOARD_REV_4_9_2009
|
//#define BOARD_REV_4_9_2009
|
||||||
#define BOARD_REV_PTH
|
//#define BOARD_REV_6_25_2008
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef BOARD_REV_PTH
|
|
||||||
|
|
||||||
|
#ifdef BOARD_REV_2_3_2011
|
||||||
// LED pin definitions, these are Arduino pins, not ATmega pins
|
// LED pin definitions, these are Arduino pins, not ATmega pins
|
||||||
#define LED_RED 10
|
#define LED_RED 10
|
||||||
#define LED_GREEN 3
|
#define LED_GREEN 3
|
||||||
|
@ -38,94 +35,41 @@
|
||||||
// Buzzer pin definitions
|
// Buzzer pin definitions
|
||||||
#define BUZZER1 4
|
#define BUZZER1 4
|
||||||
#define BUZZER2 7
|
#define BUZZER2 7
|
||||||
|
#endif // End definition for BOARD_REV_2_3_2011
|
||||||
#endif // End definition for BOARD_REV_PTH
|
|
||||||
|
|
||||||
#ifdef BOARD_REV_6_25_08
|
|
||||||
|
|
||||||
// LED pin definitions
|
|
||||||
#define LED_RED_PIN 3
|
|
||||||
#define LED_RED_PORT PORTC
|
|
||||||
#define LED_GREEN_PIN 2
|
|
||||||
#define LED_GREEN_PORT PORTD
|
|
||||||
#define LED_BLUE_PIN 0
|
|
||||||
#define LED_BLUE_PORT PORTC
|
|
||||||
#define LED_YELLOW_PIN 5
|
|
||||||
#define LED_YELLOW_PORT PORTD
|
|
||||||
|
|
||||||
// Button pin definitions
|
|
||||||
#define BUTTON_RED_PIN 2
|
|
||||||
#define BUTTON_RED_PORT PINC
|
|
||||||
#define BUTTON_GREEN_PIN 5
|
|
||||||
#define BUTTON_GREEN_PORT PINC
|
|
||||||
#define BUTTON_BLUE_PIN 1
|
|
||||||
#define BUTTON_BLUE_PORT PINC
|
|
||||||
#define BUTTON_YELLOW_PIN 6
|
|
||||||
#define BUTTON_YELLOW_PORT PIND
|
|
||||||
|
|
||||||
// Buzzer pin definitions
|
|
||||||
#define BUZZER1 3
|
|
||||||
#define BUZZER1_PORT PORTD
|
|
||||||
#define BUZZER2 4
|
|
||||||
#define BUZZER2_PORT PORTD
|
|
||||||
|
|
||||||
#endif // End define for BOARD_REV_6_25_08
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef BOARD_REV_4_9_2009
|
#ifdef BOARD_REV_4_9_2009
|
||||||
|
// LED pin definitions, these are Arduino pins, not ATmega pins
|
||||||
// LED pin definitions
|
#define LED_BLUE 13 //PORTB.5
|
||||||
#define LED_BLUE_PIN 5
|
#define LED_YELLOW 5 //PORTD.5
|
||||||
#define LED_BLUE_PORT PORTB
|
#define LED_RED 10 //PORTB.2
|
||||||
#define LED_YELLOW_PIN 5
|
#define LED_GREEN 1 //PORTD.2 - This may conflict with TX
|
||||||
#define LED_YELLOW_PORT PORTD
|
|
||||||
#define LED_RED_PIN 2
|
|
||||||
#define LED_RED_PORT PORTB
|
|
||||||
#define LED_GREEN_PIN 2
|
|
||||||
#define LED_GREEN_PORT PORTD
|
|
||||||
|
|
||||||
// Button pin definitions
|
// Button pin definitions
|
||||||
#define BUTTON_RED_PIN 0
|
#define BUTTON_RED 8 //PINB.0
|
||||||
#define BUTTON_RED_PORT PINB
|
#define BUTTON_GREEN 9 //PINB.1
|
||||||
#define BUTTON_GREEN_PIN 1
|
#define BUTTON_BLUE 7 //PIND.7
|
||||||
#define BUTTON_GREEN_PORT PINB
|
#define BUTTON_YELLOW 6 //PIND.6
|
||||||
#define BUTTON_BLUE_PIN 7
|
|
||||||
#define BUTTON_BLUE_PORT PIND
|
|
||||||
#define BUTTON_YELLOW_PIN 6
|
|
||||||
#define BUTTON_YELLOW_PORT PIND
|
|
||||||
|
|
||||||
// Buzzer pin definitions
|
// Buzzer pin definitions
|
||||||
#define BUZZER1 3
|
#define BUZZER1 3 //PORTD.3
|
||||||
#define BUZZER1_PORT PORTD
|
#define BUZZER2 4 //PORTD.4
|
||||||
#define BUZZER2 4
|
|
||||||
#define BUZZER2_PORT PORTD
|
|
||||||
|
|
||||||
#endif // End define for BOARD_REV_4_9_2009
|
#endif // End define for BOARD_REV_4_9_2009
|
||||||
|
|
||||||
|
#ifdef BOARD_REV_6_25_2008
|
||||||
|
// LED pin definitions, these are Arduino pins, not ATmega pins
|
||||||
|
#define LED_RED A3 //PORTC.3
|
||||||
|
#define LED_GREEN 2 //PORTD.2
|
||||||
|
#define LED_BLUE A0 //PORTC.0
|
||||||
|
#define LED_YELLOW 5 //PORTD.5
|
||||||
|
|
||||||
//The following functions are specific to different versions of the board
|
// Button pin definitions
|
||||||
|
#define BUTTON_RED A2 //PINC.2
|
||||||
|
#define BUTTON_GREEN A5 //PINC.5
|
||||||
|
#define BUTTON_BLUE A1 //PINC.1
|
||||||
|
#define BUTTON_YELLOW 6 //PIND.6
|
||||||
|
|
||||||
#ifdef BOARD_REV_6_25_08
|
// Buzzer pin definitions
|
||||||
void init_gpio(void)
|
#define BUZZER1 3 //PORTD.3
|
||||||
{
|
#define BUZZER2 4 //PORTD.4
|
||||||
// 1 = output, 0 = input
|
#endif // End define for BOARD_REV_6_25_2008
|
||||||
DDRB = 0b11111111;
|
|
||||||
DDRC = 0b00001001; // LEDs and Buttons
|
|
||||||
DDRD = 0b00111110; // LEDs, buttons, buzzer, TX/RX
|
|
||||||
|
|
||||||
PORTC = 0b00100110; // Enable pull-ups on buttons 0, 2, 3
|
|
||||||
PORTD = 0b01000000; // Enable pull-up on button 1
|
|
||||||
}
|
|
||||||
#endif // End BOARD_REV_6_25_08
|
|
||||||
|
|
||||||
#ifdef BOARD_REV_4_9_2009
|
|
||||||
void init_gpio(void)
|
|
||||||
{
|
|
||||||
// 1 = output, 0 = input
|
|
||||||
DDRB = 0b11111100; // Button 2,3 on PB0,1
|
|
||||||
DDRD = 0b00111110; // LEDs, buttons, buzzer, TX/RX
|
|
||||||
|
|
||||||
PORTB = 0b00000011; // Enable pull-ups on buttons 2, 3
|
|
||||||
PORTD = 0b11000000; // Enable pull-up on button 0, 1
|
|
||||||
}
|
|
||||||
#endif // End BOARD_REV_4_9_2009
|
|
||||||
|
|
Loading…
Reference in New Issue