From 822745e2200babd0abd976176484659f199a9cf1 Mon Sep 17 00:00:00 2001 From: "Mr.Blinky" Date: Mon, 12 Dec 2022 14:18:46 +0100 Subject: [PATCH] update arduboy, arduboy2 libraries Arduboy, Arduboy2: Rotated D-pad buttons 180 degrees for microcade arduboy: added forgotten rgb on code for microcade --- .../libraries/Arduboy/src/core/core.cpp | 4 ++- .../libraries/Arduboy/src/core/core.h | 14 ++++++++ .../libraries/Arduboy2/src/Arduboy2Core.h | 33 +++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/board-package-source/libraries/Arduboy/src/core/core.cpp b/board-package-source/libraries/Arduboy/src/core/core.cpp index b092eb0..6e81419 100644 --- a/board-package-source/libraries/Arduboy/src/core/core.cpp +++ b/board-package-source/libraries/Arduboy/src/core/core.cpp @@ -909,13 +909,15 @@ void ArduboyCore::flipHorizontal(boolean flipped) void ArduboyCore::setRGBled(uint8_t red, uint8_t green, uint8_t blue) { #ifdef ARDUBOY_10 // RGB, all the pretty colors - #if defined(LCD_ST7565) + #if defined(LCD_ST7565) || (MICROCADE) if ((red | green | blue) == 0) //prevent backlight off { red = 255; green = 255; blue = 255; } + #endif + #if defined(LCD_ST7565) analogWrite(RED_LED, red); analogWrite(GREEN_LED, green); analogWrite(BLUE_LED, blue); diff --git a/board-package-source/libraries/Arduboy/src/core/core.h b/board-package-source/libraries/Arduboy/src/core/core.h index 8fd7af5..e5c43bb 100644 --- a/board-package-source/libraries/Arduboy/src/core/core.h +++ b/board-package-source/libraries/Arduboy/src/core/core.h @@ -87,10 +87,17 @@ #define RX_LED 17 // pin values for buttons, probably shouldn't use these +#if defined (MICROCADE) +#define PIN_LEFT_BUTTON A1 // joystick rotated 180 degrees +#define PIN_RIGHT_BUTTON A2 +#define PIN_UP_BUTTON A3 +#define PIN_DOWN_BUTTON A0 +#else #define PIN_LEFT_BUTTON A2 #define PIN_RIGHT_BUTTON A1 #define PIN_UP_BUTTON A0 #define PIN_DOWN_BUTTON A3 +#endif #ifndef SUPPORT_XY_BUTTONS #define PIN_A_BUTTON 7 #define PIN_B_BUTTON 8 @@ -100,10 +107,17 @@ #endif // bit values for button states +#if defined (MICROCADE) +#define LEFT_BUTTON _BV(6) +#define RIGHT_BUTTON _BV(5) +#define UP_BUTTON _BV(4) +#define DOWN_BUTTON _BV(7) +#else #define LEFT_BUTTON _BV(5) #define RIGHT_BUTTON _BV(6) #define UP_BUTTON _BV(7) #define DOWN_BUTTON _BV(4) +#endif #define A_BUTTON _BV(3) #define B_BUTTON _BV(2) diff --git a/board-package-source/libraries/Arduboy2/src/Arduboy2Core.h b/board-package-source/libraries/Arduboy2/src/Arduboy2Core.h index 364085b..539671b 100644 --- a/board-package-source/libraries/Arduboy2/src/Arduboy2Core.h +++ b/board-package-source/libraries/Arduboy2/src/Arduboy2Core.h @@ -140,10 +140,17 @@ // bit values for button states // these are determined by the buttonsState() function +#if defined (MICROCADE) +#define LEFT_BUTTON _BV(6) // joystick is rotated 180 degrees +#define RIGHT_BUTTON _BV(5) +#define UP_BUTTON _BV(4) +#define DOWN_BUTTON _BV(7) +#else #define LEFT_BUTTON _BV(5) /**< The Left button value for functions requiring a bitmask */ #define RIGHT_BUTTON _BV(6) /**< The Right button value for functions requiring a bitmask */ #define UP_BUTTON _BV(7) /**< The Up button value for functions requiring a bitmask */ #define DOWN_BUTTON _BV(4) /**< The Down button value for functions requiring a bitmask */ +#endif #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 @@ -151,6 +158,31 @@ #define Y_BUTTON _BV(1) #endif +#if defined (MICROCADE) +#define PIN_LEFT_BUTTON A1 +#define LEFT_BUTTON_PORT PORTF +#define LEFT_BUTTON_PORTIN PINF +#define LEFT_BUTTON_DDR DDRF +#define LEFT_BUTTON_BIT PORTF6 + +#define PIN_RIGHT_BUTTON A2 +#define RIGHT_BUTTON_PORT PORTF +#define RIGHT_BUTTON_PORTIN PINF +#define RIGHT_BUTTON_DDR DDRF +#define RIGHT_BUTTON_BIT PORTF5 + +#define PIN_UP_BUTTON A3 +#define UP_BUTTON_PORT PORTF +#define UP_BUTTON_PORTIN PINF +#define UP_BUTTON_DDR DDRF +#define UP_BUTTON_BIT PORTF4 + +#define PIN_DOWN_BUTTON A0 +#define DOWN_BUTTON_PORT PORTF +#define DOWN_BUTTON_PORTIN PINF +#define DOWN_BUTTON_DDR DDRF +#define DOWN_BUTTON_BIT PORTF7 +#else #define PIN_LEFT_BUTTON A2 #define LEFT_BUTTON_PORT PORTF #define LEFT_BUTTON_PORTIN PINF @@ -174,6 +206,7 @@ #define DOWN_BUTTON_PORTIN PINF #define DOWN_BUTTON_DDR DDRF #define DOWN_BUTTON_BIT PORTF4 +#endif #ifndef SUPPORT_XY_BUTTONS #define PIN_A_BUTTON 7