summaryrefslogtreecommitdiffstats
path: root/keyboards/keychron
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/keychron')
-rw-r--r--keyboards/keychron/bluetooth/bat_level_animation.c142
-rw-r--r--keyboards/keychron/bluetooth/bat_level_animation.h23
-rw-r--r--keyboards/keychron/bluetooth/battery.c107
-rw-r--r--keyboards/keychron/bluetooth/battery.h51
-rw-r--r--keyboards/keychron/bluetooth/bluetooth.c449
-rw-r--r--keyboards/keychron/bluetooth/bluetooth.h89
-rw-r--r--keyboards/keychron/bluetooth/bluetooth.mk14
-rw-r--r--keyboards/keychron/bluetooth/bluetooth_config.h33
-rw-r--r--keyboards/keychron/bluetooth/bluetooth_event_type.h44
-rw-r--r--keyboards/keychron/bluetooth/bluetooth_main.c37
-rw-r--r--keyboards/keychron/bluetooth/ckbt51.c591
-rw-r--r--keyboards/keychron/bluetooth/ckbt51.h156
-rw-r--r--keyboards/keychron/bluetooth/factory_test.c310
-rw-r--r--keyboards/keychron/bluetooth/factory_test.h24
-rw-r--r--keyboards/keychron/bluetooth/indicator.c479
-rw-r--r--keyboards/keychron/bluetooth/indicator.h89
-rw-r--r--keyboards/keychron/bluetooth/lpm.c92
-rw-r--r--keyboards/keychron/bluetooth/lpm.h30
-rw-r--r--keyboards/keychron/bluetooth/lpm_stm32l432.c347
-rw-r--r--keyboards/keychron/bluetooth/lpm_stm32l432.h19
-rw-r--r--keyboards/keychron/bluetooth/report_buffer.c141
-rw-r--r--keyboards/keychron/bluetooth/report_buffer.h50
-rw-r--r--keyboards/keychron/bluetooth/transport.c182
-rw-r--r--keyboards/keychron/bluetooth/transport.h32
-rw-r--r--keyboards/keychron/k6_pro/ansi/rgb/config.h100
-rw-r--r--keyboards/keychron/k6_pro/ansi/rgb/info.json94
-rw-r--r--keyboards/keychron/k6_pro/ansi/rgb/keymaps/default/keymap.c63
-rw-r--r--keyboards/keychron/k6_pro/ansi/rgb/keymaps/via/keymap.c63
-rw-r--r--keyboards/keychron/k6_pro/ansi/rgb/keymaps/via/rules.mk2
-rw-r--r--keyboards/keychron/k6_pro/ansi/rgb/rgb.c125
-rw-r--r--keyboards/keychron/k6_pro/ansi/rgb/rules.mk3
-rw-r--r--keyboards/keychron/k6_pro/ansi/white/config.h71
-rw-r--r--keyboards/keychron/k6_pro/ansi/white/info.json88
-rw-r--r--keyboards/keychron/k6_pro/ansi/white/keymaps/default/keymap.c63
-rw-r--r--keyboards/keychron/k6_pro/ansi/white/keymaps/via/keymap.c63
-rw-r--r--keyboards/keychron/k6_pro/ansi/white/keymaps/via/rules.mk2
-rw-r--r--keyboards/keychron/k6_pro/ansi/white/rules.mk2
-rw-r--r--keyboards/keychron/k6_pro/ansi/white/white.c123
-rw-r--r--keyboards/keychron/k6_pro/config.h105
-rw-r--r--keyboards/keychron/k6_pro/halconf.h29
-rw-r--r--keyboards/keychron/k6_pro/iso/rgb/config.h99
-rw-r--r--keyboards/keychron/k6_pro/iso/rgb/info.json89
-rw-r--r--keyboards/keychron/k6_pro/iso/rgb/keymaps/default/keymap.c63
-rw-r--r--keyboards/keychron/k6_pro/iso/rgb/keymaps/via/keymap.c63
-rw-r--r--keyboards/keychron/k6_pro/iso/rgb/keymaps/via/rules.mk2
-rw-r--r--keyboards/keychron/k6_pro/iso/rgb/rgb.c126
-rw-r--r--keyboards/keychron/k6_pro/iso/rgb/rules.mk2
-rw-r--r--keyboards/keychron/k6_pro/iso/white/config.h71
-rw-r--r--keyboards/keychron/k6_pro/iso/white/info.json89
-rw-r--r--keyboards/keychron/k6_pro/iso/white/keymaps/default/keymap.c63
-rw-r--r--keyboards/keychron/k6_pro/iso/white/keymaps/via/keymap.c63
-rw-r--r--keyboards/keychron/k6_pro/iso/white/keymaps/via/rules.mk2
-rw-r--r--keyboards/keychron/k6_pro/iso/white/rules.mk2
-rw-r--r--keyboards/keychron/k6_pro/iso/white/white.c125
-rw-r--r--keyboards/keychron/k6_pro/k6_pro.c296
-rw-r--r--keyboards/keychron/k6_pro/k6_pro.h80
-rw-r--r--keyboards/keychron/k6_pro/matrix.c152
-rw-r--r--keyboards/keychron/k6_pro/mcuconf.h43
-rw-r--r--keyboards/keychron/k6_pro/readme.md21
-rw-r--r--keyboards/keychron/k6_pro/rules.mk36
-rw-r--r--keyboards/keychron/k8_pro/ansi/rgb/config.h97
-rw-r--r--keyboards/keychron/k8_pro/ansi/rgb/info.json109
-rw-r--r--keyboards/keychron/k8_pro/ansi/rgb/keymaps/default/keymap.c60
-rw-r--r--keyboards/keychron/k8_pro/ansi/rgb/keymaps/via/keymap.c60
-rw-r--r--keyboards/keychron/k8_pro/ansi/rgb/keymaps/via/rules.mk1
-rw-r--r--keyboards/keychron/k8_pro/ansi/rgb/rgb.c148
-rw-r--r--keyboards/keychron/k8_pro/ansi/rgb/rules.mk3
-rw-r--r--keyboards/keychron/k8_pro/ansi/white/config.h69
-rw-r--r--keyboards/keychron/k8_pro/ansi/white/info.json108
-rw-r--r--keyboards/keychron/k8_pro/ansi/white/keymaps/default/keymap.c60
-rw-r--r--keyboards/keychron/k8_pro/ansi/white/keymaps/via/keymap.c60
-rw-r--r--keyboards/keychron/k8_pro/ansi/white/keymaps/via/rules.mk1
-rw-r--r--keyboards/keychron/k8_pro/ansi/white/rules.mk2
-rw-r--r--keyboards/keychron/k8_pro/ansi/white/white.c148
-rw-r--r--keyboards/keychron/k8_pro/config.h101
-rw-r--r--keyboards/keychron/k8_pro/halconf.h26
-rw-r--r--keyboards/keychron/k8_pro/iso/rgb/config.h96
-rw-r--r--keyboards/keychron/k8_pro/iso/rgb/info.json109
-rw-r--r--keyboards/keychron/k8_pro/iso/rgb/keymaps/default/keymap.c60
-rw-r--r--keyboards/keychron/k8_pro/iso/rgb/keymaps/via/keymap.c60
-rw-r--r--keyboards/keychron/k8_pro/iso/rgb/keymaps/via/rules.mk1
-rw-r--r--keyboards/keychron/k8_pro/iso/rgb/rgb.c149
-rw-r--r--keyboards/keychron/k8_pro/iso/rgb/rules.mk3
-rw-r--r--keyboards/keychron/k8_pro/iso/white/config.h68
-rw-r--r--keyboards/keychron/k8_pro/iso/white/info.json109
-rw-r--r--keyboards/keychron/k8_pro/iso/white/keymaps/default/keymap.c59
-rw-r--r--keyboards/keychron/k8_pro/iso/white/keymaps/via/keymap.c59
-rw-r--r--keyboards/keychron/k8_pro/iso/white/keymaps/via/rules.mk1
-rw-r--r--keyboards/keychron/k8_pro/iso/white/rules.mk2
-rw-r--r--keyboards/keychron/k8_pro/iso/white/white.c149
-rw-r--r--keyboards/keychron/k8_pro/k8_pro.c306
-rw-r--r--keyboards/keychron/k8_pro/k8_pro.h99
-rw-r--r--keyboards/keychron/k8_pro/matrix.c173
-rw-r--r--keyboards/keychron/k8_pro/mcuconf.h37
-rw-r--r--keyboards/keychron/k8_pro/readme.md21
-rw-r--r--keyboards/keychron/k8_pro/rules.mk37
96 files changed, 8665 insertions, 0 deletions
diff --git a/keyboards/keychron/bluetooth/bat_level_animation.c b/keyboards/keychron/bluetooth/bat_level_animation.c
new file mode 100644
index 0000000000..e63735bcff
--- /dev/null
+++ b/keyboards/keychron/bluetooth/bat_level_animation.c
@@ -0,0 +1,142 @@
+
+#include "quantum.h"
+#include "bluetooth.h"
+#include "indicator.h"
+#include "lpm.h"
+#if defined(PROTOCOL_CHIBIOS)
+# include <usb_main.h>
+#elif if defined(PROTOCOL_LUFA)
+# include "lufa.h"
+#endif
+#include "eeprom.h"
+
+#ifndef BAT_LEVEL_GROWING_INTERVAL
+# define BAT_LEVEL_GROWING_INTERVAL 150
+#endif
+
+#ifndef BAT_LEVEL_ON_INTERVAL
+# define BAT_LEVEL_ON_INTERVAL 3000
+#endif
+
+#ifdef LED_MATRIX_ENABLE
+# define LED_DRIVER_IS_ENABLED led_matrix_is_enabled
+#endif
+
+#ifdef RGB_MATRIX_ENABLE
+# define LED_DRIVER_IS_ENABLED rgb_matrix_is_enabled
+#endif
+
+enum {
+ BAT_LVL_ANI_NONE,
+ BAT_LVL_ANI_GROWING,
+ BAT_LVL_ANI_BLINK_OFF,
+ BAT_LVL_ANI_BLINK_ON,
+};
+
+static uint8_t animation_state = 0;
+static uint32_t bat_lvl_ani_timer_buffer = 0;
+static uint8_t bat_percentage;
+static uint8_t cur_percentage;
+static uint32_t time_interval;
+#ifdef RGB_MATRIX_ENABLE
+static uint8_t r, g, b;
+#endif
+
+extern indicator_config_t indicator_config;
+extern backlight_state_t original_backlight_state;
+
+void bat_level_animiation_start(uint8_t percentage) {
+ /* Turn on backlight mode for indicator */
+ indicator_enable();
+
+ animation_state = BAT_LVL_ANI_GROWING;
+ bat_percentage = percentage;
+ bat_lvl_ani_timer_buffer = sync_timer_read32();
+ cur_percentage = 0;
+ time_interval = BAT_LEVEL_GROWING_INTERVAL;
+#ifdef RGB_MATRIX_ENABLE
+ r = g = b = 255;
+#endif
+}
+
+void bat_level_animiation_stop(void) {
+ animation_state = BAT_LVL_ANI_NONE;
+}
+
+bool bat_level_animiation_actived(void) {
+ return animation_state;
+}
+
+void bat_level_animiation_indicate(void) {
+#ifdef LED_MATRIX_ENABLE
+ uint8_t bat_lvl_led_list[10] = BAT_LEVEL_LED_LIST;
+
+ for (uint8_t i = 0; i <= LED_MATRIX_LED_COUNT; i++) {
+ led_matrix_set_value(i, 0);
+ }
+
+ if (animation_state == BAT_LVL_ANI_GROWING || animation_state == BAT_LVL_ANI_BLINK_ON)
+ for (uint8_t i = 0; i < cur_percentage / 10; i++)
+ led_matrix_set_value(bat_lvl_led_list[i], 255);
+#endif
+
+#ifdef RGB_MATRIX_ENABLE
+ uint8_t bat_lvl_led_list[10] = BAT_LEVEL_LED_LIST;
+
+ for (uint8_t i = 0; i <= RGB_MATRIX_LED_COUNT; i++) {
+ rgb_matrix_set_color(i, 0, 0, 0);
+ }
+
+ if (animation_state == BAT_LVL_ANI_GROWING || animation_state == BAT_LVL_ANI_BLINK_ON) {
+ for (uint8_t i = 0; i < cur_percentage / 10; i++) {
+ rgb_matrix_set_color(bat_lvl_led_list[i], r, g, b);
+ }
+ }
+#endif
+}
+
+void bat_level_animiation_update(void) {
+ switch (animation_state) {
+ case BAT_LVL_ANI_GROWING:
+ if (cur_percentage < bat_percentage)
+ cur_percentage += 10;
+ else {
+ if (cur_percentage == 0) cur_percentage = 10;
+ animation_state = BAT_LVL_ANI_BLINK_OFF;
+ }
+ break;
+
+ case BAT_LVL_ANI_BLINK_OFF:
+#ifdef RGB_MATRIX_ENABLE
+ if (bat_percentage < 30) {
+ r = 255;
+ b = g = 0;
+ } else {
+ r = b = 0;
+ g = 255;
+ }
+#endif
+ time_interval = BAT_LEVEL_ON_INTERVAL;
+ animation_state = BAT_LVL_ANI_BLINK_ON;
+ break;
+
+ case BAT_LVL_ANI_BLINK_ON:
+ animation_state = BAT_LVL_ANI_NONE;
+ indicator_eeconfig_reload();
+ if (indicator_config.value == 0 && !LED_DRIVER_IS_ENABLED()) {
+ indicator_disable();
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ bat_lvl_ani_timer_buffer = sync_timer_read32();
+}
+
+void bat_level_animiation_task(void) {
+ if (animation_state && sync_timer_elapsed32(bat_lvl_ani_timer_buffer) > time_interval) {
+ bat_level_animiation_update();
+ }
+}
diff --git a/keyboards/keychron/bluetooth/bat_level_animation.h b/keyboards/keychron/bluetooth/bat_level_animation.h
new file mode 100644
index 0000000000..716e924103
--- /dev/null
+++ b/keyboards/keychron/bluetooth/bat_level_animation.h
@@ -0,0 +1,23 @@
+/* Copyright 2022 @ lokher (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/>.
+ */
+
+#pragma once
+
+void bat_level_animiation_start(uint8_t percentage);
+void bat_level_animiation_stop(void);
+bool bat_level_animiation_actived(void);
+void bat_level_animiation_indicate(void);
+void bat_level_animiation_task(void);
diff --git a/keyboards/keychron/bluetooth/battery.c b/keyboards/keychron/bluetooth/battery.c
new file mode 100644
index 0000000000..6dd453357e
--- /dev/null
+++ b/keyboards/keychron/bluetooth/battery.c
@@ -0,0 +1,107 @@
+/* Copyright 2022 @ lokher (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