1
0
Fork 0

Remove the need to specify NUM_OF_ENCODERS for the Encoder feature (#6328)

* Remove the need to set NUM_OF_ENCODERS

Instead, calculate the size of the array, and use that instead

* Add hack for split common support

* Remove NUM_OF_ENCODERS from keyboard config

Can be reverted, if needed
This commit is contained in:
Drashna Jaelre 2019-07-16 01:40:54 -07:00 committed by skullydazed
parent 97a3f806c4
commit f6c7e11426
20 changed files with 11 additions and 31 deletions

View file

@ -6,7 +6,6 @@ Basic encoders are supported by adding this to your `rules.mk`:
and this to your `config.h`:
#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { B12 }
#define ENCODERS_PAD_B { B13 }

View file

@ -239,7 +239,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define BOOTMAGIC_LITE_ROW 0
// #define BOOTMAGIC_LITE_COLUMN 0
#define NUMBER_OF_ENCODERS 3
#define ENCODERS_PAD_A { B2, B3, D5 }
#define ENCODERS_PAD_B { B1, B7, B4 }
#define ENCODER_RESOLUTION 2

View file

@ -26,7 +26,6 @@
#define MATRIX_ROW_PINS { A3, B8, B9, B1 }
#define MATRIX_COL_PINS { A7, A8, B2, B10 }
#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { B13 }
#define ENCODERS_PAD_B { B14 }
@ -193,4 +192,3 @@
#define RGB_MATRIX_KEYPRESSES
#define SOLENOID_PIN A14

View file

@ -39,7 +39,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define BACKLIGHT_BREATHING
#define BREATHING_PERIOD 6
#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { B9 }
#define ENCODERS_PAD_B { B8 }

View file

@ -35,7 +35,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROW_PINS { B3, B4, A0, A2, A4, A3 }
#define DIODE_DIRECTION COL2ROW
#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { B9 }
#define ENCODERS_PAD_B { B8 }

View file

@ -44,7 +44,6 @@
#define MATRIX_COL_PINS { B8, B2, B10, A0, A1, A2, B0, A3, B1, A6, A7, B12, C13, B11, B9 }
#define UNUSED_PINS
#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { B13 }
#define ENCODERS_PAD_B { B14 }

View file

@ -52,7 +52,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DEBOUNCE 5
/* Set up rotary encoder */
#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { F1 }
#define ENCODERS_PAD_B { F0 }
#define ENCODER_RESOLUTION 2

View file

@ -38,7 +38,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{ E6, B4, B2 } \
}
#define NUMBER_OF_ENCODERS 2
#define ENCODERS_PAD_A { D1, F5 }
#define ENCODERS_PAD_B { D0, F6 }

View file

@ -41,7 +41,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define QMK_LED B0
#define QMK_SPEAKER C6
#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { B5 }
#define ENCODERS_PAD_B { B7 }

View file

@ -43,7 +43,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DEBOUNCE 5
/* Rotary encoders */
#define NUMBER_OF_ENCODERS 2
#define ENCODERS_PAD_A { D2, F6 }
#define ENCODERS_PAD_B { D3, F5 }
#define ENCODER_RESOLUTION 4

View file

@ -43,7 +43,6 @@
#define MATRIX_ROW_PINS { A10, A9, A8, B15, C13, C14, C15, A2 }
#define MATRIX_COL_PINS { B11, B10, B2, B1, A7, B0 }
#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { B12 }
#define ENCODERS_PAD_B { B13 }

View file

@ -43,7 +43,6 @@
* #define UNUSED_PINS
*/
#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { B12 }
#define ENCODERS_PAD_B { B13 }

View file

@ -43,7 +43,6 @@
* #define UNUSED_PINS
*/
#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { B12 }
#define ENCODERS_PAD_B { B13 }

View file

@ -36,7 +36,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_COL_PINS { F0, F1, F4, F5, F6, F7, C7 }
// Encoder support
#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { D2 }
#define ENCODERS_PAD_B { D6 }

View file

@ -41,8 +41,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROW_PINS { C6, E6, B5, D7, B4 }
#define MATRIX_COL_PINS { F4, F5, F6, F7, B3, B1, B2 }
#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { D4 }
#define ENCODERS_PAD_B { D2 }

View file

@ -40,7 +40,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define SOFT_SERIAL_PIN D3
#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { D2 }
#define ENCODERS_PAD_B { D7 }

View file

@ -30,7 +30,6 @@
#define MATRIX_ROWS 7
#define MATRIX_COLS 14
#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { B7 }
#define ENCODERS_PAD_B { D5 }

View file

@ -40,7 +40,6 @@
#define NO_MUSIC_MODE
#endif
#define NUMBER_OF_ENCODERS 2
#define ENCODERS_PAD_A { D1,F1 }
#define ENCODERS_PAD_B { D0,F0 }

View file

@ -25,16 +25,14 @@
#define ENCODER_RESOLUTION 4
#endif
#ifndef NUMBER_OF_ENCODERS
#error "Number of encoders not defined by NUMBER_OF_ENCODERS"
#endif
#if !defined(ENCODERS_PAD_A) || !defined(ENCODERS_PAD_B)
#error "No encoder pads defined by ENCODERS_PAD_A and ENCODERS_PAD_B"
#endif
static pin_t encoders_pad_a[NUMBER_OF_ENCODERS] = ENCODERS_PAD_A;
static pin_t encoders_pad_b[NUMBER_OF_ENCODERS] = ENCODERS_PAD_B;
#define NUMBER_OF_ENCODERS (sizeof(encoders_pad_a)/sizeof(pin_t))
static pin_t encoders_pad_a[] = ENCODERS_PAD_A;
static pin_t encoders_pad_b[] = ENCODERS_PAD_B;
static int8_t encoder_LUT[] = { 0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0 };

View file

@ -17,6 +17,8 @@
#ifdef ENCODER_ENABLE
# include "encoder.h"
static pin_t encoders_pad[] = ENCODERS_PAD_A;
# define NUMBER_OF_ENCODERS (sizeof(encoders_pad)/sizeof(pin_t))
#endif
#if defined(USE_I2C) || defined(EH)