mirror of
https://github.com/qmk/qmk_userspace.git
synced 2025-06-21 20:57:09 -04:00
Remove deprecated callbacks for encoders and dip switches (#13404)
This commit is contained in:
parent
cbe1e52623
commit
e147ee0079
2 changed files with 46 additions and 42 deletions
|
@ -15,58 +15,61 @@
|
||||||
*/
|
*/
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
[0] = LAYOUT_ortho_4x4(
|
[0] = LAYOUT_ortho_4x4(
|
||||||
KC_F1, KC_F2, KC_F3, KC_F4,
|
KC_F1, KC_F2, KC_F3, KC_F4,
|
||||||
KC_F5, KC_F6, KC_F7, KC_F8,
|
KC_F5, KC_F6, KC_F7, KC_F8,
|
||||||
KC_F9, KC_F10, KC_F11, KC_F12,
|
KC_F9, KC_F10, KC_F11, KC_F12,
|
||||||
KC_F13, KC_F14, KC_F15, TO(1)
|
KC_F13, KC_F14, KC_F15, TO(1)
|
||||||
),
|
),
|
||||||
[1] = LAYOUT_ortho_4x4(
|
[1] = LAYOUT_ortho_4x4(
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, TO(2)
|
KC_TRNS, KC_TRNS, KC_TRNS, TO(2)
|
||||||
),
|
),
|
||||||
[2] = LAYOUT_ortho_4x4(
|
[2] = LAYOUT_ortho_4x4(
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, TO(0)
|
KC_TRNS, KC_TRNS, KC_TRNS, TO(0)
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
switch (get_highest_layer(state)) {
|
switch (get_highest_layer(state)) {
|
||||||
case 0:
|
case 0:
|
||||||
sethsv(HSV_WHITE, (LED_TYPE *)&led[0]);
|
sethsv(HSV_WHITE, (LED_TYPE *)&led[0]);
|
||||||
rgblight_set();
|
rgblight_set();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
sethsv(HSV_GREEN, (LED_TYPE *)&led[0]);
|
sethsv(HSV_GREEN, (LED_TYPE *)&led[0]);
|
||||||
rgblight_set();
|
rgblight_set();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
sethsv(HSV_BLUE, (LED_TYPE *)&led[0]);
|
sethsv(HSV_BLUE, (LED_TYPE *)&led[0]);
|
||||||
rgblight_set();
|
rgblight_set();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
/* With an if statement we can check which encoder was turned. */
|
/* With an if statement we can check which encoder was turned. */
|
||||||
if (index == 0) { /* First encoder */
|
if (index == 0) { /* First encoder */
|
||||||
/* And with another if statement we can check the direction. */
|
/* And with another if statement we can check the direction. */
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
/* This is where the actual magic happens: this bit of code taps on the
|
/* This is where the actual magic happens: this bit of code taps on the
|
||||||
Page Down key. You can do anything QMK allows you to do here.
|
Page Down key. You can do anything QMK allows you to do here.
|
||||||
You'll want to replace these lines with the things you want your
|
You'll want to replace these lines with the things you want your
|
||||||
encoders to do. */
|
encoders to do. */
|
||||||
tap_code(KC_AUDIO_VOL_UP);
|
tap_code(KC_AUDIO_VOL_UP);
|
||||||
} else {
|
} else {
|
||||||
/* And likewise for the other direction, this time Vol Down is pressed. */
|
/* And likewise for the other direction, this time Vol Down is pressed. */
|
||||||
tap_code(KC_AUDIO_VOL_DOWN);
|
tap_code(KC_AUDIO_VOL_DOWN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Encoder click function
|
// Encoder click function
|
||||||
void dip_switch_update_user(uint8_t index, bool active) {
|
bool dip_switch_update_user(uint8_t index, bool active) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
/* First encoder */
|
/* First encoder */
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -94,4 +94,5 @@ void dip_switch_update_user(uint8_t index, bool active) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue