Keycode processing migration+stubs.

This commit is contained in:
Nick Brassel 2024-08-07 17:46:10 +10:00
parent 7f9d61fe21
commit 64d626864a
No known key found for this signature in database
4 changed files with 49 additions and 13 deletions

View File

@ -881,7 +881,7 @@ ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
OPT_DEFS += -DBLUETOOTH_$(strip $(shell echo $(BLUETOOTH_DRIVER) | tr '[:lower:]' '[:upper:]'))
NO_USB_STARTUP_CHECK := yes
COMMON_VPATH += $(DRIVER_PATH)/bluetooth
SRC += outputselect.c
SRC += outputselect.c process_connection.c
ifeq ($(strip $(BLUETOOTH_DRIVER)), bluefruit_le)
SPI_DRIVER_REQUIRED = yes

View File

@ -0,0 +1,35 @@
// Copyright 2024 Nick Brassel (@tzarc)
// SPDX-License-Identifier: GPL-2.0-or-later
#include "outputselect.h"
#include "process_connection.h"
bool process_connection(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch (keycode) {
case QK_OUTPUT_NEXT:
set_output(OUTPUT_AUTO);
return false;
case QK_OUTPUT_USB:
set_output(OUTPUT_USB);
return false;
case QK_OUTPUT_BLUETOOTH:
set_output(OUTPUT_BLUETOOTH);
return false;
case QK_OUTPUT_PREV:
case QK_OUTPUT_NONE:
case QK_OUTPUT_2P4GHZ:
case QK_BLUETOOTH_PROFILE_NEXT:
case QK_BLUETOOTH_PROFILE_PREV:
case QK_BLUETOOTH_UNPAIR:
case QK_BLUETOOTH_PROFILE1:
case QK_BLUETOOTH_PROFILE2:
case QK_BLUETOOTH_PROFILE3:
case QK_BLUETOOTH_PROFILE4:
case QK_BLUETOOTH_PROFILE5:
// As-yet unimplemented.
return false;
}
}
return true;
}

View File

@ -0,0 +1,9 @@
// Copyright 2024 Nick Brassel (@tzarc)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include "action.h"
bool process_connection(uint16_t keycode, keyrecord_t *record);

View File

@ -21,7 +21,7 @@
#endif
#ifdef BLUETOOTH_ENABLE
# include "outputselect.h"
# include "process_connection.h"
#endif
#ifdef GRAVE_ESC_ENABLE
@ -393,6 +393,9 @@ bool process_record_quantum(keyrecord_t *record) {
#endif
#ifdef TRI_LAYER_ENABLE
process_tri_layer(keycode, record) &&
#endif
#ifdef BLUETOOTH_ENABLE
process_connection(keycode, record) &&
#endif
true)) {
return false;
@ -431,17 +434,6 @@ bool process_record_quantum(keyrecord_t *record) {
velocikey_toggle();
return false;
#endif
#ifdef BLUETOOTH_ENABLE
case QK_OUTPUT_AUTO:
set_output(OUTPUT_AUTO);
return false;
case QK_OUTPUT_USB:
set_output(OUTPUT_USB);
return false;
case QK_OUTPUT_BLUETOOTH:
set_output(OUTPUT_BLUETOOTH);
return false;
#endif
#ifndef NO_ACTION_ONESHOT
case QK_ONE_SHOT_TOGGLE:
oneshot_toggle();