🐛 Fix RRW Keypad & Zonestar buttons (#23388)

This commit is contained in:
ellensp 2021-12-30 20:35:22 +13:00 committed by Scott Lahteine
parent 4202baa409
commit 1c3f2498b1

View File

@ -45,36 +45,6 @@
#define ENCODER_PHASE_3 1 #define ENCODER_PHASE_3 1
#endif #endif
#if IS_RRW_KEYPAD
#define BTN_OFFSET 0 // Bit offset into buttons for shift register values
#define BLEN_KEYPAD_F3 0
#define BLEN_KEYPAD_F2 1
#define BLEN_KEYPAD_F1 2
#define BLEN_KEYPAD_DOWN 3
#define BLEN_KEYPAD_RIGHT 4
#define BLEN_KEYPAD_MIDDLE 5
#define BLEN_KEYPAD_UP 6
#define BLEN_KEYPAD_LEFT 7
#define EN_KEYPAD_F1 _BV(BTN_OFFSET + BLEN_KEYPAD_F1)
#define EN_KEYPAD_F2 _BV(BTN_OFFSET + BLEN_KEYPAD_F2)
#define EN_KEYPAD_F3 _BV(BTN_OFFSET + BLEN_KEYPAD_F3)
#define EN_KEYPAD_DOWN _BV(BTN_OFFSET + BLEN_KEYPAD_DOWN)
#define EN_KEYPAD_RIGHT _BV(BTN_OFFSET + BLEN_KEYPAD_RIGHT)
#define EN_KEYPAD_MIDDLE _BV(BTN_OFFSET + BLEN_KEYPAD_MIDDLE)
#define EN_KEYPAD_UP _BV(BTN_OFFSET + BLEN_KEYPAD_UP)
#define EN_KEYPAD_LEFT _BV(BTN_OFFSET + BLEN_KEYPAD_LEFT)
#define RRK(B) (keypad_buttons & (B))
#ifdef EN_C
#define BUTTON_CLICK() ((buttons & EN_C) || RRK(EN_KEYPAD_MIDDLE))
#else
#define BUTTON_CLICK() RRK(EN_KEYPAD_MIDDLE)
#endif
#endif
#if EITHER(HAS_DIGITAL_BUTTONS, HAS_DWIN_E3V2) #if EITHER(HAS_DIGITAL_BUTTONS, HAS_DWIN_E3V2)
// Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes) // Wheel spin pins where BA is 00, 10, 11, 01 (1 bit always changes)
#define BLEN_A 0 #define BLEN_A 0
@ -141,9 +111,41 @@
#define B_ST _BV(BL_ST) #define B_ST _BV(BL_ST)
#ifndef BUTTON_CLICK #ifndef BUTTON_CLICK
#if EN_C
#define BUTTON_CLICK() (buttons & (B_MI|B_ST)) #define BUTTON_CLICK() (buttons & (B_MI|B_ST))
#endif #endif
#endif #endif
#endif
#if IS_RRW_KEYPAD
#define BTN_OFFSET 0 // Bit offset into buttons for shift register values
#define BLEN_KEYPAD_F3 0
#define BLEN_KEYPAD_F2 1
#define BLEN_KEYPAD_F1 2
#define BLEN_KEYPAD_DOWN 3
#define BLEN_KEYPAD_RIGHT 4
#define BLEN_KEYPAD_MIDDLE 5
#define BLEN_KEYPAD_UP 6
#define BLEN_KEYPAD_LEFT 7
#define EN_KEYPAD_F1 _BV(BTN_OFFSET + BLEN_KEYPAD_F1)
#define EN_KEYPAD_F2 _BV(BTN_OFFSET + BLEN_KEYPAD_F2)
#define EN_KEYPAD_F3 _BV(BTN_OFFSET + BLEN_KEYPAD_F3)
#define EN_KEYPAD_DOWN _BV(BTN_OFFSET + BLEN_KEYPAD_DOWN)
#define EN_KEYPAD_RIGHT _BV(BTN_OFFSET + BLEN_KEYPAD_RIGHT)
#define EN_KEYPAD_MIDDLE _BV(BTN_OFFSET + BLEN_KEYPAD_MIDDLE)
#define EN_KEYPAD_UP _BV(BTN_OFFSET + BLEN_KEYPAD_UP)
#define EN_KEYPAD_LEFT _BV(BTN_OFFSET + BLEN_KEYPAD_LEFT)
#define RRK(B) (keypad_buttons & (B))
#ifdef EN_C
#define BUTTON_CLICK() ((buttons & EN_C) || RRK(EN_KEYPAD_MIDDLE))
#else
#define BUTTON_CLICK() RRK(EN_KEYPAD_MIDDLE)
#endif
#endif
#ifndef EN_A #ifndef EN_A
#define EN_A 0 #define EN_A 0