aboutsummaryrefslogtreecommitdiff
path: root/qmk
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2024-09-20 20:02:32 +0200
committerSébastien Dailly <sebastien@dailly.me>2024-09-20 20:02:32 +0200
commitdfb35d02234fc4e6193784611e85b53e4142c82b (patch)
tree7f83fe2b9a6d649072ad5da0b25008da5e7b453b /qmk
parent753701d6f537ea02137c227f2727477229baa45b (diff)
Updated the code to qmk 61778f6136
Diffstat (limited to 'qmk')
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/keymap.c30
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/lighting.c113
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/overrides.c14
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/overrides.h41
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c9
-rw-r--r--qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.h4
6 files changed, 182 insertions, 29 deletions
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c b/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c
index b02567e..15e1291 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/keymap.c
@@ -13,9 +13,26 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include QMK_KEYBOARD_H
+#include "keymap_common.h"
+#include "quantum_keycodes.h"
+#include "process_tap_dance.h"
+#include "process_key_override.h"
+
#include "keymap_bepo.h"
#include "keycodes.h"
+#include "quad_tapdance.h"
+#include "overrides.h"
+#include QMK_KEYBOARD_H
+
+// Declare the tapdance table here.
+tap_dance_action_t tap_dance_actions[] = {
+ [TD_C_CCED] = ACTION_TAP_DANCE_DOUBLE(BP_C, BP_CCED),
+ [TD_PRC] = ACTION_TAP_DANCE_DOUBLE(BP_EQL, BP_PERC),
+ [TD_W_CAPSLOCK] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, w_finished, w_reset),
+ [TD_LAYER_SYMB] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ql_finished, ql_reset),
+ [TD_EE] = ACTION_TAP_DANCE_DOUBLE(BP_COMM, BP_EGRV),
+};
+
#define LY_SYMBOL TD(TD_LAYER_SYMB)
@@ -43,20 +60,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
BP_DLR, BP_B, BP_EACU, BP_P, BP_O, KC_BSPC, BP_DCIR, BP_V, BP_D, BP_L, BP_J, BP_Z,
KC_TAB, BP_A, BP_U, BP_I, KEY_E, KEY_EE, KEY_C, KEY_T, BP_S, BP_R, BP_N, BP_M,
KC_LSFT, BP_AGRV,BP_Y, BP_X, BP_DOT, KC_B, KC_MUTE, KC_MPLY,BP_QUOT, BP_Q, BP_G, BP_H, BP_F, KEY_W,
- KC_LCTL, KC_DELETE,KC_LGUI,LY_SYMBOL,AL_SPC, AL_ENT, LY_SYMBOL,KEY_APP, KEY_INS, KC_RCTL
+ KC_LCTL, KC_DELETE,KC_LGUI,LY_SYMBOL,AL_SPC, AL_ENT, LY_SYMBOL,KEY_APP, KEY_INS, KC_RCTL
),
// In the number layout, I keep the mod-tap modifiers applies to the middle letters :
//
#define KEY_5 MT(MOD_LCTL, KC_P5)
#define KEY_DOWN MT(MOD_RCTL, KC_DOWN)
+#define EEPROM QK_CLEAR_EEPROM
// This layer is used to access to the numeric keypad, functions keys, and also provide some keys used with KC_LGUI
[LAYER_SYMBOLS] = LAYOUT(
- KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
- KC_NO, KC_NO, KC_P7, KC_P8, KC_P9, KC_TRNS, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_NO, S(BP_EQL),
- KC_TAB, KC_NO, KC_P4, KEY_5, KC_P6, KC_NO, KC_LEFT, KEY_DOWN, KC_RIGHT,BP_R, BP_N, KC_PGUP,
- KC_LSFT, KC_NO, KC_P1, KC_P2, KC_P3, KC_NO, KC_MUTE, KC_MPLY,KC_PGUP, KC_TRNS, KC_PGDN, KC_TRNS, BP_F, KC_PGDN,
+ KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
+ EEPROM, KC_NO, KC_P7, KC_P8, KC_P9, KC_TRNS, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_NO, S(BP_EQL),
+ KC_TAB, KC_NO, KC_P4, KEY_5, KC_P6, KC_NO, KC_LEFT, KC_DOWN, KC_RIGHT,BP_R, BP_N, KC_PGUP,
+ KC_LSFT, KC_NO, KC_P1, KC_P2, KC_P3, KC_NO, KC_MUTE, KC_MPLY,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, BP_F, KC_PGDN,
KC_P0, KC_PDOT, KC_TRNS, LY_SYMBOL,AL_SPC, AL_ENT, LY_SYMBOL,KC_TRNS, KC_RGUI, KC_TRNS
),
};
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/lighting.c b/qmk/keyboards/sofle_choc/keymaps/custom/lighting.c
new file mode 100644
index 0000000..3e4c5b0
--- /dev/null
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/lighting.c
@@ -0,0 +1,113 @@
+#include QMK_KEYBOARD_H
+ uint8_t flags = 0;
+#include "keycodes.h"
+
+// Set the color at the given position, but limit the intensity
+void set_color(uint8_t index, uint8_t h, uint8_t s, uint8_t _) {
+ HSV hsv = {h, s, RGB_MATRIX_MAXIMUM_BRIGHTNESS};
+ RGB rgb = hsv_to_rgb(hsv);
+ rgb_matrix_set_color(index, rgb.r, rgb.g, rgb.b);
+}
+
+HSV hsv_of_color(uint8_t h, uint8_t s, uint8_t v) {
+ return (HSV){h, s, v > 100 ? 100:v};
+}
+
+#define KEY_5 MT(MOD_LCTL, KC_P5)
+#define KEY_DOWN MT(MOD_RCTL, KC_DOWN)
+bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
+ // Activate effects depending of mods
+
+ // Colors for the mods
+ HSV const colors[] = {
+ hsv_of_color(HSV_BLACK), // 000
+ hsv_of_color(55, 255, 255),// 001
+ hsv_of_color(HSV_RED), // 010
+ hsv_of_color(HSV_ORANGE),// 011
+ hsv_of_color(HSV_CYAN), // 100
+ hsv_of_color(HSV_GREEN), // 101
+ hsv_of_color(HSV_PURPLE),// 110
+ hsv_of_color(HSV_WHITE), // 111
+ };
+
+ if (is_caps_word_on()) {
+ if (rgb_matrix_get_mode() != RGB_MATRIX_BREATHING) {
+ rgb_matrix_mode_noeeprom(RGB_MATRIX_BREATHING);
+ }
+ rgb_matrix_sethsv_noeeprom(HSV_SPRINGGREEN);
+ return false;
+ }
+
+ uint8_t counter = 0;
+ uint8_t flags = 0;
+ if (get_mods() & MOD_MASK_CTRL) {
+ flags |= 0b001;
+ counter += 1;
+ }
+ if (get_mods() & MOD_MASK_ALT) {
+ flags |= 0b010;
+ counter += 1;
+ }
+ if (get_mods() & MOD_MASK_SHIFT) {
+ flags |= 0b100;
+ counter += 1;
+ }
+
+ if (get_highest_layer(layer_state) > 0) {
+ for (uint8_t row = 0; row < MATRIX_ROWS; ++row) {
+ for (uint8_t col = 0; col < MATRIX_COLS; ++col) {
+ uint8_t index = g_led_config.matrix_co[row][col];
+
+ if (index < led_min || index > led_max || index == NO_LED)
+ continue;
+
+ uint8_t layer = layer_switch_get_layer((keypos_t){col,row});
+ if (layer == 0)
+ continue;
+
+ uint16_t keycode = keymap_key_to_keycode(layer, (keypos_t){col,row});
+
+ switch (keycode) {
+ case KC_F1 ... KC_F11:
+ rgb_matrix_set_color(index, 128, 128, 128);
+ break;
+ case KC_P1 ... KC_P0:
+ case KEY_5:
+ rgb_matrix_set_color(index, 100, 100, 0);
+ break;
+ case KC_RIGHT:
+ case KEY_DOWN:
+ case KC_LEFT ... KC_UP:
+ case KC_PGUP:
+ case KC_PGDN:
+ rgb_matrix_set_color(index, 32, 32, 128);
+ break;
+ case KC_HOME:
+ case KC_END:
+ rgb_matrix_set_color(index, RGB_SPRINGGREEN);
+ break;
+ case AL_SPC:
+ case AL_ENT:
+ set_color(index, HSV_BLUE);
+ break;
+ }
+
+ }
+ }
+ }
+
+ if (get_mods()) {
+ if (rgb_matrix_get_mode() != RGB_MATRIX_SOLID_COLOR) {
+ rgb_matrix_mode_noeeprom(RGB_MATRIX_SOLID_COLOR);
+ }
+ uint8_t v = colors[flags].v;
+ if (counter == 2)
+ v *= 2;
+ rgb_matrix_sethsv_noeeprom(colors[flags].h, colors[flags].s, v);
+ } else if (rgb_matrix_get_mode() != RGB_MATRIX_SOLID_REACTIVE_SIMPLE) {
+ rgb_matrix_sethsv_noeeprom(HSV_WHITE);
+ rgb_matrix_mode_noeeprom(RGB_MATRIX_SOLID_REACTIVE_SIMPLE);
+ }
+
+ return false;
+}
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/overrides.c b/qmk/keyboards/sofle_choc/keymaps/custom/overrides.c
index a99582a..baab291 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/overrides.c
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/overrides.c
@@ -29,17 +29,3 @@ const key_override_t w_key_override =
const key_override_t e_key_override =
ko_make_basic(MOD_MASK_CTRL, KEY_E, RCTL(BP_E));
-// This globally defines all key overrides to be used
-const key_override_t **key_overrides = (const key_override_t *[]){
- &perc_key_override,
- &c_key_override,
- &w_key_override,
- &e_key_override,
- &quote_key_override,
- // Override the key GUI + MENU and to map the key desktop from the
- // typematrix
- &(ko_make_basic(MOD_MASK_GUI, KEY_APP, MENU)),
-
-
- NULL
-};
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/overrides.h b/qmk/keyboards/sofle_choc/keymaps/custom/overrides.h
new file mode 100644
index 0000000..c531a12
--- /dev/null
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/overrides.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#include "keymap_bepo.h"
+#include "keycodes.h"
+
+//
+// Override the symbol ° and replace it by `
+// The symbol is still available in the symbol layer with the key just below.
+//
+const key_override_t perc_key_override ;
+
+//
+// I don’t care of the mapping CTRL+Ç and using the mod_tap does not work well
+// when I type too fast because of tap-dance, so I remap the pattern here.
+//
+const key_override_t c_key_override ;
+
+// Same here, I want to be able to type '' without triggering the tapdance.
+// And there is no such key combo for Alt+È.
+const key_override_t quote_key_override ;
+
+// Same here, I override the key W with CTRL because the tapdance activate the
+// caps_word which does not make sense here.
+const key_override_t w_key_override ;
+
+const key_override_t e_key_override ;
+
+// This globally defines all key overrides to be used
+const key_override_t *key_overrides[]= (const key_override_t *[]){
+ &perc_key_override,
+ &c_key_override,
+ &w_key_override,
+ &e_key_override,
+ &quote_key_override,
+ // Override the key GUI + MENU and to map the key desktop from the
+ // typematrix
+ &(ko_make_basic(MOD_MASK_GUI, KEY_APP, MENU)),
+
+
+ NULL
+};
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c
index de54aa7..4a30d75 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.c
@@ -139,13 +139,4 @@ void ql_reset(tap_dance_state_t *state, void *user_data) {
}
//
-// Declare the tapdance table here.
//
-tap_dance_action_t tap_dance_actions[] = {
- [TD_C_CCED] = ACTION_TAP_DANCE_DOUBLE(BP_C, BP_CCED),
- [TD_PRC] = ACTION_TAP_DANCE_DOUBLE(BP_EQL, BP_PERC),
- [TD_W_CAPSLOCK] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, w_finished, w_reset),
- [TD_LAYER_SYMB] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ql_finished, ql_reset),
- [TD_EE] = ACTION_TAP_DANCE_DOUBLE(BP_COMM, BP_EGRV),
-};
-
diff --git a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.h b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.h
index 87da433..92ce430 100644
--- a/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.h
+++ b/qmk/keyboards/sofle_choc/keymaps/custom/quad_tapdance.h
@@ -1,5 +1,8 @@
#pragma once
+#include "keymap_bepo.h"
+#include "keycodes.h"
+
typedef enum {
TD_NONE,
TD_UNKNOWN,
@@ -28,3 +31,4 @@ void ql_reset(tap_dance_state_t *state, void *user_data);
void lshift_finished(tap_dance_state_t *state, void *user_data);
void lshift_reset(tap_dance_state_t *state, void *user_data);
+