fl16: Refactor factory mode
Signed-off-by: Daniel Schaefer <dhs@frame.work>
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
#include "raw_hid.h"
|
#include "raw_hid.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
|
#include "factory.h"
|
||||||
#include "framework.h"
|
#include "framework.h"
|
||||||
#if defined(RGB_MATRIX_ENABLE)
|
#if defined(RGB_MATRIX_ENABLE)
|
||||||
#include "rgb_matrix.h"
|
#include "rgb_matrix.h"
|
||||||
@@ -70,10 +71,7 @@ void handle_factory_command(uint8_t *data) {
|
|||||||
bios_mode = false;
|
bios_mode = false;
|
||||||
break;
|
break;
|
||||||
case f_factory_mode:
|
case f_factory_mode:
|
||||||
if (command_data[0] == 0x01)
|
enable_factory_mode(command_data[0] == 0x01);
|
||||||
layer_on(2);
|
|
||||||
else
|
|
||||||
layer_off(2);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
uprintf("Unknown factory command: %u\n", factory_command_id);
|
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) {
|
bool handle_hid(uint8_t *data, uint8_t length) {
|
||||||
uint8_t command_id = data[0];
|
uint8_t command_id = data[0];
|
||||||
uint8_t *command_data = &(data[1]);
|
uint8_t *command_data = &(data[1]);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
|
#include "factory.h"
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
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
|
KC_U, KC_V, KC_W, KC_X
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void enable_factory_mode(bool enable) {
|
||||||
|
if (enable)
|
||||||
|
layer_on(2);
|
||||||
|
else
|
||||||
|
layer_off(2);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user