Corrected the hardware mapping to older board versions.

This new mapping system should work but it is untested.
This commit is contained in:
Nathan Seidle 2012-12-29 10:58:34 -07:00
parent 078011212b
commit 64ff505961
1 changed files with 51 additions and 107 deletions

View File

@ -15,117 +15,61 @@
// 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
// LED pin definitions, these are Arduino pins, not ATmega pins
#define LED_RED 10
#define LED_GREEN 3
#define LED_BLUE 13
#define LED_YELLOW 5
// Button pin definitions
#define BUTTON_RED 9
#define BUTTON_GREEN 2
#define BUTTON_BLUE 12
#define BUTTON_YELLOW 6
// Buzzer pin definitions
#define BUZZER1 4
#define BUZZER2 7
#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_2_3_2011
// LED pin definitions, these are Arduino pins, not ATmega pins
#define LED_RED 10
#define LED_GREEN 3
#define LED_BLUE 13
#define LED_YELLOW 5
// Button pin definitions
#define BUTTON_RED 9
#define BUTTON_GREEN 2
#define BUTTON_BLUE 12
#define BUTTON_YELLOW 6
// Buzzer pin definitions
#define BUZZER1 4
#define BUZZER2 7
#endif // End definition for BOARD_REV_2_3_2011
#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 // Button pin definitions
#define LED_RED_PORT PORTB #define BUTTON_RED 8 //PINB.0
#define LED_GREEN_PIN 2 #define BUTTON_GREEN 9 //PINB.1
#define LED_GREEN_PORT PORTD #define BUTTON_BLUE 7 //PIND.7
#define BUTTON_YELLOW 6 //PIND.6
// Button pin definitions
#define BUTTON_RED_PIN 0 // Buzzer pin definitions
#define BUTTON_RED_PORT PINB #define BUZZER1 3 //PORTD.3
#define BUTTON_GREEN_PIN 1 #define BUZZER2 4 //PORTD.4
#define BUTTON_GREEN_PORT PINB
#define BUTTON_BLUE_PIN 7
#define BUTTON_BLUE_PORT PIND
#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_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
// 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
// Buzzer pin definitions
#define BUZZER1 3 //PORTD.3
#define BUZZER2 4 //PORTD.4
#endif // End define for BOARD_REV_6_25_2008
//The following functions are specific to different versions of the board
#ifdef BOARD_REV_6_25_08
void init_gpio(void)
{
// 1 = output, 0 = input
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