Daniel Schaefer 21fd6d199c fl16: Implement BIOS mode
When enabled, overrides whatever keyboard layout and always makes the
keys in the physical location of F2, F10 and F12 send the keycodes for
F2/F10/F12.
BIOS is supposed to enable this right after USB enumeration, so that the
BIOS hot keys always work, even if FN-lock is enabled or the user has
remapped their keyboard.
BIOS mode is exited either by the keyboard resetting or by sending the
disable message.

How to send:

1. Find USB devices with Framework VID 0x32AC
2. Filter by interface number == 0x01 and usage page == 0xFF60
3. Set HID report with the following body:

Enable:  0x00 0x0B 0x05 0x01 0xFE 0xFE ... pad the 32 byte buffer with 0xFE
Disable: 0x00 0x0B 0x05 0x00 0xFE 0xFE ... pad the 32 byte buffer with 0xFE
Where the first byte is the report ID 0x00

TODO:

- [ ] Test on ANSI keyboard
- [x] Test on ISO keyboard
- [ ] Test on JIS keyboard
- [ ] Add method to get current status

Signed-off-by: Daniel Schaefer <dhs@frame.work>
2023-07-21 15:56:46 +08:00

38 lines
832 B
C

// Copyright 2022 Framework Computer
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "quantum.h"
#ifdef KEYBOARD_framework_ansi
#include "ansi.h"
#elif KEYBOARD_framework_iso
#include "iso.h"
#elif KEYBOARD_framework_jis
#include "jis.h"
#elif KEYBOARD_framework_numpad
#include "numpad.h"
#elif KEYBOARD_framework_macropad
#include "macropad.h"
#endif
enum framework_keycodes {
// Custom keycode to change screen modes (e.g. enable external screen)
KC_SCRN = SAFE_RANGE,
FN_LOCK,
};
extern bool bios_mode;
#define SLEEP_GPIO GP0
#define MUX_ENABLE_GPIO GP4
#define BOOT_DONE_GPIO GP5
// Pin SDB to enable the RGB controller
#ifdef PICO_FL16
// 22 only on RPi Pico because it doesn't have GP29
#define IS31FL3743A_ENABLE_GPIO GP22
#else
#define IS31FL3743A_ENABLE_GPIO GP29
#endif