Update Arduboy, Arduboy2 libraries
Remapped ABXY buttons for 8BitCADE XL Level UP
This commit is contained in:
parent
d168f3e8a4
commit
dbe2df81da
|
@ -91,8 +91,13 @@
|
|||
#define PIN_RIGHT_BUTTON A1
|
||||
#define PIN_UP_BUTTON A0
|
||||
#define PIN_DOWN_BUTTON A3
|
||||
#ifndef SUPPORT_XY_BUTTONS
|
||||
#define PIN_A_BUTTON 7
|
||||
#define PIN_B_BUTTON 8
|
||||
#else
|
||||
#define PIN_A_BUTTON 8
|
||||
#define PIN_B_BUTTON 7
|
||||
#endif
|
||||
|
||||
// bit values for button states
|
||||
#define LEFT_BUTTON _BV(5)
|
||||
|
|
|
@ -194,30 +194,36 @@ void Arduboy2Core::bootPins()
|
|||
#ifdef ARDUBOY_10
|
||||
|
||||
// Port B INPUT_PULLUP or HIGH
|
||||
PORTB = (_BV(RED_LED_BIT) | _BV(BLUE_LED_BIT) | //RGB LED off
|
||||
PORTB = (_BV(RED_LED_BIT) | _BV(BLUE_LED_BIT) //RGB LED off
|
||||
#ifndef AB_ALTERNATE_WIRING
|
||||
_BV(GREEN_LED_BIT) |
|
||||
| _BV(GREEN_LED_BIT)
|
||||
#endif
|
||||
#ifdef SUPPORT_XY_BUTTONS
|
||||
_BV(Y_BUTTON_BIT) |
|
||||
| _BV(X_BUTTON_BIT) | _BV(A_BUTTON_BIT)
|
||||
#else
|
||||
| _BV(B_BUTTON_BIT)
|
||||
#endif
|
||||
#ifndef ARDUINO_AVR_MICRO
|
||||
_BV(RX_LED_BIT) | //RX LED off for Arduboy and non Micro based Arduino
|
||||
| _BV(RX_LED_BIT) //RX LED off for Arduboy and non Micro based Arduino
|
||||
#endif
|
||||
_BV(B_BUTTON_BIT)) &
|
||||
// Port B INPUT or LOW
|
||||
~(_BV(SPI_MISO_BIT) | _BV(SPI_MOSI_BIT) | _BV(SPI_SCK_BIT));
|
||||
) & ~(_BV(SPI_MISO_BIT) | _BV(SPI_MOSI_BIT) | _BV(SPI_SCK_BIT));
|
||||
|
||||
// Port B outputs
|
||||
DDRB = (_BV(RED_LED_BIT) | _BV(BLUE_LED_BIT) |
|
||||
DDRB = (_BV(RED_LED_BIT) | _BV(BLUE_LED_BIT)
|
||||
#ifndef AB_ALTERNATE_WIRING
|
||||
_BV(GREEN_LED_BIT) |
|
||||
| _BV(GREEN_LED_BIT)
|
||||
#endif
|
||||
_BV(SPI_MOSI_BIT) | _BV(SPI_SCK_BIT) | _BV(RX_LED_BIT)) &
|
||||
| _BV(SPI_MOSI_BIT) | _BV(SPI_SCK_BIT) | _BV(RX_LED_BIT)) & ~(
|
||||
// Port B inputs
|
||||
~(_BV(B_BUTTON_BIT) | _BV(SPI_MISO_BIT)
|
||||
#ifdef SUPPORT_XY_BUTTONS
|
||||
_BV(A_BUTTON_BIT)
|
||||
#else
|
||||
_BV(B_BUTTON_BIT)
|
||||
#endif
|
||||
| _BV(SPI_MISO_BIT)
|
||||
#ifdef SUPPORT_XY_BUTTONS
|
||||
| _BV(Y_BUTTON_BIT)
|
||||
| _BV(X_BUTTON_BIT)
|
||||
#endif
|
||||
);
|
||||
|
||||
|
@ -277,17 +283,22 @@ void Arduboy2Core::bootPins()
|
|||
0);
|
||||
|
||||
// Port E INPUT_PULLUP or HIGH
|
||||
#ifndef SUPPORT_XY_BUTTONS
|
||||
PORTE |= _BV(A_BUTTON_BIT);
|
||||
// Port E INPUT or LOW (none)
|
||||
// Port E inputs
|
||||
DDRE &= ~(_BV(A_BUTTON_BIT));
|
||||
// Port E outputs (none)
|
||||
#else
|
||||
PORTE |= _BV(B_BUTTON_BIT);
|
||||
DDRE &= ~(_BV(B_BUTTON_BIT));
|
||||
#endif
|
||||
|
||||
// Port F INPUT_PULLUP or HIGH
|
||||
PORTF = (_BV(LEFT_BUTTON_BIT) | _BV(RIGHT_BUTTON_BIT) |
|
||||
_BV(UP_BUTTON_BIT) | _BV(DOWN_BUTTON_BIT)
|
||||
#ifdef SUPPORT_XY_BUTTONS
|
||||
| _BV(X_BUTTON_BIT)
|
||||
| _BV(Y_BUTTON_BIT)
|
||||
#endif
|
||||
) &
|
||||
// Port F INPUT or LOW
|
||||
|
@ -299,7 +310,7 @@ void Arduboy2Core::bootPins()
|
|||
~(_BV(LEFT_BUTTON_BIT) | _BV(RIGHT_BUTTON_BIT) |
|
||||
_BV(UP_BUTTON_BIT) | _BV(DOWN_BUTTON_BIT) |
|
||||
#ifdef SUPPORT_XY_BUTTONS
|
||||
_BV(X_BUTTON_BIT) |
|
||||
_BV(Y_BUTTON_BIT) |
|
||||
#endif
|
||||
_BV(RAND_SEED_IN_BIT));
|
||||
|
||||
|
@ -1383,7 +1394,7 @@ uint8_t Arduboy2Core::buttonsState()
|
|||
(_BV(UP_BUTTON_BIT) | _BV(RIGHT_BUTTON_BIT) |
|
||||
_BV(LEFT_BUTTON_BIT) | _BV(DOWN_BUTTON_BIT) |
|
||||
#ifdef SUPPORT_XY_BUTTONS
|
||||
_BV(X_BUTTON_BIT) |
|
||||
_BV(Y_BUTTON_BIT) |
|
||||
#endif
|
||||
0));
|
||||
// A
|
||||
|
@ -1392,7 +1403,7 @@ uint8_t Arduboy2Core::buttonsState()
|
|||
if (bitRead(B_BUTTON_PORTIN, B_BUTTON_BIT) == 0) { buttons |= B_BUTTON; }
|
||||
#ifdef SUPPORT_XY_BUTTONS
|
||||
// Y
|
||||
if (bitRead(Y_BUTTON_PORTIN, Y_BUTTON_BIT) == 0) { buttons |= Y_BUTTON; }
|
||||
if (bitRead(X_BUTTON_PORTIN, X_BUTTON_BIT) == 0) { buttons |= X_BUTTON; }
|
||||
#endif
|
||||
#elif defined(AB_DEVKIT)
|
||||
// down, left, up
|
||||
|
|
|
@ -147,8 +147,8 @@
|
|||
#define A_BUTTON _BV(3) /**< The A button value for functions requiring a bitmask */
|
||||
#define B_BUTTON _BV(2) /**< The B button value for functions requiring a bitmask */
|
||||
#ifdef SUPPORT_XY_BUTTONS
|
||||
#define X_BUTTON _BV(1)
|
||||
#define Y_BUTTON _BV(0)
|
||||
#define X_BUTTON _BV(0)
|
||||
#define Y_BUTTON _BV(1)
|
||||
#endif
|
||||
|
||||
#define PIN_LEFT_BUTTON A2
|
||||
|
@ -175,30 +175,41 @@
|
|||
#define DOWN_BUTTON_DDR DDRF
|
||||
#define DOWN_BUTTON_BIT PORTF4
|
||||
|
||||
#define PIN_A_BUTTON 7
|
||||
#define A_BUTTON_PORT PORTE
|
||||
#define A_BUTTON_PORTIN PINE
|
||||
#define A_BUTTON_DDR DDRE
|
||||
#define A_BUTTON_BIT PORTE6
|
||||
|
||||
#define PIN_B_BUTTON 8
|
||||
#define B_BUTTON_PORT PORTB
|
||||
#define B_BUTTON_PORTIN PINB
|
||||
#define B_BUTTON_DDR DDRB
|
||||
#define B_BUTTON_BIT PORTB4
|
||||
|
||||
#ifdef SUPPORT_XY_BUTTONS
|
||||
#define PIN_X_BUTTON A4
|
||||
#define X_BUTTON_PORT PORTF
|
||||
#define X_BUTTON_PORTIN PINF
|
||||
#define X_BUTTON_DDR DDRF
|
||||
#define X_BUTTON_BIT PORTF1
|
||||
|
||||
#define PIN_Y_BUTTON 11
|
||||
#define Y_BUTTON_PORT PORTB
|
||||
#define Y_BUTTON_PORTIN PINB
|
||||
#define Y_BUTTON_DDR DDRB
|
||||
#define Y_BUTTON_BIT PORTB7
|
||||
#ifndef SUPPORT_XY_BUTTONS
|
||||
#define PIN_A_BUTTON 7
|
||||
#define A_BUTTON_PORT PORTE
|
||||
#define A_BUTTON_PORTIN PINE
|
||||
#define A_BUTTON_DDR DDRE
|
||||
#define A_BUTTON_BIT PORTE6
|
||||
#else
|
||||
#define PIN_A_BUTTON 8
|
||||
#define A_BUTTON_PORT PORTB
|
||||
#define A_BUTTON_PORTIN PINB
|
||||
#define A_BUTTON_DDR DDRB
|
||||
#define A_BUTTON_BIT PORTB4
|
||||
#endif
|
||||
#ifndef SUPPORT_XY_BUTTONS
|
||||
#define PIN_B_BUTTON 8
|
||||
#define B_BUTTON_PORT PORTB
|
||||
#define B_BUTTON_PORTIN PINB
|
||||
#define B_BUTTON_DDR DDRB
|
||||
#define B_BUTTON_BIT PORTB4
|
||||
#else
|
||||
#define PIN_B_BUTTON 7
|
||||
#define B_BUTTON_PORT PORTE
|
||||
#define B_BUTTON_PORTIN PINE
|
||||
#define B_BUTTON_DDR DDRE
|
||||
#define B_BUTTON_BIT PORTE6
|
||||
#define PIN_X_BUTTON 11
|
||||
#define X_BUTTON_PORT PORTB
|
||||
#define X_BUTTON_PORTIN PINB
|
||||
#define X_BUTTON_DDR DDRB
|
||||
#define X_BUTTON_BIT PORTB7
|
||||
#define PIN_Y_BUTTON A4
|
||||
#define Y_BUTTON_PORT PORTF
|
||||
#define Y_BUTTON_PORTIN PINF
|
||||
#define Y_BUTTON_DDR DDRF
|
||||
#define Y_BUTTON_BIT PORTF1
|
||||
#endif
|
||||
|
||||
#define PIN_SPEAKER_1 5 /**< The pin number of the first lead of the speaker */
|
||||
|
|
Loading…
Reference in New Issue