Skip to content

Commit

Permalink
Fix additional keymaps
Browse files Browse the repository at this point in the history
  • Loading branch information
drashna committed May 22, 2021
1 parent f42cc72 commit 30b0183
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 16 deletions.
5 changes: 3 additions & 2 deletions keyboards/clueboard/2x1800/2019/2019.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ bool led_update_kb(led_t led_state) {
return res;
}

__attribute__((weak)) bool encoder_update_keymap(int8_t index, bool clockwise) { return true; }
__attribute__((weak)) bool encoder_update_keymap(uint8_t index, bool clockwise) { return true; }
__attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) { return encoder_update_keymap(index, clockwise); }

bool encoder_update_kb(uint8_t index, bool clockwise) {
if (encoder_update_user(index, clockwise)) {
if (!encoder_update_user(index, clockwise)) {
// Encoder 1, outside left
if (index == 0 && clockwise) {
tap_code(KC_MS_U); // turned right
Expand Down Expand Up @@ -177,4 +177,5 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
tap_code(KC_MS_L); // turned left
}
}
return true;
}
9 changes: 5 additions & 4 deletions keyboards/hadron/hadron.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#ifndef HADRON_H
#define HADRON_H

#ifdef SUBPROJECT_ver0
#include "quantum.h"

#ifdef KEYBOARD_hadron_ver0
#include "ver0.h"
#endif
#ifdef SUBPROJECT_ver2
#ifdef KEYBOARD_hadron_ver2
#include "ver2.h"
#endif
#ifdef SUBPROJECT_ver3
#ifdef KEYBOARD_hadron_ver3
#include "ver3.h"
#endif
#include "quantum.h"


#define LAYOUT( \
Expand Down
3 changes: 3 additions & 0 deletions keyboards/hadron/ver3/ver3.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "action_layer.h"
#include "haptic.h"


#ifdef RGB_MATRIX_ENABLE
#include "rgb_matrix.h"

Expand Down Expand Up @@ -181,6 +182,8 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
return process_record_user(keycode, record);
}

bool encoder_update_user(uint8_t index, bool clockwise);

bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) return false;
encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64;
Expand Down
2 changes: 1 addition & 1 deletion keyboards/hadron/ver3/ver3.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
*/
#pragma once

#include "hadron.h"
#include "hadron.h"
2 changes: 1 addition & 1 deletion keyboards/rgbkb/sol/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ const uint16_t PROGMEM encoders[][NUMBER_OF_ENCODERS * 2][2] = {

bool encoder_update_user(uint8_t index, bool clockwise) {
if (!is_keyboard_master())
return;
return true;

#ifdef RGB_OLED_MENU
if (index == RGB_OLED_MENU) {
Expand Down
1 change: 1 addition & 0 deletions keyboards/splitkb/zima/zima.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,6 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
} else {
tap_code16(KC_VOLD);
}
return true;
}
#endif
2 changes: 1 addition & 1 deletion layouts/community/ortho_4x12/bocaj/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void rgb_matrix_indicators_user(void) {
void matrix_init_keymap(void) {}

#ifdef ENCODER_ENABLE
bool encoder_update_user(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
switch (get_highest_layer(layer_state)) {
case _RAISE:
clockwise ? tap_code(KC_VOLD) : tap_code(KC_VOLU);
Expand Down
2 changes: 1 addition & 1 deletion layouts/community/ortho_4x12/buswerks/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}

bool encoder_update_user(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (IS_LAYER_ON(_RAISE) || IS_LAYER_ON(_LOWER)) {
if (clockwise) {
register_code(KC_VOLU);
Expand Down
2 changes: 1 addition & 1 deletion layouts/community/ortho_4x12/drashna/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void matrix_init_keymap(void) {
#endif // RGB_MATRIX_INIT

#ifdef ENCODER_ENABLE
bool encoder_update_user(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
switch (get_highest_layer(layer_state)) {
case _RAISE:
clockwise ? tap_code(KC_VOLD) : tap_code(KC_VOLU);
Expand Down
2 changes: 1 addition & 1 deletion layouts/community/ortho_4x12/jackhumbert/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
};

bool encoder_update_user(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
#ifdef MOUSEKEY_ENABLE
tap_code(KC_MS_WH_DOWN);
Expand Down
2 changes: 1 addition & 1 deletion layouts/community/ortho_4x12/juno/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ uint16_t muse_counter = 0;
uint8_t muse_offset = 70;
uint16_t muse_tempo = 50;

bool encoder_update_user(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (muse_mode) {
if (IS_LAYER_ON(_RAISE)) {
if (clockwise) {
Expand Down
2 changes: 1 addition & 1 deletion layouts/community/ortho_4x12/junonum/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ uint16_t muse_counter = 0;
uint8_t muse_offset = 70;
uint16_t muse_tempo = 50;

bool encoder_update_user(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (muse_mode) {
if (IS_LAYER_ON(_RAISE)) {
if (clockwise) {
Expand Down
2 changes: 1 addition & 1 deletion layouts/community/ortho_4x12/mguterl/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ uint16_t muse_counter = 0;
uint8_t muse_offset = 70;
uint16_t muse_tempo = 50;

bool encoder_update_user(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (muse_mode) {
if (IS_LAYER_ON(_RAISE)) {
if (clockwise) {
Expand Down
2 changes: 1 addition & 1 deletion layouts/community/ortho_4x12/mindsound/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}

bool encoder_update_user(bool clockwise) {
bool encoder_update_user(uint8_t index, bool clockwise) {
if (clockwise) {
register_code(KC_VOLU);
unregister_code(KC_VOLU);
Expand Down
4 changes: 4 additions & 0 deletions quantum/quantum.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ extern layer_state_t layer_state;
# include "usbpd.h"
#endif

#ifdef ENCODER_ENABLE
# include "encoder.h"
#endif

// For tri-layer
void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3);
Expand Down

0 comments on commit 30b0183

Please sign in to comment.