summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlalalademaxiya1 <2831039915@qq.com>2023-06-30 09:50:52 +0800
committerlalalademaxiya1 <2831039915@qq.com>2023-06-30 09:50:52 +0800
commitf877082a650896cb62a51f8d682d033a27c2a879 (patch)
tree93994c33eb52957502ccf2c9ad27350cbfebbde8
parentd90608debfbe0f7f11d020dbbaf515448f530078 (diff)
Updated q8 pro
-rwxr-xr-xkeyboards/keychron/q8_pro/ansi_encoder/config.h6
-rwxr-xr-xkeyboards/keychron/q8_pro/ansi_encoder/info.json2
-rwxr-xr-xkeyboards/keychron/q8_pro/ansi_encoder/keymaps/default/keymap.c18
-rw-r--r--keyboards/keychron/q8_pro/ansi_encoder/keymaps/default/rules.mk1
-rwxr-xr-xkeyboards/keychron/q8_pro/ansi_encoder/keymaps/via/keymap.c18
-rw-r--r--keyboards/keychron/q8_pro/ansi_encoder/keymaps/via/rules.mk1
-rwxr-xr-xkeyboards/keychron/q8_pro/config.h4
-rwxr-xr-xkeyboards/keychron/q8_pro/info.json13
-rw-r--r--keyboards/keychron/q8_pro/matrix.c100
-rwxr-xr-xkeyboards/keychron/q8_pro/q8_pro.c29
10 files changed, 125 insertions, 67 deletions
diff --git a/keyboards/keychron/q8_pro/ansi_encoder/config.h b/keyboards/keychron/q8_pro/ansi_encoder/config.h
index 9ca730f613..7116820a13 100755
--- a/keyboards/keychron/q8_pro/ansi_encoder/config.h
+++ b/keyboards/keychron/q8_pro/ansi_encoder/config.h
@@ -34,8 +34,9 @@
/* Turn off backllit if brightness value is low */
# define RGB_MATRIX_BRIGHTNESS_TURN_OFF_VAL 48
+/* Indication led */
# define CAPS_LOCK_INDEX 29
-# define LOW_BAT_IND_INDEX 60
+# define LOW_BAT_IND_INDEX 61
// RGB Matrix Animation modes. Explicitly enabled
// For full list of effects, see:
@@ -45,6 +46,5 @@
/* Set LED driver current */
# define CKLED2001_CURRENT_TUNE \
- { 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28 }
-
+ { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 }
#endif
diff --git a/keyboards/keychron/q8_pro/ansi_encoder/info.json b/keyboards/keychron/q8_pro/ansi_encoder/info.json
index f1de7dd2fe..b4c31d62c4 100755
--- a/keyboards/keychron/q8_pro/ansi_encoder/info.json
+++ b/keyboards/keychron/q8_pro/ansi_encoder/info.json
@@ -4,7 +4,7 @@
"device_version": "1.0.0"
},
"layouts": {
- "LAYOUT": {
+ "LAYOUT_69_ansi": {
"layout": [
{"matrix":[0, 0], "x":0.75, "y":0.25},
{"matrix":[0, 1], "x":1.75, "y":0.25},
diff --git a/keyboards/keychron/q8_pro/ansi_encoder/keymaps/default/keymap.c b/keyboards/keychron/q8_pro/ansi_encoder/keymaps/default/keymap.c
index 429729e0ac..c5401f5af8 100755
--- a/keyboards/keychron/q8_pro/ansi_encoder/keymaps/default/keymap.c
+++ b/keyboards/keychron/q8_pro/ansi_encoder/keymaps/default/keymap.c
@@ -22,39 +22,39 @@ enum layers{
WIN_BASE,
MAC_FN1,
WIN_FN1,
- FN2
+ FN2,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [MAC_BASE] = LAYOUT(
+ [MAC_BASE] = LAYOUT_69_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, KC_MUTE,
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_BSLS, KC_DEL,
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_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
- KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, MO(MAC_FN1), MO(FN2), KC_SPC, KC_RCMMD, KC_LEFT, KC_DOWN, KC_RGHT),
+ KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, MO(MAC_FN1), MO(FN2), KC_SPC, KC_RCMMD, KC_LEFT, KC_DOWN, KC_RGHT),
- [WIN_BASE] = LAYOUT(
+ [WIN_BASE] = LAYOUT_69_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, KC_MUTE,
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_BSLS, KC_DEL,
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_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
- KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, MO(WIN_FN1), MO(FN2), KC_SPC, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT),
+ KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, MO(WIN_FN1), MO(FN2), KC_SPC, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT),
- [MAC_FN1] = LAYOUT(
+ [MAC_FN1] = LAYOUT_69_ansi(
KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG,
_______, BT_HST1, BT_HST2, BT_HST3, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
- [WIN_FN1] = LAYOUT(
+ [WIN_FN1] = LAYOUT_69_ansi(
KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FILE, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG,
_______, BT_HST1, BT_HST2, BT_HST3, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
- [FN2] = LAYOUT(
+ [FN2] = LAYOUT_69_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, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@@ -65,8 +65,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[MAC_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)},
- [MAC_FN1] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI)},
[WIN_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)},
+ [MAC_FN1] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI)},
[WIN_FN1] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI)},
[FN2] = {ENCODER_CCW_CW(_______, _______)},
};
diff --git a/keyboards/keychron/q8_pro/ansi_encoder/keymaps/default/rules.mk b/keyboards/keychron/q8_pro/ansi_encoder/keymaps/default/rules.mk
index ee32568148..2408ee532a 100644
--- a/keyboards/keychron/q8_pro/ansi_encoder/keymaps/default/rules.mk
+++ b/keyboards/keychron/q8_pro/ansi_encoder/keymaps/default/rules.mk
@@ -1 +1,2 @@
ENCODER_MAP_ENABLE = yes
+OPT_DEFS += -DDYNAMIC_KEYMAP_LAYER_COUNT=5
diff --git a/keyboards/keychron/q8_pro/ansi_encoder/keymaps/via/keymap.c b/keyboards/keychron/q8_pro/ansi_encoder/keymaps/via/keymap.c
index 429729e0ac..c5401f5af8 100755
--- a/keyboards/keychron/q8_pro/ansi_encoder/keymaps/via/keymap.c
+++ b/keyboards/keychron/q8_pro/ansi_encoder/keymaps/via/keymap.c
@@ -22,39 +22,39 @@ enum layers{
WIN_BASE,
MAC_FN1,
WIN_FN1,
- FN2
+ FN2,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
- [MAC_BASE] = LAYOUT(
+ [MAC_BASE] = LAYOUT_69_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, KC_MUTE,
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_BSLS, KC_DEL,
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_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
- KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, MO(MAC_FN1), MO(FN2), KC_SPC, KC_RCMMD, KC_LEFT, KC_DOWN, KC_RGHT),
+ KC_LCTL, KC_LOPTN, KC_LCMMD, KC_SPC, MO(MAC_FN1), MO(FN2), KC_SPC, KC_RCMMD, KC_LEFT, KC_DOWN, KC_RGHT),
- [WIN_BASE] = LAYOUT(
+ [WIN_BASE] = LAYOUT_69_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, KC_MUTE,
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_BSLS, KC_DEL,
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_HOME,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
- KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, MO(WIN_FN1), MO(FN2), KC_SPC, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT),
+ KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, MO(WIN_FN1), MO(FN2), KC_SPC, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT),
- [MAC_FN1] = LAYOUT(
+ [MAC_FN1] = LAYOUT_69_ansi(
KC_GRV, KC_BRID, KC_BRIU, KC_MCTL, KC_LPAD, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG,
_______, BT_HST1, BT_HST2, BT_HST3, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
- [WIN_FN1] = LAYOUT(
+ [WIN_FN1] = LAYOUT_69_ansi(
KC_GRV, KC_BRID, KC_BRIU, KC_TASK, KC_FILE, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, RGB_TOG,
_______, BT_HST1, BT_HST2, BT_HST3, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______,
_______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, NK_TOGG, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______),
- [FN2] = LAYOUT(
+ [FN2] = LAYOUT_69_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, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@@ -65,8 +65,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[MAC_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)},
- [MAC_FN1] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI)},
[WIN_BASE] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)},
+ [MAC_FN1] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI)},
[WIN_FN1] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI)},
[FN2] = {ENCODER_CCW_CW(_______, _______)},
};
diff --git a/keyboards/keychron/q8_pro/ansi_encoder/keymaps/via/rules.mk b/keyboards/keychron/q8_pro/ansi_encoder/keymaps/via/rules.mk
index 005db2068f..b8562c8f4e 100644
--- a/keyboards/keychron/q8_pro/ansi_encoder/keymaps/via/rules.mk
+++ b/keyboards/keychron/q8_pro/ansi_encoder/keymaps/via/rules.mk
@@ -1,4 +1,3 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes
-
OPT_DEFS += -DDYNAMIC_KEYMAP_LAYER_COUNT=5
diff --git a/keyboards/keychron/q8_pro/config.h b/keyboards/keychron/q8_pro/config.h
index 3a4174c4fa..b03b71ec30 100755
--- a/keyboards/keychron/q8_pro/config.h
+++ b/keyboards/keychron/q8_pro/config.h
@@ -18,10 +18,10 @@
/* turn off effects when suspended */
#define RGB_DISABLE_WHEN_USB_SUSPENDED
-#define LED_DISABLE_WHEN_USB_SUSPENDED
/* DIP switch */
-#define DIP_SWITCH_PINS { A8 }
+#define DIP_SWITCH_PINS \
+ { A8 }
/* Increase I2C speed to 1000 KHz */
#define I2C1_TIMINGR_PRESC 0U
diff --git a/keyboards/keychron/q8_pro/info.json b/keyboards/keychron/q8_pro/info.json
index f562faf30d..49bd577449 100755
--- a/keyboards/keychron/q8_pro/info.json
+++ b/keyboards/keychron/q8_pro/info.json
@@ -5,6 +5,9 @@
"maintainer": "lalalademaxiya1",
"processor": "STM32L432",
"bootloader": "stm32-dfu",
+ "usb": {
+ "vid": "0x3434"
+ },
"features": {
"bootmagic": true,
"command": false,
@@ -44,15 +47,11 @@
"solid_splash": true
}
},
- "bluetooth": {
- "driver": "custom"
- },
- "usb": {
- "vid": "0x3434"
- },
"matrix_pins": {
"cols": [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null],
- "rows": ["B4", "B3", "A15", "A14", "A13"]
+ "rows": ["B4", "B3", "A15", "A14", "A13"],
+ "custom": true,
+ "custom_lite": true
},
"diode_direction": "ROW2COL",
"encoder": {
diff --git a/keyboards/keychron/q8_pro/matrix.c b/keyboards/keychron/q8_pro/matrix.c
index 663dae5ff9..4f39280e95 100644
--- a/keyboards/keychron/q8_pro/matrix.c
+++ b/keyboards/keychron/q8_pro/matrix.c
@@ -38,10 +38,9 @@ static inline void setPinOutput_writeLow(pin_t pin) {
writePinLow(pin);
}
-static inline void HC595_initPin(void) {
- setPinOutput(HC595_DS);
- setPinOutput(HC595_STCP);
- setPinOutput(HC595_SHCP);
+static inline void setPinOutput_writeHigh(pin_t pin) {
+ setPinOutput(pin);
+ writePinHigh(pin);
}
static inline void HC595_delay(uint16_t n) {
@@ -50,11 +49,12 @@ static inline void HC595_delay(uint16_t n) {
}
}
-static void HC595_output(uint16_t data, bool bit) {
- uint8_t n = 1;
+static void HC595_output(uint16_t data) {
uint8_t i;
+ uint8_t n = 1;
- for (i = 1; i < 16; i++) {
+ for (i = 1; i < (MATRIX_COLS - DIRECT_COL_NUM); i++) {
+ writePinLow(HC595_SHCP);
if (data & 0x1) {
writePinHigh(HC595_DS);
} else {
@@ -63,43 +63,86 @@ static void HC595_output(uint16_t data, bool bit) {
HC595_delay(n);
writePinHigh(HC595_SHCP);
HC595_delay(n);
- writePinLow(HC595_SHCP);
- if (bit) {
- break;
- } else {
- data >>= 1;
- }
+
+ data = data >> 1;
}
+ writePinLow(HC595_STCP);
+ HC595_delay(n);
writePinHigh(HC595_STCP);
+}
+
+static void HC595_output_bit(uint8_t data) {
+ uint8_t n = 1;
+
+ writePinLow(HC595_SHCP);
+ if (data & 0x1) {
+ writePinHigh(HC595_DS);
+ } else {
+ writePinLow(HC595_DS);
+ }
HC595_delay(n);
+
+ writePinHigh(HC595_SHCP);
+ HC595_delay(n);
+
writePinLow(HC595_STCP);
+ HC595_delay(n);
+ writePinHigh(HC595_STCP);
}
static void select_col(uint8_t col) {
- if (col == DIRECT_COL_NUM) {
- HC595_output(0x0, 1);
- HC595_output(0x1, 1);
+ if (col < DIRECT_COL_NUM) {
+ setPinOutput_writeLow(col_pins[col]);
+ } else {
+ if (col == DIRECT_COL_NUM) {
+ HC595_output_bit(0x00);
+ HC595_output_bit(0x01);
+ }
}
}
-static void unselect_col(void) {
- HC595_output(0x1, 1);
+static void unselect_col(uint8_t col) {
+ if (col < DIRECT_COL_NUM) {
+#ifdef MATRIX_UNSELECT_DRIVE_HIGH
+ setPinOutput_writeHigh(col_pins[col]);
+#else
+ setPinInputHigh(col_pins[col]);
+#endif
+ } else {
+ HC595_output_bit(0x01);
+ }
}
static void unselect_cols(void) {
- HC595_output(0xFFFF, 0);
+ for (uint8_t x = 0; x < MATRIX_COLS; x++) {
+ if (x < DIRECT_COL_NUM) {
+#ifdef MATRIX_UNSELECT_DRIVE_HIGH
+ setPinOutput_writeHigh(col_pins[x]);
+#else
+ setPinInputHigh(col_pins[x]);
+#endif
+ } else {
+ if (x == DIRECT_COL_NUM) HC595_output(0xFFFF);
+ break;
+ }
+ }
}
void select_all_cols(void) {
- HC595_output(0x0, 0);
+ for (uint8_t x = 0; x < MATRIX_COLS; x++) {
+ if (x < DIRECT_COL_NUM) {
+ setPinOutput_writeLow(col_pins[x]);
+ } else {
+ if (x == DIRECT_COL_NUM) HC595_output(0x0000);
+ break;
+ }
+ }
}
static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col, matrix_row_t row_shifter) {
- bool key_pressed = false;
-
// Select col
- select_col(current_col);
- matrix_output_select_delay();
+ select_col(current_col); // select col
+ HC595_delay(200);
// For each row...
for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {
@@ -107,7 +150,6 @@ static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t curre
if (readMatrixPin(row_pins[row_index]) == 0) {
// Pin LO, set col bit
current_matrix[row_index] |= row_shifter;
- key_pressed = true;
} else {
// Pin HI, clear col bit
current_matrix[row_index] &= ~row_shifter;
@@ -115,12 +157,14 @@ static void matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t curre
}
// Unselect col
- unselect_col();
- matrix_output_unselect_delay(current_col, key_pressed); // wait for all Row signals to go HIGH
+ unselect_col(current_col);
+ HC595_delay(200); // wait for all Row signals to go HIGH
}
void matrix_init_custom(void) {
- HC595_initPin();
+ setPinOutput(HC595_DS);
+ setPinOutput(HC595_STCP);
+ setPinOutput(HC595_SHCP);
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
if (row_pins[x] != NO_PIN) {
diff --git a/keyboards/keychron/q8_pro/q8_pro.c b/keyboards/keychron/q8_pro/q8_pro.c
index 9926cfb309..97e2ed1f6d 100755
--- a/keyboards/keychron/q8_pro/q8_pro.c
+++ b/keyboards/keychron/q8_pro/q8_pro.c
@@ -34,8 +34,9 @@ typedef struct PACKED {
uint8_t keycode[3];
} key_combination_t;
-static uint32_t siri_timer_buffer = 0;
-static uint8_t mac_keycode[4] = {KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD};
+static uint32_t factory_timer_buffer = 0;
+static uint32_t siri_timer_buffer = 0;
+static uint8_t mac_keycode[4] = {KC_LOPT, KC_ROPT, KC_LCMD, KC_RCMD};
key_combination_t key_comb_list[4] = {
{2, {KC_LWIN, KC_TAB}}, // Task (win)
@@ -133,7 +134,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
return true;
}
-#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
+#if defined(KC_BLUETOOTH_ENABLE) && defined(ENCODER_ENABLE)
static void encoder_pad_cb(void *param) {
encoder_inerrupt_read((uint32_t)param & 0XFF);
}
@@ -144,7 +145,9 @@ void keyboard_post_init_kb(void) {
#ifdef KC_BLUETOOTH_ENABLE
/* Currently we don't use this reset pin */
- palSetLineMode(CKBT51_RESET_PIN, PAL_MODE_UNCONNECTED);
+ // palSetLineMode(CKBT51_RESET_PIN, PAL_MODE_UNCONNECTED);
+ palSetLineMode(CKBT51_RESET_PIN, PAL_MODE_OUTPUT_PUSHPULL);
+ palWriteLine(CKBT51_RESET_PIN, PAL_HIGH);
/* IMPORTANT: DO NOT enable internal pull-up resistor
* as there is an external pull-down resistor.
@@ -153,9 +156,8 @@ void keyboard_post_init_kb(void) {
ckbt51_init(false);
bluetooth_init();
-#endif
-#if defined(ENCODER_ENABLE) && defined(PAL_USE_CALLBACKS)
+# ifdef ENCODER_ENABLE
pin_t encoders_pad_a[NUM_ENCODERS] = ENCODERS_PAD_A;
pin_t encoders_pad_b[NUM_ENCODERS] = ENCODERS_PAD_B;
for (uint32_t i = 0; i < NUM_ENCODERS; i++) {
@@ -164,12 +166,23 @@ void keyboard_post_init_kb(void) {
palSetLineCallback(encoders_pad_a[i], encoder_pad_cb, (void *)i);
palSetLineCallback(encoders_pad_b[i], encoder_pad_cb, (void *)i);
}
+# endif
#endif
keyboard_post_init_user();
}
void matrix_scan_kb(void) {
+ if (factory_timer_buffer && timer_elapsed32(factory_timer_buffer) > 2000) {
+ factory_timer_buffer = 0;
+ if (bt_factory_reset) {
+ bt_factory_reset = false;
+ palWriteLine(CKBT51_RESET_PIN, PAL_LOW);
+ wait_ms(5);
+ palWriteLine(CKBT51_RESET_PIN, PAL_HIGH);
+ }
+ }
+
if (siri_timer_buffer && sync_timer_elapsed32(siri_timer_buffer) > 500) {
siri_timer_buffer = 0;
unregister_code(KC_LGUI);
@@ -187,6 +200,7 @@ static void ckbt51_param_init(void) {
/* Set bluetooth device name */
// ckbt51_set_local_name(STR(PRODUCT));
ckbt51_set_local_name(PRODUCT);
+ wait_ms(10);
/* Set bluetooth parameters */
module_param_t param = {.event_mode = 0x02,
.connected_idle_timeout = 7200,
@@ -198,12 +212,13 @@ static void ckbt51_param_init(void) {
.verndor_id = 0, // Must be 0x3434
.product_id = PRODUCT_ID};
ckbt51_set_param(&param);
+ wait_ms(10);
}
void bluetooth_enter_disconnected_kb(uint8_t host_idx) {
if (bt_factory_reset) {
- bt_factory_reset = false;
ckbt51_param_init();
+ factory_timer_buffer = timer_read32();
}
/* CKBT51 bluetooth module boot time is slower, it enters disconnected after boot,
so we place initialization here. */