summaryrefslogtreecommitdiffstats
path: root/keyboards
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/keychron/bluetooth/bluetooth.c10
-rwxr-xr-xkeyboards/keychron/common/common.mk4
-rwxr-xr-xkeyboards/keychron/common/matrix.c218
-rw-r--r--keyboards/keychron/k10_pro/ansi/rgb/config.h3
-rw-r--r--keyboards/keychron/k10_pro/ansi/rgb/info.json119
-rw-r--r--keyboards/keychron/k10_pro/ansi/rgb/keymaps/default/keymap.c13
-rw-r--r--keyboards/keychron/k10_pro/ansi/rgb/keymaps/via/keymap.c14
-rw-r--r--keyboards/keychron/k10_pro/ansi/white/config.h2
-rw-r--r--keyboards/keychron/k10_pro/ansi/white/info.json117
-rw-r--r--keyboards/keychron/k10_pro/ansi/white/keymaps/default/keymap.c4
-rw-r--r--keyboards/keychron/k10_pro/ansi/white/keymaps/via/keymap.c14
-rw-r--r--keyboards/keychron/k10_pro/ansi/white/white.c29
-rw-r--r--keyboards/keychron/k10_pro/config.h7
-rw-r--r--keyboards/keychron/k10_pro/info.json125
-rw-r--r--keyboards/keychron/k10_pro/iso/rgb/config.h3
-rw-r--r--keyboards/keychron/k10_pro/iso/rgb/info.json119
-rw-r--r--keyboards/keychron/k10_pro/iso/rgb/keymaps/via/keymap.c6
-rw-r--r--keyboards/keychron/k10_pro/iso/rgb/rgb.c32
-rw-r--r--keyboards/keychron/k10_pro/iso/white/config.h5
-rw-r--r--keyboards/keychron/k10_pro/iso/white/info.json118
-rw-r--r--keyboards/keychron/k10_pro/iso/white/keymaps/default/keymap.c14
-rw-r--r--keyboards/keychron/k10_pro/iso/white/keymaps/via/keymap.c16
-rw-r--r--keyboards/keychron/k10_pro/iso/white/white.c32
-rwxr-xr-xkeyboards/keychron/k10_pro/jis/rgb/config.h53
-rwxr-xr-xkeyboards/keychron/k10_pro/jis/rgb/info.json154
-rwxr-xr-xkeyboards/keychron/k10_pro/jis/rgb/keymaps/default/keymap.c59
-rwxr-xr-xkeyboards/keychron/k10_pro/jis/rgb/keymaps/via/keymap.c59
-rwxr-xr-xkeyboards/keychron/k10_pro/jis/rgb/keymaps/via/rules.mk1
-rwxr-xr-xkeyboards/keychron/k10_pro/jis/rgb/rgb.c146
-rwxr-xr-xkeyboards/keychron/k10_pro/jis/rgb/rules.mk1
-rwxr-xr-xkeyboards/keychron/k10_pro/jis/white/config.h52
-rwxr-xr-xkeyboards/keychron/k10_pro/jis/white/info.json149
-rwxr-xr-xkeyboards/keychron/k10_pro/jis/white/keymaps/default/keymap.c59
-rwxr-xr-xkeyboards/keychron/k10_pro/jis/white/keymaps/via/keymap.c59
-rwxr-xr-xkeyboards/keychron/k10_pro/jis/white/keymaps/via/rules.mk1
-rwxr-xr-xkeyboards/keychron/k10_pro/jis/white/rules.mk1
-rwxr-xr-xkeyboards/keychron/k10_pro/jis/white/white.c144
-rw-r--r--keyboards/keychron/k10_pro/k10_pro.c45
-rw-r--r--keyboards/keychron/k10_pro/k10_pro.h4
-rw-r--r--keyboards/keychron/k10_pro/matrix.c170
-rw-r--r--keyboards/keychron/k10_pro/readme.md10
-rw-r--r--keyboards/keychron/k10_pro/rules.mk5
-rw-r--r--keyboards/keychron/k10_pro/via_json/k10_pro_ansi_rgb.json4
-rw-r--r--keyboards/keychron/k10_pro/via_json/k10_pro_ansi_white.json4
-rwxr-xr-xkeyboards/keychron/k10_pro/via_json/k10_pro_iso_rgb.json350
-rwxr-xr-xkeyboards/keychron/k10_pro/via_json/k10_pro_iso_white.json289
-rwxr-xr-xkeyboards/keychron/k10_pro/via_json/k10_pro_jis_rgb.json351
-rwxr-xr-xkeyboards/keychron/k10_pro/via_json/k10_pro_jis_white.json290
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/rgb/config.h56
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/rgb/info.json131
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/rgb/keymaps/default/keymap.c68
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/rgb/keymaps/default/rules.mk1
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/rgb/keymaps/via/keymap.c68
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/rgb/keymaps/via/rules.mk2
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/rgb/rgb.c123
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/rgb/rules.mk1
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/white/config.h51
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/white/info.json126
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/white/keymaps/default/keymap.c68
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/white/keymaps/default/rules.mk1
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/white/keymaps/via/keymap.c68
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/white/keymaps/via/rules.mk2
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/white/rules.mk1
-rwxr-xr-xkeyboards/keychron/k15_pro/ansi_encoder/white/white.c121
-rwxr-xr-xkeyboards/keychron/k15_pro/config.h86
-rwxr-xr-xkeyboards/keychron/k15_pro/halconf.h29
-rwxr-xr-xkeyboards/keychron/k15_pro/info.json140
-rwxr-xr-xkeyboards/keychron/k15_pro/k15_pro.c342
-rwxr-xr-xkeyboards/keychron/k15_pro/k15_pro.h57
-rwxr-xr-xkeyboards/keychron/k15_pro/mcuconf.h39
-rwxr-xr-xkeyboards/keychron/k15_pro/readme.md23
-rwxr-xr-xkeyboards/keychron/k15_pro/rules.mk6
-rwxr-xr-xkeyboards/keychron/k15_pro/via_json/k15_pro_ansi_encoder_rgb.json396
-rwxr-xr-xkeyboards/keychron/k15_pro/via_json/k15_pro_ansi_encoder_white.json335
74 files changed, 5491 insertions, 334 deletions
diff --git a/keyboards/keychron/bluetooth/bluetooth.c b/keyboards/keychron/bluetooth/bluetooth.c
index 481099af67..e87b435db4 100644
--- a/keyboards/keychron/bluetooth/bluetooth.c
+++ b/keyboards/keychron/bluetooth/bluetooth.c
@@ -291,6 +291,14 @@ uint8_t bluetooth_keyboard_leds(void) {
extern keymap_config_t keymap_config;
void bluetooth_send_keyboard(report_keyboard_t *report) {
+ if (battery_is_critical_low()) {
+ report_keyboard_t empty_report;
+ memset(&empty_report, 0, sizeof(empty_report));
+ if (memcmp(keyboard_report, &empty_report, sizeof(report_keyboard_t)) != 0) {
+ return;
+ }
+ }
+
if (bt_state == BLUETOOTH_PARING && !pincodeEntry) return;
if (bt_state == BLUETOOTH_CONNECTED || (bt_state == BLUETOOTH_PARING && pincodeEntry)) {
@@ -395,7 +403,7 @@ void bluetooth_low_battery_shutdown(void) {
indicator_battery_low_backlit_enable(false);
#endif
clear_keyboard();
- send_keyboard_report();
+ wait_ms(50);
bluetooth_disconnect();
}
diff --git a/keyboards/keychron/common/common.mk b/keyboards/keychron/common/common.mk
new file mode 100755
index 0000000000..d7610bce69
--- /dev/null
+++ b/keyboards/keychron/common/common.mk
@@ -0,0 +1,4 @@
+COMMON_DIR = common
+SRC += $(COMMON_DIR)/matrix.c
+
+VPATH += $(TOP_DIR)/keyboards/keychron/$(COMMON_DIR)
diff --git a/keyboards/keychron/common/matrix.c b/keyboards/keychron/common/matrix.c
new file mode 100755
index 0000000000..8fe7588118
--- /dev/null
+++ b/keyboards/keychron/common/matrix.c
@@ -0,0 +1,218 @@
+/* Copyright 2023 @ Keychron (https://www.keychron.com)
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include "quantum.h"
+
+#ifndef HC595_STCP
+# define HC595_STCP B0
+#endif
+#ifndef HC595_SHCP
+# define HC595_SHCP A1
+#endif
+#ifndef HC595_DS
+# define HC595_DS A7
+#endif
+
+#ifndef HC595_START_INDEX
+# define HC595_START_INDEX 0
+#endif
+#ifndef HC595_END_INDEX
+# define HC595_END_INDEX 15
+#endif
+#ifndef HC595_OFFSET_INDEX
+# define HC595_OFFSET_INDEX 0
+#endif
+
+#if defined(HC595_START_INDEX) && defined(HC595_END_INDEX)
+# if ((HC595_END_INDEX - HC595_START_INDEX + 1) > 16)
+# define SIZE_T uint32_t
+# define UNSELECT_ALL_COL 0xFFFFFFFF
+# define SELECT_ALL_COL 0x00000000
+# elif ((HC595_END_INDEX - HC595_START_INDEX + 1) > 8)
+# define SIZE_T uint16_t
+# define UNSELECT_ALL_COL 0xFFFF
+# define SELECT_ALL_COL 0x0000
+# else
+# define SIZE_T uint8_t
+# define UNSELECT_ALL_COL 0xFF
+# define SELECT_ALL_COL 0x00
+# endif
+#endif
+
+pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
+pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
+
+static inline uint8_t readMatrixPin(pin_t pin) {
+ if (pin != NO_PIN) {
+ return readPin(pin);
+ } else {
+ return 1;
+ }
+}
+
+static inline void setPinOutput_writeLow(pin_t pin) {
+ setPinOutput(pin);
+ writePinLow(pin);
+}
+
+static inline void setPinOutput_writeHigh(pin_t pin) {
+ setPinOutput(pin);
+ writePinHigh(pin);
+}
+
+static inline void HC595_delay(uint16_t n) {
+ while (n-- > 0) {
+ asm volatile("nop" ::: "memory");
+ }
+}
+
+static void HC595_output(SIZE_T data, bool bit_flag) {
+ uint8_t n = 1;
+
+ ATOMIC_BLOCK_FORCEON {
+ for (uint8_t i = 0; i < (HC595_END_INDEX - HC595_START_INDEX + 1); i++) {
+ if (data & 0x1) {
+ writePinHigh(HC595_DS);
+ } else {
+ writePinLow(HC595_DS);
+ }
+ writePinHigh(HC595_SHCP);
+ HC595_delay(n);
+ writePinLow(HC595_SHCP);
+ HC595_delay(n);
+ if (bit_flag) {
+ break;
+ } else {
+ data = data >> 1;
+ }
+ }
+ writePinHigh(HC595_STCP);
+ HC595_delay(n);
+ writePinLow(HC595_STCP);
+ HC595_delay(n);
+ }
+}
+
+static void select_col(uint8_t col) {
+ if (col < HC595_START_INDEX || col > HC595_END_INDEX) {
+ setPinOutput_writeLow(col_pins[col]);
+ } else {
+ if (col == HC595_START_INDEX) {
+ HC595_output(0x00, true);
+ if (col < HC595_OFFSET_INDEX) {
+ HC595_output(0x01, true);
+ }
+ }
+ }
+}
+
+static void unselect_col(uint8_t col) {
+ if (col < HC595_START_INDEX || col > HC595_END_INDEX) {
+#ifdef MATRIX_UNSELECT_DRIVE_HIGH
+ setPinOutput_writeHigh(col_pins[col]);
+#else
+ setPinInputHigh(col_pins[col]);
+#endif
+ } else {
+ HC595_output(0x01, true);
+ }
+}
+
+static void unselect_cols(void) {
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) {
+ if (col < HC595_START_INDEX || col > HC595_END_INDEX) {
+#ifdef MATRIX_UNSELECT_DRIVE_HIGH
+ setPinOutput_writeHigh(col_pins[col]);
+#else
+ setPinInputHigh(col_pins[col]);
+#endif
+ } else {
+ if (col == HC595_START_INDEX) {
+ HC595_output(UNSELECT_ALL_COL, false);
+ }
+ break;
+ }
+ }
+}
+
+void select_all_cols(void) {
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) {
+ if (col < HC595_START_INDEX || col > HC595_END_INDEX) {
+ setPinOutput_writeLow(col_pins[col]);
+ } else {
+ if (col == HC595_START_INDEX) {
+ HC595_output(SELECT_ALL_COL, false);
+ }
+ break;
+ }
+ }
+}
+
+static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter) {
+ // Select col
+ select_col(current_col); // select col
+ HC595_delay(200);
+
+ // For each row...
+ for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {
+ // Check row pin state
+ if (readMatrixPin(row_pins[row_index]) == 0) {
+ // Pin LO, set col bit
+ current_matrix[row_index] |= row_shifter;
+ } else {
+ // Pin HI, clear col bit
+ current_matrix[row_index] &= ~row_shifter;
+ }
+ }
+
+ // Unselect col
+ unselect_col(current_col);
+ HC595_delay(200); // wait for all Row signals to go HIGH
+}
+
+void matrix_init_custom(void) {
+ setPinOutput(HC595_DS);
+ setPinOutput(HC595_STCP);
+ setPinOutput(HC595_SHCP);
+
+ for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
+ if (row_pins[x] != NO_PIN) {
+ setPinInputHigh(row_pins[x]);
+ }
+ }
+
+ unselect_cols();
+}
+
+bool matrix_scan_custom(matrix_row_t current_matrix[]) {
+ matrix_row_t curr_matrix[MATRIX_ROWS] = {0};
+
+ // Set col, read rows
+ matrix_row_t row_shifter = MATRIX_ROW_SHIFTER;
+ for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++, row_shifter <<= 1) {
+ matrix_read_rows_on_col(curr_matrix, current_col, row_shifter);
+ }
+
+ bool changed = memcmp(current_matrix, curr_matrix, sizeof(curr_matrix)) != 0;
+ if (changed) memcpy(current_matrix, curr_matrix, sizeof(curr_matrix));
+
+ return changed;
+}
+
+void suspend_wakeup_init_kb(void) {
+ // code will run on keyboard wakeup
+ clear_keyboard();
+}
diff --git a/keyboards/keychron/k10_pro/ansi/rgb/config.h b/keyboards/keychron/k10_pro/ansi/rgb/config.h
index 703644657a..90cfcccf96 100644
--- a/keyboards/keychron/k10_pro/ansi/rgb/config.h
+++ b/keyboards/keychron/k10_pro/ansi/rgb/config.h
@@ -19,9 +19,10 @@
#ifdef RGB_MATRIX_ENABLE
/* RGB Matrix driver configuration */
# define DRIVER_COUNT 2
-
# define DRIVER_ADDR_1 0b1110111
# define DRIVER_ADDR_2 0b1110100
+
+/* RGB Matrix configuration */
# define RGB_MATRIX_LED_COUNT 108
/* Set to infinit, which is use in USB mode by default */
diff --git a/keyboards/keychron/k10_pro/ansi/rgb/info.json b/keyboards/keychron/k10_pro/ansi/rgb/info.json
index ad52f9670c..3923a9ce58 100644
--- a/keyboards/keychron/k10_pro/ansi/rgb/info.json
+++ b/keyboards/keychron/k10_pro/ansi/rgb/info.json
@@ -30,6 +30,121 @@
"solid_reactive_multinexus": true,
"splash": true,
"solid_splash": true
- }
+ },
+ "layout": [
+ {"matrix":[0,0], "flags":1, "x":0, "y":0},
+ {"matrix":[0,1], "flags":1, "x":20, "y":0},
+ {"matrix":[0,2], "flags":1, "x":31, "y":0},
+ {"matrix":[0,3], "flags":1, "x":42, "y":0},
+ {"matrix":[0,4], "flags":1, "x":52, "y":0},
+ {"matrix":[0,5], "flags":1, "x":67, "y":0},
+ {"matrix":[0,6], "flags":1, "x":78, "y":0},
+ {"matrix":[0,7], "flags":1, "x":88, "y":0},
+ {"matrix":[0,8], "flags":1, "x":98, "y":0},
+ {"matrix":[0,9], "flags":1, "x":114, "y":0},
+ {"matrix":[0,10], "flags":1, "x":125, "y":0},
+ {"matrix":[0,11], "flags":1, "x":135, "y":0},
+ {"matrix":[0,12], "flags":1, "x":145, "y":0},
+ {"matrix":[0,14], "flags":1, "x":158, "y":0},
+ {"matrix":[0,15], "flags":1, "x":169, "y":0},
+ {"matrix":[0,16], "flags":1, "x":179, "y":0},
+ {"matrix":[0,17], "flags":4, "x":192, "y":0},
+ {"matrix":[0,18], "flags":4, "x":203, "y":0},
+ {"matrix":[0,19], "flags":4, "x":213, "y":0},
+ {"matrix":[0,20], "flags":4, "x":224, "y":0},
+
+ {"matrix":[1,0], "flags":1, "x":0, "y":15},
+ {"matrix":[1,1], "flags":8, "x":10, "y":15},
+ {"matrix":[1,2], "flags":8, "x":20, "y":15},
+ {"matrix":[1,3], "flags":8, "x":31, "y":15},
+ {"matrix":[1,4], "flags":4, "x":41, "y":15},
+ {"matrix":[1,5], "flags":4, "x":52, "y":15},
+ {"matrix":[1,6], "flags":4, "x":62, "y":15},
+ {"matrix":[1,7], "flags":4, "x":72, "y":15},
+ {"matrix":[1,8], "flags":4, "x":83, "y":15},
+ {"matrix":[1,9], "flags":4, "x":93, "y":15},
+ {"matrix":[1,10], "flags":4, "x":104, "y":15},
+ {"matrix":[1,11], "flags":4, "x":114, "y":15},
+ {"matrix":[1,12], "flags":4, "x":124, "y":15},
+ {"matrix":[1,13], "flags":1, "x":140, "y":15},
+ {"matrix":[1,14], "flags":1, "x":158, "y":15},
+ {"matrix":[1,15], "flags":1, "x":169, "y":15},
+ {"matrix":[1,16], "flags":1, "x":180, "y":15},
+ {"matrix":[1,17], "flags":8, "x":192, "y":15},
+ {"matrix":[1,18], "flags":4, "x":203, "y":15},
+ {"matrix":[1,19], "flags":4, "x":213, "y":15},
+ {"matrix":[1,20], "flags":4, "x":224, "y":15},
+
+ {"matrix":[2,0], "flags":1, "x":2, "y":28},
+ {"matrix":[2,1], "flags":4, "x":15, "y":28},
+ {"matrix":[2,2], "flags":4, "x":26, "y":28},
+ {"matrix":[2,3], "flags":4, "x":36, "y":28},
+ {"matrix":[2,4], "flags":4, "x":46, "y":28},
+ {"matrix":[2,5], "flags":4, "x":57, "y":28},
+ {"matrix":[2,6], "flags":4, "x":67, "y":28},
+ {"matrix":[2,7], "flags":4, "x":78, "y":28},
+ {"matrix":[2,8], "flags":4, "x":88, "y":28},
+ {"matrix":[2,9], "flags":4, "x":98, "y":28},
+ {"matrix":[2,10], "flags":4, "x":109, "y":28},
+ {"matrix":[2,11], "flags":4, "x":119, "y":28},
+ {"matrix":[2,12], "flags":4, "x":130, "y":28},
+ {"matrix":[2,13], "flags":1, "x":143, "y":28},
+ {"matrix":[2,14], "flags":1, "x":158, "y":28},
+ {"matrix":[2,15], "flags":1, "x":169, "y":28},
+ {"matrix":[2,16], "flags":1, "x":179, "y":28},
+ {"matrix":[2,17], "flags":4, "x":192, "y":28},
+ {"matrix":[2,18], "flags":4, "x":203, "y":28},
+ {"matrix":[2,19], "flags":4, "x":213, "y":28},
+ {"matrix":[2,20], "flags":4, "x":224, "y":28},
+
+ {"matrix":[3,0], "flags":8, "x":3, "y":39},
+ {"matrix":[3,1], "flags":4, "x":18, "y":39},
+ {"matrix":[3,2], "flags":4, "x":28, "y":39},
+ {"matrix":[3,3], "flags":4, "x":39, "y":39},
+ {"matrix":[3,4], "flags":4, "x":49, "y":39},
+ {"matrix":[3,5], "flags":4, "x":59, "y":39},
+ {"matrix":[3,6], "flags":4, "x":70, "y":39},
+ {"matrix":[3,7], "flag