summaryrefslogtreecommitdiffstats
path: root/keyboards/keychron/q6_pro/q6_pro.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/keychron/q6_pro/q6_pro.c')
-rwxr-xr-xkeyboards/keychron/q6_pro/q6_pro.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/keyboards/keychron/q6_pro/q6_pro.c b/keyboards/keychron/q6_pro/q6_pro.c
index 5ecc2cc485..c099bfec90 100755
--- a/keyboards/keychron/q6_pro/q6_pro.c
+++ b/keyboards/keychron/q6_pro/q6_pro.c
@@ -36,10 +36,10 @@ typedef struct PACKED {
uint8_t keycode[3];
} key_combination_t;
-static uint32_t factory_timer_buffer = 0;
-static uint32_t power_on_indicator_timer_buffer;
-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 power_on_indicator_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)
@@ -61,7 +61,11 @@ static void pairing_key_timer_cb(void *arg) {
bool dip_switch_update_kb(uint8_t index, bool active) {
if (index == 0) {
+#ifdef INVERT_OS_SWITCH_STATE
+ default_layer_set(1UL << (!active ? 2 : 0));
+#else
default_layer_set(1UL << (active ? 2 : 0));
+#endif
}
dip_switch_update_user(index, active);
@@ -136,7 +140,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);
}
@@ -151,9 +155,6 @@ void keyboard_post_init_kb(void) {
palSetLineMode(CKBT51_RESET_PIN, PAL_MODE_OUTPUT_PUSHPULL);
palWriteLine(CKBT51_RESET_PIN, PAL_HIGH);
- palSetLineMode(H3, PAL_MODE_OUTPUT_PUSHPULL);
- palWriteLine(H3, PAL_LOW);
-
/* IMPORTANT: DO NOT enable internal pull-up resistor
* as there is an external pull-down resistor.
*/
@@ -161,12 +162,11 @@ void keyboard_post_init_kb(void) {
ckbt51_init(false);
bluetooth_init();
-#endif
power_on_indicator_timer_buffer = sync_timer_read32() | 1;
writePin(BAT_LOW_LED_PIN, BAT_LOW_LED_PIN_ON_STATE);
-#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++) {
@@ -175,6 +175,7 @@ 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();
@@ -188,7 +189,7 @@ void matrix_scan_kb(void) {
if (bt_factory_reset) {
bt_factory_reset = false;
palWriteLine(CKBT51_RESET_PIN, PAL_LOW);
- wait_ms(10);
+ wait_ms(5);
palWriteLine(CKBT51_RESET_PIN, PAL_HIGH);
}
}
@@ -239,12 +240,9 @@ void bluetooth_enter_disconnected_kb(uint8_t host_idx) {
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. */
if (firstDisconnect && sync_timer_read32() < 1000 && get_transport() == TRANSPORT_BLUETOOTH) {
- ckbt51_set_local_name(PRODUCT);
-
ckbt51_param_init();
bluetooth_connect();
firstDisconnect = false;
@@ -252,18 +250,18 @@ void bluetooth_enter_disconnected_kb(uint8_t host_idx) {
}
void ckbt51_default_ack_handler(uint8_t *data, uint8_t len) {
- // if (data[1] == 0x45) {
- // module_param_t param = {.event_mode = 0x02,
- // .connected_idle_timeout = 7200,
- // .pairing_timeout = 180,
- // .pairing_mode = 0,
- // .reconnect_timeout = 5,
- // .report_rate = 90,
- // .vendor_id_source = 1,
- // .verndor_id = 0, // Must be 0x3434
- // .product_id = PRODUCT_ID};
- // ckbt51_set_param(&param);
- // }
+ if (data[1] == 0x45) {
+ module_param_t param = {.event_mode = 0x02,
+ .connected_idle_timeout = 7200,
+ .pairing_timeout = 180,
+ .pairing_mode = 0,
+ .reconnect_timeout = 5,
+ .report_rate = 90,
+ .vendor_id_source = 1,
+ .verndor_id = 0, // Must be 0x3434
+ .product_id = PRODUCT_ID};
+ ckbt51_set_param(&param);
+ }
}
void bluetooth_pre_task(void) {