Update K2 Pro

This commit is contained in:
lalalademaxiya1 2023-01-16 17:37:06 +08:00
parent a0d162e03a
commit 777cd7a3d5
5 changed files with 47 additions and 25 deletions

View File

@ -30,11 +30,6 @@ extern uint32_t retry_time_buffer;
extern uint8_t retry;
#ifdef NKRO_ENABLE
typedef struct {
bool usb : 1;
bool bluetooth : 1;
} nkro_t;
extern nkro_t nkro;
#endif
@ -458,6 +453,10 @@ bluetooth_state_t bluetooth_get_state(void) {
__attribute__((weak)) bool process_record_kb_bt(uint16_t keycode, keyrecord_t *record) { return true;};
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
if (get_transport() == TRANSPORT_BLUETOOTH) {
lpm_timer_reset();
@ -472,6 +471,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
}
#endif
}
process_record_kb_bt(keycode, record);
return process_record_user(keycode, record);
return process_record_kb_bt(keycode, record);
// return process_record_user(keycode, record);
}

View File

@ -13,6 +13,7 @@
* 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 "hal.h"
#if (HAL_USE_RTC)

View File

@ -1,3 +1,18 @@
/* 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/>.
*/
#include "quantum.h"
#include "bluetooth.h"
@ -12,13 +27,6 @@
# define REINIT_LED_DRIVER 1
#endif
#ifdef NKRO_ENABLE
typedef struct {
bool usb : 1;
bool bluetooth : 1;
} nkro_t;
#endif
#if defined(PROTOCOL_CHIBIOS)
extern host_driver_t chibios_driver;
#endif
@ -180,3 +188,10 @@ void usb_remote_wakeup(void) {
send_keyboard_report();
}
}
#ifdef BLUETOOTH_NKRO_ENABLE
void keyboard_post_init_user(void) {
keymap_config.raw = eeconfig_read_keymap();
nkro.bluetooth = keymap_config.nkro;
}
#endif

View File

@ -22,6 +22,13 @@ typedef enum {
TRANSPORT_BLUETOOTH,
} transport_t;
#ifdef NKRO_ENABLE
typedef struct {
bool usb : 1;
bool bluetooth : 1;
} nkro_t;
#endif
void set_transport(transport_t new_transport);
transport_t get_transport(void);