fl16/macropad: Add factory mode

Factory mode enables layer 2 which has a regular keycode mapped to every
key. This way the factory can easily test whether the keys are working
or not.
It can either be disabled again or it'll turn of itself when the
keyboard resets.

Signed-off-by: Daniel Schaefer <dhs@frame.work>
This commit is contained in:
Daniel Schaefer 2023-08-08 20:21:32 +08:00
parent 9c752c120e
commit ddfb8f4934
2 changed files with 38 additions and 7 deletions

View File

@ -16,6 +16,7 @@ enum factory_commands {
f_emu_keypress = 0x01, // Next byte is keycode
f_serialnum = 0x04, // Read device serial number
f_bios_mode = 0x05, // Read device serial number
f_factory_mode = 0x06, // Read device serial number
f_bootloader = 0xFE,
};
@ -68,6 +69,12 @@ void handle_factory_command(uint8_t *data) {
else
bios_mode = false;
break;
case f_factory_mode:
if (command_data[0] == 0x01)
layer_on(2);
else
layer_off(2);
break;
default:
uprintf("Unknown factory command: %u\n", factory_command_id);
break;

View File

@ -24,7 +24,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*
* 4 keys Left Down Right
*
*
*
* 24 total
*/
[0] = LAYOUT(
@ -39,17 +39,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*
* 4 keys Esc Calc = <-
*
* 4 keys Num / * -
* 4 keys / * -
*
* 3 keys 7 8 9 +
* 4 keys 7 8 9 +
*
* 4 keys 4 5 6 +
*
* 3 keys 1 2 3 Entr
* 4 keys 1 2 3 Entr
*
* 3 keys 0 0 . Entr
*
* 21 total
* 4 keys 0 0 . Entr
*
* 24 total
*/
[1] = LAYOUT(
KC_ESC, KC_CALC, KC_EQL, KC_BSPC,
@ -58,5 +58,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_P4, KC_P5, KC_P6, KC_PPLS,
KC_P1, KC_P2, KC_P3, KC_PENT,
KC_P0, KC_P0, KC_PDOT, KC_PENT
),
/* Alphabet
*
* 4 keys A B C D
*
* 4 keys E F G H
*
* 4 keys I J K L
*
* 4 keys M N O P
*
* 4 keys Q R S T
*
* 4 keys U V W X
*
* 24 total
*/
[2] = LAYOUT(
KC_A, KC_B, KC_C, KC_D,
KC_E, KC_F, KC_G, KC_H,
KC_I, KC_J, KC_K, KC_L,
KC_M, KC_N, KC_O, KC_P,
KC_Q, KC_R, KC_S, KC_T,
KC_U, KC_V, KC_W, KC_X
)
};