fl16: Refactor factory mode

Signed-off-by: Daniel Schaefer <dhs@frame.work>
This commit is contained in:
Daniel Schaefer 2023-08-08 20:32:22 +08:00
parent ddfb8f4934
commit 436a9cc02c
2 changed files with 14 additions and 5 deletions

View File

@ -4,6 +4,7 @@
#include "quantum.h"
#include "raw_hid.h"
#include "matrix.h"
#include "factory.h"
#include "framework.h"
#if defined(RGB_MATRIX_ENABLE)
#include "rgb_matrix.h"
@ -70,10 +71,7 @@ void handle_factory_command(uint8_t *data) {
bios_mode = false;
break;
case f_factory_mode:
if (command_data[0] == 0x01)
layer_on(2);
else
layer_off(2);
enable_factory_mode(command_data[0] == 0x01);
break;
default:
uprintf("Unknown factory command: %u\n", factory_command_id);
@ -81,6 +79,10 @@ void handle_factory_command(uint8_t *data) {
}
}
__attribute__ ((weak))
void enable_factory_mode(bool enable) {
}
bool handle_hid(uint8_t *data, uint8_t length) {
uint8_t command_id = data[0];
uint8_t *command_data = &(data[1]);

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
#include "factory.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
@ -84,3 +84,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_U, KC_V, KC_W, KC_X
)
};
void enable_factory_mode(bool enable) {
if (enable)
layer_on(2);
else
layer_off(2);
}