moved encoder code into userspace
This commit is contained in:
parent
2365402b7a
commit
7eaf7d8279
|
|
@ -240,24 +240,3 @@ void oled_task_user(void) {
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
||||
if (index == 0) {
|
||||
// Volume control
|
||||
if (clockwise) {
|
||||
tap_code(KC_VOLU);
|
||||
} else {
|
||||
tap_code(KC_VOLD);
|
||||
}
|
||||
}
|
||||
else if (index == 1) {
|
||||
if(clockwise) {
|
||||
tap_code16(C(KC_RGHT));
|
||||
}
|
||||
else{
|
||||
tap_code16(C(KC_LEFT));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -247,7 +247,8 @@ void oled_task_user(void) {
|
|||
#endif
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
||||
// TODO: Remove this and update the pins to be correct on index 1 encoder, right now clockwise is left... This is because the pins need to be swapped
|
||||
bool encoder_update_keymap(uint8_t index, bool clockwise) {
|
||||
if (index == 0) {
|
||||
// Volume control
|
||||
if (clockwise) {
|
||||
|
|
@ -273,5 +274,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
|||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
@ -255,7 +255,8 @@ void oled_task_user(void) {
|
|||
#endif
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
||||
// TODO: Remove this and update the pins to be correct on index 1 encoder, right now clockwise is left... This is because the pins need to be swapped
|
||||
bool encoder_update_keymap(uint8_t index, bool clockwise) {
|
||||
if (index == 0) {
|
||||
// Volume control
|
||||
if (clockwise) {
|
||||
|
|
@ -272,5 +273,7 @@ void encoder_update_user(uint8_t index, bool clockwise) {
|
|||
tap_code16(C(KC_RGHT));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -110,24 +110,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
};
|
||||
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
||||
if (index == 0) {
|
||||
// Volume control
|
||||
if (clockwise) {
|
||||
tap_code(KC_VOLU);
|
||||
} else {
|
||||
tap_code(KC_VOLD);
|
||||
}
|
||||
}
|
||||
else if (index == 1) {
|
||||
if(clockwise) {
|
||||
tap_code16(C(KC_RGHT));
|
||||
}
|
||||
else{
|
||||
tap_code16(C(KC_LEFT));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#include "encoder.h"
|
||||
|
||||
__attribute__((weak)) bool encoder_update_keymap(uint8_t index, bool clockwise) { return true; }
|
||||
|
||||
void encoder_update_user(uint8_t index, bool clockwise) {
|
||||
if (!encoder_update_keymap(index, clockwise)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// default behavior if undefined
|
||||
if (index == 0) {
|
||||
// Volume control
|
||||
if (clockwise) {
|
||||
tap_code(KC_VOLU);
|
||||
} else {
|
||||
tap_code(KC_VOLD);
|
||||
}
|
||||
}
|
||||
else if (index == 1) {
|
||||
if(clockwise) {
|
||||
tap_code16(C(KC_RGHT));
|
||||
}
|
||||
else{
|
||||
tap_code16(C(KC_LEFT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
#include "sadekbaroudi.h"
|
||||
|
||||
bool encoder_update_keymap(uint8_t index, bool clockwise);
|
||||
|
|
@ -54,6 +54,10 @@ ifeq ($(strip $(RAW_ENABLE)), yes)
|
|||
SRC += hid.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(ENCODER_ENABLE)), yes)
|
||||
SRC += encoder.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CASEMODES_ENABLE)), yes)
|
||||
SRC += casemodes.c
|
||||
endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue