From e2ec60a6b67bb30749ef24a52d03a67fe826b377 Mon Sep 17 00:00:00 2001 From: mintyleaf Date: Mon, 22 Jul 2024 18:38:48 +0400 Subject: [PATCH 1/3] add k6 port --- keyboards/keychron/k6/rgb/v2/ansi/ansi.c | 234 ++++++++++++++++++ keyboards/keychron/k6/rgb/v2/ansi/config.h | 17 ++ keyboards/keychron/k6/rgb/v2/ansi/info.json | 233 +++++++++++++++++ .../k6/rgb/v2/ansi/keymaps/default/keymap.c | 91 +++++++ .../k6/rgb/v2/ansi/keymaps/default/keymap.h | 30 +++ .../k6/rgb/v2/ansi/keymaps/via/keymap.c | 91 +++++++ .../k6/rgb/v2/ansi/keymaps/via/keymap.h | 30 +++ .../k6/rgb/v2/ansi/keymaps/via/rules.mk | 1 + keyboards/keychron/k6/rgb/v2/ansi/readme.md | 20 ++ keyboards/keychron/k6/rgb/v2/ansi/rules.mk | 3 + keyboards/keychron/k6/rgb/v2/config.h | 24 ++ keyboards/keychron/k6/rgb/v2/halconf.h | 29 +++ keyboards/keychron/k6/rgb/v2/mcuconf.h | 11 + .../keychron/k6/rgb/v2/via_json/k6_ansi.json | 17 ++ .../keychron/k6/rgb/v2/via_json/k6_iso.json | 17 ++ 15 files changed, 848 insertions(+) create mode 100644 keyboards/keychron/k6/rgb/v2/ansi/ansi.c create mode 100644 keyboards/keychron/k6/rgb/v2/ansi/config.h create mode 100644 keyboards/keychron/k6/rgb/v2/ansi/info.json create mode 100644 keyboards/keychron/k6/rgb/v2/ansi/keymaps/default/keymap.c create mode 100644 keyboards/keychron/k6/rgb/v2/ansi/keymaps/default/keymap.h create mode 100644 keyboards/keychron/k6/rgb/v2/ansi/keymaps/via/keymap.c create mode 100644 keyboards/keychron/k6/rgb/v2/ansi/keymaps/via/keymap.h create mode 100644 keyboards/keychron/k6/rgb/v2/ansi/keymaps/via/rules.mk create mode 100644 keyboards/keychron/k6/rgb/v2/ansi/readme.md create mode 100644 keyboards/keychron/k6/rgb/v2/ansi/rules.mk create mode 100644 keyboards/keychron/k6/rgb/v2/config.h create mode 100644 keyboards/keychron/k6/rgb/v2/halconf.h create mode 100644 keyboards/keychron/k6/rgb/v2/mcuconf.h create mode 100644 keyboards/keychron/k6/rgb/v2/via_json/k6_ansi.json create mode 100644 keyboards/keychron/k6/rgb/v2/via_json/k6_iso.json diff --git a/keyboards/keychron/k6/rgb/v2/ansi/ansi.c b/keyboards/keychron/k6/rgb/v2/ansi/ansi.c new file mode 100644 index 000000000000..87933a08c2b5 --- /dev/null +++ b/keyboards/keychron/k6/rgb/v2/ansi/ansi.c @@ -0,0 +1,234 @@ +/* +Copyright 2024 mintyleaf + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include "quantum.h" +#ifdef BLUETOOTH_ENABLE +# include "iton_bt.h" +# include "outputselect.h" +# include "keymap.h" + +uint32_t last_update_time = 0; + +uint32_t ev_connected = 0; +uint32_t ev_connecting = 0; +uint32_t ev_pairing = 0; +uint32_t ev_disconnected = 0; +uint32_t ev_battery_level = 0; + +uint32_t battery_level = 0; +uint32_t bt_profile = 0; + +bool bluetooth_dip_switch = false; + +void iton_bt_connection_successful() { + set_output(OUTPUT_BLUETOOTH); + ev_connected = 1500; + ev_pairing = 0; + ev_connecting = 0; +} + +void iton_bt_entered_pairing() { + ev_pairing = 1; + ev_connected = 0; + ev_connecting = 0; +} + +void iton_bt_enters_connection_state() { + ev_connecting = 1; + ev_connected = 0; + ev_pairing = 0; +} + +void iton_bt_disconnected() { + set_output(OUTPUT_USB); + ev_disconnected = 1500; + ev_connected = 0; + ev_pairing = 0; + ev_connecting = 0; +} + +void iton_bt_battery_level(uint8_t level) { + battery_level = level; + ev_battery_level = 1500; +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (bluetooth_dip_switch && record->event.pressed) { + switch (keycode) { + case BT_PROFILE1: + iton_bt_switch_profile(0); + bt_profile = 0; + break; + case BT_PROFILE2: + iton_bt_switch_profile(1); + bt_profile = 1; + break; + case BT_PROFILE3: + iton_bt_switch_profile(2); + bt_profile = 2; + break; + case BT_PAIR: + iton_bt_enter_pairing(); + break; + case BT_RESET: + iton_bt_reset_pairing(); + break; + case BT_BATTERY: + iton_bt_query_battery_level(); + break; + default: + break; + } + } + return process_record_user(keycode, record); +} +#endif + +bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + uint8_t layer = get_highest_layer(layer_state); + if (layer != 0 && layer != 2) { + 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 && keymap_key_to_keycode(layer, (keypos_t){col, row}) > KC_TRNS) { + rgb_matrix_set_color(index, RGB_WHITE); + } + } + } + } + +#ifdef BLUETOOTH_ENABLE + if (!bluetooth_dip_switch) { + return false; + } + + uint32_t current_time = timer_read(); // Get the current time in milliseconds + uint32_t elapsed = current_time - last_update_time; // Calculate elapsed time + + // Update the last update time for the next call + last_update_time = current_time; + + if (ev_connected > 0 && elapsed < ev_connected) { + uint8_t profile_index = 16 + bt_profile; + if ((ev_connected / 250) % 2 == 0) { + rgb_matrix_set_color(profile_index, RGB_GREEN); + } else { + rgb_matrix_set_color(profile_index, RGB_OFF); + } + ev_connected -= elapsed; + } + + if (ev_connecting > 0) { + uint8_t profile_index = 16 + bt_profile; + if ((current_time / 125) % 2 == 0) { + rgb_matrix_set_color(profile_index, RGB_YELLOW); + } else { + rgb_matrix_set_color(profile_index, RGB_OFF); + } + } + + if (ev_pairing > 0) { + uint8_t profile_index = 16 + bt_profile; + if ((current_time / 62) % 2 == 0) { + rgb_matrix_set_color(profile_index, RGB_BLUE); + } else { + rgb_matrix_set_color(profile_index, RGB_OFF); + } + } + + if (ev_disconnected > 0 && elapsed < ev_disconnected) { + uint8_t profile_index = 16 + bt_profile; + if ((ev_disconnected / 250) % 2 == 0) { + rgb_matrix_set_color(profile_index, RGB_RED); + } else { + rgb_matrix_set_color(profile_index, RGB_OFF); + } + ev_disconnected -= elapsed; + } + + if (ev_battery_level > 0 && elapsed < ev_battery_level) { + ev_battery_level -= elapsed; + int total_leds = MATRIX_ROWS * MATRIX_COLS; + int leds_per_section = total_leds / 4; + int leds_to_light_up = leds_per_section * battery_level; + + for (int i = 0; i < total_leds; i++) { + if (i < leds_to_light_up && i >= led_min && i < led_max && i != NO_LED) { + if (battery_level == 4) { + rgb_matrix_set_color(i, RGB_GREEN); + } else if (battery_level == 3) { + rgb_matrix_set_color(i, RGB_YELLOW); + } else if (battery_level == 2) { + rgb_matrix_set_color(i, RGB_ORANGE); + } else if (battery_level == 1) { + rgb_matrix_set_color(i, RGB_RED); + } else { + rgb_matrix_set_color(i, RGB_WHITE); + } + } + } + } + + return false; +#endif +} + +bool dip_switch_update_user(uint8_t index, bool active) { + switch (index) { + case 1: + if (active) { + layer_move(MAC_BASE); + } else { + layer_move(WIN_BASE); + } + break; + case 0: + // dip switch inactive in bt state + bluetooth_dip_switch = !active; + break; + } + return true; +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_MISSION_CONTROL: + if (record->event.pressed) { + host_consumer_send(0x29F); + } else { + host_consumer_send(0); + } + return false; + case KC_LAUNCHPAD: + if (record->event.pressed) { + host_consumer_send(0x2A0); + } else { + host_consumer_send(0); + } + return false; + default: + return true; + } +} + +void keyboard_post_init_user(void) { + // Customise these values to desired behaviour + // debug_enable = true; + // debug_matrix = true; + // debug_keyboard = true; + // debug_mouse=true; +} \ No newline at end of file diff --git a/keyboards/keychron/k6/rgb/v2/ansi/config.h b/keyboards/keychron/k6/rgb/v2/ansi/config.h new file mode 100644 index 000000000000..f745ca25e692 --- /dev/null +++ b/keyboards/keychron/k6/rgb/v2/ansi/config.h @@ -0,0 +1,17 @@ +/* Copyright 2023 Santanu Paik (https://github.com/itnerd69) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#define RGB_MATRIX_LED_COUNT 68 diff --git a/keyboards/keychron/k6/rgb/v2/ansi/info.json b/keyboards/keychron/k6/rgb/v2/ansi/info.json new file mode 100644 index 000000000000..d3d41907dcfb --- /dev/null +++ b/keyboards/keychron/k6/rgb/v2/ansi/info.json @@ -0,0 +1,233 @@ +{ + "keyboard_name": "Keychron K6 RGB ANSI", + "manufacturer": "Keychron", + "url": "https://github.com/Keychron", + "maintainer": "mintyleaf", + "usb": { + "pid": "0xFE0A", + "vid": "0x3434", + "device_version": "1.0.0" + }, + "matrix_pins": { + "cols": ["A8", "A9", "A10", "A11", "A12", "A13", "A14", "A15", "B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7"], + "rows": ["D11", "D10", "D9", "D8", "D7"] + }, + "diode_direction": "COL2ROW", + "features": { + "rgb_matrix": true, + "bootmagic": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": false, + "nkro": true, + "dip_switch": true + }, + "processor": "SN32F248BF", + "bootloader": "sn32-dfu", + "debounce": 5, + "indicators": { + "caps_lock": "B9", + "on_state": 1 + }, + "layouts": { + "LAYOUT_ansi": { + "layout": [ + {"matrix":[0, 0], "x":0, "y":0}, + {"matrix":[0, 1], "x":1, "y":0}, + {"matrix":[0, 2], "x":2, "y":0}, + {"matrix":[0, 3], "x":3, "y":0}, + {"matrix":[0, 4], "x":4, "y":0}, + {"matrix":[0, 5], "x":5, "y":0}, + {"matrix":[0, 6], "x":6, "y":0}, + {"matrix":[0, 7], "x":7, "y":0}, + {"matrix":[0, 8], "x":8, "y":0}, + {"matrix":[0, 9], "x":9, "y":0}, + {"matrix":[0, 10], "x":10, "y":0}, + {"matrix":[0, 11], "x":11, "y":0}, + {"matrix":[0, 12], "x":12, "y":0}, + {"matrix":[0, 13], "x":13, "y":0, "w":2}, + {"matrix":[0, 15], "x":15, "y":0}, + + {"matrix":[1, 0], "x":0, "y":1, "w":1.5}, + {"matrix":[1, 1], "x":1.5, "y":1}, + {"matrix":[1, 2], "x":2.5, "y":1}, + {"matrix":[1, 3], "x":3.5, "y":1}, + {"matrix":[1, 4], "x":4.5, "y":1}, + {"matrix":[1, 5], "x":5.5, "y":1}, + {"matrix":[1, 6], "x":6.5, "y":1}, + {"matrix":[1, 7], "x":7.5, "y":1}, + {"matrix":[1, 8], "x":8.5, "y":1}, + {"matrix":[1, 9], "x":9.5, "y":1}, + {"matrix":[1, 10], "x":10.5, "y":1}, + {"matrix":[1, 11], "x":11.5, "y":1}, + {"matrix":[1, 12], "x":12.5, "y":1}, + {"matrix":[1, 13], "x":13.5, "y":1, "w":1.5}, + {"matrix":[1, 15], "x":15, "y":1}, + + {"matrix":[2, 0], "x":0, "y":2, "w":1.75}, + {"matrix":[2, 1], "x":1.75, "y":2}, + {"matrix":[2, 2], "x":2.75, "y":2}, + {"matrix":[2, 3], "x":3.75, "y":2}, + {"matrix":[2, 4], "x":4.75, "y":2}, + {"matrix":[2, 5], "x":5.75, "y":2}, + {"matrix":[2, 6], "x":6.75, "y":2}, + {"matrix":[2, 7], "x":7.75, "y":2}, + {"matrix":[2, 8], "x":8.75, "y":2}, + {"matrix":[2, 9], "x":9.75, "y":2}, + {"matrix":[2, 10], "x":10.75, "y":2}, + {"matrix":[2, 11], "x":11.75, "y":2}, + {"matrix":[2, 13], "x":12.75, "y":2, "w":2.25}, + {"matrix":[2, 15], "x":15, "y":2}, + + {"matrix":[3, 0], "x":0, "y":3, "w":2.25}, + {"matrix":[3, 2], "x":2.25, "y":3}, + {"matrix":[3, 3], "x":3.25, "y":3}, + {"matrix":[3, 4], "x":4.25, "y":3}, + {"matrix":[3, 5], "x":5.25, "y":3}, + {"matrix":[3, 6], "x":6.25, "y":3}, + {"matrix":[3, 7], "x":7.25, "y":3}, + {"matrix":[3, 8], "x":8.25, "y":3}, + {"matrix":[3, 9], "x":9.25, "y":3}, + {"matrix":[3, 10], "x":10.25, "y":3}, + {"matrix":[3, 11], "x":11.25, "y":3}, + {"matrix":[3, 13], "x":12.25, "y":3, "w":1.75}, + {"matrix":[3, 14], "x":14, "y":3}, + {"matrix":[3, 15], "x":15, "y":3}, + + {"matrix":[4, 0], "x":0, "y":4, "w":1.25}, + {"matrix":[4, 1], "x":1.25, "y":4, "w":1.25}, + {"matrix":[4, 2], "x":2.5, "y":4, "w":1.25}, + {"matrix":[4, 6], "x":3.75, "y":4, "w":6.25}, + {"matrix":[4, 10], "x":10, "y":4}, + {"matrix":[4, 11], "x":11, "y":4}, + {"matrix":[4, 12], "x":12, "y":4}, + {"matrix":[4, 13], "x":13, "y":4}, + {"matrix":[4, 14], "x":14, "y":4}, + {"matrix":[4, 15], "x":15, "y":4} + ] + } + }, + "rgb_matrix": { + "driver": "sn32f24xb", + "layout": [ + { "matrix": [ 0, 0 ], "flags": 4, "x": 0, "y": 0 }, + { "matrix": [ 0, 1 ], "flags": 4, "x": 12, "y": 0 }, + { "matrix": [ 0, 2 ], "flags": 4, "x": 25, "y": 0 }, + { "matrix": [ 0, 3 ], "flags": 4, "x": 37, "y": 0 }, + { "matrix": [ 0, 4 ], "flags": 4, "x": 50, "y": 0 }, + { "matrix": [ 0, 5 ], "flags": 4, "x": 62, "y": 0 }, + { "matrix": [ 0, 6 ], "flags": 4, "x": 75, "y": 0 }, + { "matrix": [ 0, 7 ], "flags": 4, "x": 87, "y": 0 }, + { "matrix": [ 0, 8 ], "flags": 4, "x": 100, "y": 0 }, + { "matrix": [ 0, 9 ], "flags": 4, "x": 112, "y": 0 }, + { "matrix": [ 0, 10 ], "flags": 4, "x": 124, "y": 0 }, + { "matrix": [ 0, 11 ], "flags": 4, "x": 137, "y": 0 }, + { "matrix": [ 0, 12 ], "flags": 4, "x": 149, "y": 0 }, + { "matrix": [ 0, 13 ], "flags": 4, "x": 168, "y": 0 }, + { "matrix": [ 0, 15 ], "flags": 4, "x": 187, "y": 0 }, + + { "matrix": [ 1, 0 ], "flags": 4, "x": 3, "y": 13 }, + { "matrix": [ 1, 1 ], "flags": 4, "x": 19, "y": 13 }, + { "matrix": [ 1, 2 ], "flags": 4, "x": 31, "y": 13 }, + { "matrix": [ 1, 3 ], "flags": 4, "x": 44, "y": 13 }, + { "matrix": [ 1, 4 ], "flags": 4, "x": 56, "y": 13 }, + { "matrix": [ 1, 5 ], "flags": 4, "x": 68, "y": 13 }, + { "matrix": [ 1, 6 ], "flags": 4, "x": 81, "y": 13 }, + { "matrix": [ 1, 7 ], "flags": 4, "x": 93, "y": 13 }, + { "matrix": [ 1, 8 ], "flags": 4, "x": 106, "y": 13 }, + { "matrix": [ 1, 9 ], "flags": 4, "x": 118, "y": 13 }, + { "matrix": [ 1, 10 ], "flags": 4, "x": 131, "y": 13 }, + { "matrix": [ 1, 11 ], "flags": 4, "x": 143, "y": 13 }, + { "matrix": [ 1, 12 ], "flags": 4, "x": 156, "y": 13 }, + { "matrix": [ 1, 13 ], "flags": 4, "x": 168, "y": 13 }, + { "matrix": [ 1, 15 ], "flags": 4, "x": 187, "y": 13 }, + + { "matrix": [ 2, 0 ], "flags": 4, "x": 5, "y": 26 }, + { "matrix": [ 2, 1 ], "flags": 4, "x": 22, "y": 26 }, + { "matrix": [ 2, 2 ], "flags": 4, "x": 34, "y": 26 }, + { "matrix": [ 2, 3 ], "flags": 4, "x": 47, "y": 26 }, + { "matrix": [ 2, 4 ], "flags": 4, "x": 59, "y": 26 }, + { "matrix": [ 2, 5 ], "flags": 4, "x": 72, "y": 26 }, + { "matrix": [ 2, 6 ], "flags": 4, "x": 84, "y": 26 }, + { "matrix": [ 2, 7 ], "flags": 4, "x": 96, "y": 26 }, + { "matrix": [ 2, 8 ], "flags": 4, "x": 109, "y": 26 }, + { "matrix": [ 2, 9 ], "flags": 4, "x": 121, "y": 26 }, + { "matrix": [ 2, 10 ], "flags": 4, "x": 134, "y": 26 }, + { "matrix": [ 2, 11 ], "flags": 4, "x": 146, "y": 26 }, + { "matrix": [ 2, 13 ], "flags": 4, "x": 166, "y": 26 }, + { "matrix": [ 2, 15 ], "flags": 4, "x": 187, "y": 26 }, + + { "matrix": [ 3, 0 ], "flags": 4, "x": 8, "y": 38 }, + { "matrix": [ 3, 2 ], "flags": 4, "x": 28, "y": 38 }, + { "matrix": [ 3, 3 ], "flags": 4, "x": 40, "y": 38 }, + { "matrix": [ 3, 4 ], "flags": 4, "x": 53, "y": 38 }, + { "matrix": [ 3, 5 ], "flags": 4, "x": 65, "y": 38 }, + { "matrix": [ 3, 6 ], "flags": 4, "x": 78, "y": 38 }, + { "matrix": [ 3, 7 ], "flags": 4, "x": 90, "y": 38 }, + { "matrix": [ 3, 8 ], "flags": 4, "x": 103, "y": 38 }, + { "matrix": [ 3, 9 ], "flags": 4, "x": 115, "y": 38 }, + { "matrix": [ 3, 10 ], "flags": 4, "x": 128, "y": 38 }, + { "matrix": [ 3, 11 ], "flags": 4, "x": 140, "y": 38 }, + { "matrix": [ 3, 13 ], "flags": 4, "x": 157, "y": 38 }, + { "matrix": [ 3, 14 ], "flags": 4, "x": 174, "y": 38 }, + { "matrix": [ 3, 15 ], "flags": 4, "x": 187, "y": 38 }, + + { "matrix": [ 4, 0 ], "flags": 4, "x": 2, "y": 51 }, + { "matrix": [ 4, 1 ], "flags": 4, "x": 17, "y": 51 }, + { "matrix": [ 4, 2 ], "flags": 4, "x": 33, "y": 51 }, + { "matrix": [ 4, 6 ], "flags": 4, "x": 79, "y": 51 }, + { "matrix": [ 4, 10 ], "flags": 4, "x": 124, "y": 51 }, + { "matrix": [ 4, 11 ], "flags": 4, "x": 137, "y": 51 }, + { "matrix": [ 4, 12 ], "flags": 4, "x": 149, "y": 51 }, + { "matrix": [ 4, 13 ], "flags": 4, "x": 162, "y": 51 }, + { "matrix": [ 4, 14 ], "flags": 4, "x": 174, "y": 51 }, + { "matrix": [ 4, 15 ], "flags": 4, "x": 187, "y": 51 } + ], + "animations": { + "alphas_mods" : true, + "band_pinwheel_sat" : true, + "band_pinwheel_val" : true, + "band_sat" : true, + "band_spiral_sat" : true, + "band_spiral_val" : true, + "band_val" : true, + "breathing" : true, + "cycle_all" : true, + "cycle_left_right" : true, + "cycle_out_in" : true, + "cycle_out_in_dual" : true, + "cycle_pinwheel" : true, + "cycle_spiral" : true, + "cycle_up_down" : true, + "digital_rain" : true, + "dual_beacon" : true, + "gradient_left_right" : true, + "gradient_up_down" : true, + "hue_breathing" : true, + "hue_pendulum" : true, + "hue_wave" : true, + "jellybean_raindrops" : true, + "multisplash" : true, + "pixel_flow" : true, + "pixel_fractal" : true, + "pixel_rain" : true, + "rainbow_beacon" : true, + "rainbow_moving_chevron" : true, + "rainbow_pinwheels" : true, + "raindrops" : true, + "solid_multisplash" : true, + "solid_reactive" : true, + "solid_reactive_cross" : true, + "solid_reactive_multicross" : true, + "solid_reactive_multinexus" : true, + "solid_reactive_multiwide" : true, + "solid_reactive_nexus" : true, + "solid_reactive_simple" : true, + "solid_reactive_wide" : true, + "solid_splash" : true, + "splash" : true, + "typing_heatmap" : true + } + } +} diff --git a/keyboards/keychron/k6/rgb/v2/ansi/keymaps/default/keymap.c b/keyboards/keychron/k6/rgb/v2/ansi/keymaps/default/keymap.c new file mode 100644 index 000000000000..ff1deef98a95 --- /dev/null +++ b/keyboards/keychron/k6/rgb/v2/ansi/keymaps/default/keymap.c @@ -0,0 +1,91 @@ +/* +Copyright 2020 Dimitris Mantzouranis +Copyright 2022 Philip Mourdjis +Copyright 2024 mintyleaf + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include "keymap.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Windows Base + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┬───┐ + * │Esc│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Backsp│MOD│ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤ + * │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │HOM│ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤ + * │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Enter │PGU│ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤ + * │ Shift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ Shift│ ↑ │PGD│ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤ + * │Ctrl│GUI │Alt │ Space │Ctl│Fn1│Fn2│ ← │ ↓ │ → │ + * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘ + */ + [WIN_BASE] = LAYOUT_ansi(KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, RGB_MOD, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BACKSLASH, KC_HOME, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RCTL, MO(WIN_FN1), MO(FN2), KC_LEFT, KC_DOWN, KC_RGHT), + /* Windows FN1 + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┬───┐ + * │`~ │BRU│BRD│TSK│FLX│VAD│VAI│PRV│PLY│NXT│MTE│VLD│VLU│ │TOG│ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤ + * │ │BT1│BT2│BT3│ │ │ │ │ │ │INS│DEL│END│ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤ + * │ │ │ │ │Alt│ │ │ │ │ │ + * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘ + */ + [WIN_FN1] = LAYOUT_ansi(KC_GRV, KC_BRIU, KC_BRID, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG, _______, BT_PROFILE1, BT_PROFILE2, BT_PROFILE3, _______, _______, _______, _______, _______, _______, KC_INS, KC_DEL, KC_END, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RALT, _______, _______, _______, _______, _______), + /* Mac Base + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┬───┐ + * │Esc│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Backsp│MOD│ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤ + * │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │HOM│ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤ + * │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Enter │PGU│ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤ + * │ Shift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ Shift│ ↑ │PGD│ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤ + * │Ctrl│Alt │GUI │ Space │GUI│Fn1│Fn2│ ← │ ↓ │ → │ + * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘ + */ + [MAC_BASE] = LAYOUT_ansi(KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, RGB_MOD, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BACKSLASH, KC_HOME, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN1), MO(FN2), KC_LEFT, KC_DOWN, KC_RGHT), + /* Mac FN1 + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┬───┐ + * │`~ │BRU│BRD│MCT│LPD│VAD│VAI│PRV│PLY│NXT│MTE│VLD│VLU│ │TOG│ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤ + * │ │BT1│BT2│BT3│ │ │ │ │ │ │INS│DEL│END│ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤ + * │ │ │ │ │Alt│ │ │ │ │ │ + * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘ + */ + [MAC_FN1] = LAYOUT_ansi(KC_GRV, KC_BRIU, KC_BRID, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG, _______, BT_PROFILE1, BT_PROFILE2, BT_PROFILE3, _______, _______, _______, _______, _______, _______, KC_INS, KC_DEL, KC_END, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RALT, _______, _______, _______, _______, _______), + /* FN2 + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┬───┐ + * │ ~ │ F1│ F2│ F3│ F4│ F5│ F6│ F7│ F8│ F9│F10│F11│F12│ RESET │MOD│ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤ + * │BTRST│M_P│M_B│M_R│MSW│ │ │ │ │ │ │ │ │ │RMD│ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │SPI│ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤ + * │ │ │ │ │ │BTB│ │ │ │ │ │ │SAI│SPD│ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤ + * │ │ │ │ │ │ │ │HUD│SAD│HUI│ + * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘ + */ + [FN2] = LAYOUT_ansi(KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, QK_BOOT, RGB_MOD, BT_RESET, RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_SW, _______, _______, _______, _______, _______, BT_PAIR, _______, _______, _______, RGB_RMOD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPI, _______, _______, _______, _______, _______, BT_BATTERY, _______, _______, _______, _______, _______, _______, RGB_SAI, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_HUI)}; diff --git a/keyboards/keychron/k6/rgb/v2/ansi/keymaps/default/keymap.h b/keyboards/keychron/k6/rgb/v2/ansi/keymaps/default/keymap.h new file mode 100644 index 000000000000..c29867332917 --- /dev/null +++ b/keyboards/keychron/k6/rgb/v2/ansi/keymaps/default/keymap.h @@ -0,0 +1,30 @@ +/* +Copyright 2024 mintyleaf + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include QMK_KEYBOARD_H +enum BT_keycodes { BT_PROFILE1 = SAFE_RANGE, BT_PROFILE2, BT_PROFILE3, BT_PAIR, BT_TOGGLE, BT_RESET, BT_BATTERY, K6_SAFE_RANGE }; +enum layer_names { + WIN_BASE, + WIN_FN1, + MAC_BASE, + MAC_FN1, + FN2, +}; + +#define KC_TASK LGUI(KC_TAB) // Task viewer +#define KC_FLXP LGUI(KC_E) // Windows file explorer +#define KC_MCTL KC_MISSION_CONTROL // Mission Control +#define KC_LPAD KC_LAUNCHPAD // Launchpad \ No newline at end of file diff --git a/keyboards/keychron/k6/rgb/v2/ansi/keymaps/via/keymap.c b/keyboards/keychron/k6/rgb/v2/ansi/keymaps/via/keymap.c new file mode 100644 index 000000000000..ff1deef98a95 --- /dev/null +++ b/keyboards/keychron/k6/rgb/v2/ansi/keymaps/via/keymap.c @@ -0,0 +1,91 @@ +/* +Copyright 2020 Dimitris Mantzouranis +Copyright 2022 Philip Mourdjis +Copyright 2024 mintyleaf + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include "keymap.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Windows Base + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┬───┐ + * │Esc│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Backsp│MOD│ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤ + * │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │HOM│ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤ + * │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Enter │PGU│ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤ + * │ Shift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ Shift│ ↑ │PGD│ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤ + * │Ctrl│GUI │Alt │ Space │Ctl│Fn1│Fn2│ ← │ ↓ │ → │ + * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘ + */ + [WIN_BASE] = LAYOUT_ansi(KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, RGB_MOD, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BACKSLASH, KC_HOME, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RCTL, MO(WIN_FN1), MO(FN2), KC_LEFT, KC_DOWN, KC_RGHT), + /* Windows FN1 + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┬───┐ + * │`~ │BRU│BRD│TSK│FLX│VAD│VAI│PRV│PLY│NXT│MTE│VLD│VLU│ │TOG│ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤ + * │ │BT1│BT2│BT3│ │ │ │ │ │ │INS│DEL│END│ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤ + * │ │ │ │ │Alt│ │ │ │ │ │ + * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘ + */ + [WIN_FN1] = LAYOUT_ansi(KC_GRV, KC_BRIU, KC_BRID, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG, _______, BT_PROFILE1, BT_PROFILE2, BT_PROFILE3, _______, _______, _______, _______, _______, _______, KC_INS, KC_DEL, KC_END, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RALT, _______, _______, _______, _______, _______), + /* Mac Base + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┬───┐ + * │Esc│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Backsp│MOD│ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤ + * │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │HOM│ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤ + * │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Enter │PGU│ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤ + * │ Shift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ Shift│ ↑ │PGD│ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤ + * │Ctrl│Alt │GUI │ Space │GUI│Fn1│Fn2│ ← │ ↓ │ → │ + * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘ + */ + [MAC_BASE] = LAYOUT_ansi(KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, RGB_MOD, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BACKSLASH, KC_HOME, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FN1), MO(FN2), KC_LEFT, KC_DOWN, KC_RGHT), + /* Mac FN1 + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┬───┐ + * │`~ │BRU│BRD│MCT│LPD│VAD│VAI│PRV│PLY│NXT│MTE│VLD│VLU│ │TOG│ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤ + * │ │BT1│BT2│BT3│ │ │ │ │ │ │INS│DEL│END│ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤ + * │ │ │ │ │Alt│ │ │ │ │ │ + * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘ + */ + [MAC_FN1] = LAYOUT_ansi(KC_GRV, KC_BRIU, KC_BRID, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG, _______, BT_PROFILE1, BT_PROFILE2, BT_PROFILE3, _______, _______, _______, _______, _______, _______, KC_INS, KC_DEL, KC_END, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RALT, _______, _______, _______, _______, _______), + /* FN2 + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┬───┐ + * │ ~ │ F1│ F2│ F3│ F4│ F5│ F6│ F7│ F8│ F9│F10│F11│F12│ RESET │MOD│ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┼───┤ + * │BTRST│M_P│M_B│M_R│MSW│ │ │ │ │ │ │ │ │ │RMD│ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┼───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │SPI│ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┼───┤ + * │ │ │ │ │ │BTB│ │ │ │ │ │ │SAI│SPD│ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴──┬┴──┬┴──┬───┼───┼───┤ + * │ │ │ │ │ │ │ │HUD│SAD│HUI│ + * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┴───┘ + */ + [FN2] = LAYOUT_ansi(KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, QK_BOOT, RGB_MOD, BT_RESET, RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_SW, _______, _______, _______, _______, _______, BT_PAIR, _______, _______, _______, RGB_RMOD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SPI, _______, _______, _______, _______, _______, BT_BATTERY, _______, _______, _______, _______, _______, _______, RGB_SAI, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_HUI)}; diff --git a/keyboards/keychron/k6/rgb/v2/ansi/keymaps/via/keymap.h b/keyboards/keychron/k6/rgb/v2/ansi/keymaps/via/keymap.h new file mode 100644 index 000000000000..c29867332917 --- /dev/null +++ b/keyboards/keychron/k6/rgb/v2/ansi/keymaps/via/keymap.h @@ -0,0 +1,30 @@ +/* +Copyright 2024 mintyleaf + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include QMK_KEYBOARD_H +enum BT_keycodes { BT_PROFILE1 = SAFE_RANGE, BT_PROFILE2, BT_PROFILE3, BT_PAIR, BT_TOGGLE, BT_RESET, BT_BATTERY, K6_SAFE_RANGE }; +enum layer_names { + WIN_BASE, + WIN_FN1, + MAC_BASE, + MAC_FN1, + FN2, +}; + +#define KC_TASK LGUI(KC_TAB) // Task viewer +#define KC_FLXP LGUI(KC_E) // Windows file explorer +#define KC_MCTL KC_MISSION_CONTROL // Mission Control +#define KC_LPAD KC_LAUNCHPAD // Launchpad \ No newline at end of file diff --git a/keyboards/keychron/k6/rgb/v2/ansi/keymaps/via/rules.mk b/keyboards/keychron/k6/rgb/v2/ansi/keymaps/via/rules.mk new file mode 100644 index 000000000000..036bd6d1c3ec --- /dev/null +++ b/keyboards/keychron/k6/rgb/v2/ansi/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes \ No newline at end of file diff --git a/keyboards/keychron/k6/rgb/v2/ansi/readme.md b/keyboards/keychron/k6/rgb/v2/ansi/readme.md new file mode 100644 index 000000000000..1eb6fe8e23f2 --- /dev/null +++ b/keyboards/keychron/k6/rgb/v2/ansi/readme.md @@ -0,0 +1,20 @@ +# Keychron K6 RGB ANSI + + +*A 65% keyboard sold by keychron* + +* K2 Keyboard Maintainer: [KeijoMika](https://github.com/KeijoMika) (based on work of dexter93 on a previous branch) +* Ported to K6 by [mintyleaf](https://github.com/mintyleaf) + +Layout by: +[ANSI] [rus] (https://github.com/stdvar) + +Based on Redragon K566 by: [Adam Honse](https://github.com/CalcProgrammer1), Kemove DK63 by: [Stephen Peery](https://github.com/smp4488) and Keychron K4 by: [Dimitris Mantzouranis](https://github.com/dexter93) +Hardware Supported: SN32F248BF + +Make example for this keyboard (after setting up your build environment): + + make keychron/k6/rgb/v2/ansi:ansi + make keychron/k6/rgb/v2/ansi:via + +* * * \ No newline at end of file diff --git a/keyboards/keychron/k6/rgb/v2/ansi/rules.mk b/keyboards/keychron/k6/rgb/v2/ansi/rules.mk new file mode 100644 index 000000000000..b71fb9f3255a --- /dev/null +++ b/keyboards/keychron/k6/rgb/v2/ansi/rules.mk @@ -0,0 +1,3 @@ +BLUETOOTH_ENABLE = yes +BLUETOOTH_DRIVER = ItonBT +BLUETOOTH_ITON_BT = yes \ No newline at end of file diff --git a/keyboards/keychron/k6/rgb/v2/config.h b/keyboards/keychron/k6/rgb/v2/config.h new file mode 100644 index 000000000000..ef142df387ab --- /dev/null +++ b/keyboards/keychron/k6/rgb/v2/config.h @@ -0,0 +1,24 @@ +/* Copyright 2022 Philip Mourdjis + * Copyright 2023 KeijoMika (https://github.com/KeijoMika) + * Copyright 2023 Santanu Paik (https://github.com/ITNerd69) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once +#define SN32_RGB_MATRIX_ROW_PINS {C6, C5, C4, C9, C8, C7, C12, C11, C10, B13, C14, C13, B14, B15, D3} +#define DIP_SWITCH_PINS {D5, D4} +#define DYNAMIC_KEYMAP_LAYER_COUNT 5 +#define VIA_QMK_RGBLIGHT_ENABLE +#define ITON_BT_ENABLE_ACK \ No newline at end of file diff --git a/keyboards/keychron/k6/rgb/v2/halconf.h b/keyboards/keychron/k6/rgb/v2/halconf.h new file mode 100644 index 000000000000..b6564c6d5fd9 --- /dev/null +++ b/keyboards/keychron/k6/rgb/v2/halconf.h @@ -0,0 +1,29 @@ +// Copyright 2021 1Conan (@1Conan) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#ifdef BLUETOOTH_ITON_BT +/* + * GPIO and SPI IRQs needs to be set to 0 to avoid erratic behavior + */ + +/** + * PAL driver settings + */ +# define PAL_USE_CALLBACKS TRUE +# define SN32_GPIOA_IRQ_PRIORITY 0 + +/** + * SPI driver settings + */ +# define HAL_USE_SPI TRUE +# define SPI_USE_MUTUAL_EXCLUSION FALSE +# define SPI_USE_WAIT FALSE +# define SPI_USE_ASSERT_ON_ERROR FALSE +# define SPI_SELECT_MODE SPI_SELECT_MODE_NONE + +# define SN32_SPI_SPI0_IRQ_PRIORITY 0 +#endif + +#include_next \ No newline at end of file diff --git a/keyboards/keychron/k6/rgb/v2/mcuconf.h b/keyboards/keychron/k6/rgb/v2/mcuconf.h new file mode 100644 index 000000000000..f1c0fc347ee0 --- /dev/null +++ b/keyboards/keychron/k6/rgb/v2/mcuconf.h @@ -0,0 +1,11 @@ +// Copyright 2021 1Conan (@1Conan) +// SPDX-License-Identifier: GPL-2.0-or-later + +/** + * SPI driver settings + */ +#ifdef BLUETOOTH_ITON_BT +# define SN32_SPI_USE_SPI0 TRUE +#endif + +#include_next \ No newline at end of file diff --git a/keyboards/keychron/k6/rgb/v2/via_json/k6_ansi.json b/keyboards/keychron/k6/rgb/v2/via_json/k6_ansi.json new file mode 100644 index 000000000000..a2bdbd4a90ae --- /dev/null +++ b/keyboards/keychron/k6/rgb/v2/via_json/k6_ansi.json @@ -0,0 +1,17 @@ +{ + "name": "Keychron K6 ANSI", + "vendorId": "0x3434", + "productId": "0xFE0A", + "matrix": {"rows": 5, "cols": 16}, + "keycodes": ["qmk_lighting"], + "layouts": { + "keymap": [ + ["0,0", "0,1", "0,2", "0,3", "0,4", "0,5", "0,6", "0,7", "0,8", "0,9", "0,10", "0,11", "0,12", {"w":2}, "0,13", "0,15"], + [{"w":1.5}, "1,0", "1,1", "1,2", "1,3", "1,4", "1,5", "1,6", "1,7", "1,8", "1,9", "1,10", "1,11", "1,12", {"w":1.5}, "1,13", "1,15"], + [{"w":1.75}, "2,0", "2,1", "2,2", "2,3", "2,4", "2,5", "2,6", "2,7", "2,8", "2,9", "2,10", "2,11", {"w":2.25}, "2,13", "2,15"], + [{"w":2.25}, "3,0", "3,2", "3,3", "3,4", "3,5", "3,6", "3,7", "3,8", "3,9", "3,10", "3,11", {"w":1.75}, "3,13", "3,14", "3,15"], + [{"w":1.25}, "4,0", {"w":1.25}, "4,1", {"w":1.25}, "4,2", {"w":6.25}, "4,6", "4,10", "4,11", "4,12", "4,13", "4,14", "4,15"] + ] + }, + "menus": [ "qmk_rgb_matrix"] +} diff --git a/keyboards/keychron/k6/rgb/v2/via_json/k6_iso.json b/keyboards/keychron/k6/rgb/v2/via_json/k6_iso.json new file mode 100644 index 000000000000..c31dbdc5c496 --- /dev/null +++ b/keyboards/keychron/k6/rgb/v2/via_json/k6_iso.json @@ -0,0 +1,17 @@ +{ + "name": "Keychron K6 ISO", + "vendorId": "0x3434", + "productId": "0xFE0B", + "matrix": {"rows": 5, "cols": 16}, + "keycodes": ["qmk_lighting"], + "layouts": { + "keymap": [ + ["0,0", "0,1", "0,2", "0,3", "0,4", "0,5", "0,6", "0,7", "0,8", "0,9", "0,10", "0,11", "0,12", {"w":2}, "0,13", "0,15"], + [{"w":1.5}, "1,0", "1,1", "1,2", "1,3", "1,4", "1,5", "1,6", "1,7", "1,8", "1,9", "1,10", "1,11", "1,12", {"x":0.25,"w":1.25,"h":2,"w2":1.5,"h2":1,"x2":-0.25}, "2,13", "1,15"], + [{"w":1.75}, "2,0", "2,1", "2,2", "2,3", "2,4", "2,5", "2,6", "2,7", "2,8", "2,9", "2,10", "2,11", "2,12", {"x": 1.25 }, "2,15"], + [{"w":1.25}, "3,0", "3,1", "3,2", "3,3", "3,4", "3,5", "3,6", "3,7", "3,8", "3,9", "3,10", "3,11", {"w":1.75}, "3,13", "3,14", "3,15"], + [{"w":1.25}, "4,0", {"w":1.25}, "4,1", {"w":1.25}, "4,2", {"w":6.25}, "4,6", "4,10", "4,11", "4,12", "4,13", "4,14", "4,15"] + ] + }, + "menus": [ "qmk_rgb_matrix"] +} From 125ad917699f1bb39c2350dd7bc4a15bcac795da Mon Sep 17 00:00:00 2001 From: mintyleaf Date: Mon, 22 Jul 2024 18:43:22 +0400 Subject: [PATCH 2/3] non-bluetooth build by default --- keyboards/keychron/k6/rgb/v2/ansi/ansi.c | 6 ++++-- keyboards/keychron/k6/rgb/v2/ansi/rules.mk | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/keyboards/keychron/k6/rgb/v2/ansi/ansi.c b/keyboards/keychron/k6/rgb/v2/ansi/ansi.c index 87933a08c2b5..7a0b6b23f7e1 100644 --- a/keyboards/keychron/k6/rgb/v2/ansi/ansi.c +++ b/keyboards/keychron/k6/rgb/v2/ansi/ansi.c @@ -15,10 +15,10 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "quantum.h" +#include "keymap.h" #ifdef BLUETOOTH_ENABLE # include "iton_bt.h" # include "outputselect.h" -# include "keymap.h" uint32_t last_update_time = 0; @@ -183,8 +183,8 @@ bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { } } - return false; #endif + return false; } bool dip_switch_update_user(uint8_t index, bool active) { @@ -196,10 +196,12 @@ bool dip_switch_update_user(uint8_t index, bool active) { layer_move(WIN_BASE); } break; +#ifdef BLUETOOTH_ENABLE case 0: // dip switch inactive in bt state bluetooth_dip_switch = !active; break; +#endif } return true; } diff --git a/keyboards/keychron/k6/rgb/v2/ansi/rules.mk b/keyboards/keychron/k6/rgb/v2/ansi/rules.mk index b71fb9f3255a..92216cd26f94 100644 --- a/keyboards/keychron/k6/rgb/v2/ansi/rules.mk +++ b/keyboards/keychron/k6/rgb/v2/ansi/rules.mk @@ -1,3 +1,3 @@ -BLUETOOTH_ENABLE = yes -BLUETOOTH_DRIVER = ItonBT -BLUETOOTH_ITON_BT = yes \ No newline at end of file +# BLUETOOTH_ENABLE = yes +# BLUETOOTH_DRIVER = ItonBT +# BLUETOOTH_ITON_BT = yes \ No newline at end of file From 097bff89966f0c9a22e13ecd7b8c03b08501fb68 Mon Sep 17 00:00:00 2001 From: mintyleaf Date: Mon, 22 Jul 2024 18:46:08 +0400 Subject: [PATCH 3/3] fix driver name --- keyboards/keychron/k6/rgb/v2/ansi/rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/keychron/k6/rgb/v2/ansi/rules.mk b/keyboards/keychron/k6/rgb/v2/ansi/rules.mk index 92216cd26f94..8278a6c3c8ba 100644 --- a/keyboards/keychron/k6/rgb/v2/ansi/rules.mk +++ b/keyboards/keychron/k6/rgb/v2/ansi/rules.mk @@ -1,3 +1,3 @@ # BLUETOOTH_ENABLE = yes -# BLUETOOTH_DRIVER = ItonBT +# BLUETOOTH_DRIVER = iton_bt # BLUETOOTH_ITON_BT = yes \ No newline at end of file