Support ENCODER_RESOLUTION and update to latest qmk

Note: my qmk 1.1.2 didnt compile, but went fine after updating to 1.1.5
This commit is contained in:
Thomas Haukland
2024-03-23 21:52:01 +01:00
parent 174d7927be
commit 9fc2810eff
3 changed files with 29 additions and 28 deletions
+6 -20
View File
@@ -3,35 +3,21 @@
#pragma once
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
//#define NO_DEBUG
/* disable print */
//#define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
#define BOTH_SHIFTS_TURNS_ON_CAPS_WORD
#define WS2812_PIO_USE_PIO1 // Force the usage of PIO1 peripheral, by default the WS2812 implementation uses the PIO0 peripheral
//#define WS2812_TRST_US 80
#define WS2812_BYTE_ORDER WS2812_BYTE_ORDER_RGB
#define RGB_MATRIX_DEFAULT_VAL 32
// Pick good defaults for enabling homerow modifiers
// Pick good defaults for enabling home-row modifiers
#define TAPPING_TERM 230
#define WS2812_DI_PIN GP16 // The pin connected to the data pin of the LEDs
#define RGBLED_NUM 1 // The number of LEDs connected
#define RGBLIGHT_LED_COUNT 1 // The number of LEDs connected
#define MAX_DEFERRED_EXECUTORS 32
// How many "tents" should you turn per action
#define ENCODER_RESOLUTION 1
+20 -5
View File
@@ -1,24 +1,39 @@
#include "matrix.h"
#include "rgblight.h"
#include "quantum.h"
#define COL_SHIFTER ((uint16_t)1)
static bool colABpressed = false;
static bool encoderPressed = false;
static uint16_t turns = 0;
static bool last_turn_clockwise;
void clicked(void) {
tap_code(KC_MPLY);
}
void turned(bool clockwise) {
if (IS_LAYER_ON(6)) {
tap_code(clockwise ? KC_VOLU : KC_VOLD);
if (clockwise != last_turn_clockwise) {
// Switched way, reset counter
last_turn_clockwise = clockwise;
turns = 0;
}
turns++;
if (!(turns%ENCODER_RESOLUTION == 0)) {
return;
}
if (IS_LAYER_ON(4)) {
// clockwise ? rgb_matrix_decrease() : rgb_matrix_increase();
} else if (IS_LAYER_ON(3)) {
tap_code(clockwise ? KC_VOLU : KC_VOLD);
} else if (IS_LAYER_ON(2)) {
tap_code16(clockwise ? LCTL(KC_TAB) : LCTL(LSFT(KC_TAB)));
} else if (IS_LAYER_ON(5)) {
tap_code(clockwise ? KC_MS_WH_DOWN : KC_MS_WH_UP);
} else if (IS_LAYER_ON(1)) {
tap_code(clockwise ? KC_PGDN : KC_PGUP);
} else {
tap_code16(clockwise ? LGUI(KC_Y) : LGUI(KC_Z));
tap_code(clockwise ? KC_WH_D : KC_WH_U);
}
}
+3 -3
View File
@@ -39,8 +39,8 @@
"KC_SLSH",
"LT(6,KC_ESC)",
"LT(3,KC_SPC)",
"LT(3,KC_TAB)",
"LT(2,KC_NO)",
"LT(5,KC_TAB)",
"LT(1,KC_DEL)",
"LT(2,KC_BSPC)",
"LT(4,KC_ENT)"
],
@@ -274,4 +274,4 @@
]
],
"author": "thomas.haukland@gmail.com"
}
}