DEBUG: Working BIOS hotkeys
Works from cold boot and from reboot in windows. Signed-off-by: Daniel Schaefer <dhs@frame.work>
This commit is contained in:
@@ -79,7 +79,7 @@ void handle_factory_command(uint8_t *data) {
|
||||
rgb_matrix_sethsv_noeeprom(0, 0, 0xFF);
|
||||
rgb_matrix_mode_noeeprom(1);
|
||||
#endif
|
||||
bios_mode = false;
|
||||
//bios_mode = false;
|
||||
writePin(GP24, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "quantum.h"
|
||||
#include "framework.h"
|
||||
#include "os_detection.h"
|
||||
|
||||
void keyboard_post_init_kb(void) {
|
||||
keyboard_post_init_user();
|
||||
@@ -65,7 +66,7 @@ void suspend_wakeup_init_kb(void) {
|
||||
}
|
||||
|
||||
// If in BIOS mode, no matter what the keys have been remapped to, always send them as the F keys
|
||||
bool bios_mode = false;
|
||||
bool bios_mode = true;
|
||||
bool handle_bios_hotkeys(uint16_t keycode, keyrecord_t *record) {
|
||||
// Not in bios mode, no special handling, handle as normal
|
||||
if (!bios_mode)
|
||||
@@ -174,6 +175,66 @@ bool handle_bios_hotkeys(uint16_t keycode, keyrecord_t *record) {
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||
process_record_user(keycode, record);
|
||||
|
||||
os_variant_t os = detected_host_os();
|
||||
#if defined(RGB_MATRIX_ENABLE)
|
||||
//rgb_matrix_mode_noeeprom(1);
|
||||
#endif
|
||||
bios_mode = true;
|
||||
writePin(GP24, 0);
|
||||
//#if defined(RGB_MATRIX_ENABLE)
|
||||
// switch (os) {
|
||||
// case OS_UNSURE:
|
||||
// //rgb_matrix_sethsv(0, 0, 255); // White
|
||||
// break;
|
||||
// case OS_LINUX:
|
||||
// bios_mode = false
|
||||
// writePin(GP24, 0);
|
||||
// // Works on laptop and android
|
||||
// //rgb_matrix_sethsv(213, 255, 255); // purple
|
||||
// break;
|
||||
// case OS_WINDOWS:
|
||||
// bios_mode = false
|
||||
// writePin(GP24, 0);
|
||||
// // works
|
||||
// //rgb_matrix_sethsv(170, 255, 255); // blue
|
||||
// break;
|
||||
// case OS_MACOS:
|
||||
// //rgb_matrix_sethsv(85, 255, 255); // green
|
||||
// break;
|
||||
// case OS_UEFI:
|
||||
// case OS_IOS:
|
||||
// bios_mode = true
|
||||
// writePin(GP24, 1)
|
||||
// // works on M1 mac
|
||||
// //rgb_matrix_sethsv(43, 255, 255); // yellow
|
||||
// break;
|
||||
// default:
|
||||
// //rgb_matrix_sethsv(125, 255, 255); // cyan
|
||||
// break;
|
||||
// }
|
||||
//#else
|
||||
switch (os) {
|
||||
case OS_UNSURE:
|
||||
break;
|
||||
case OS_LINUX:
|
||||
//bios_mode = false;
|
||||
//writePin(GP24, 1);
|
||||
break;
|
||||
case OS_WINDOWS:
|
||||
bios_mode = false;
|
||||
writePin(GP24, 1);
|
||||
break;
|
||||
case OS_MACOS:
|
||||
break;
|
||||
case OS_UEFI:
|
||||
case OS_IOS:
|
||||
bios_mode = true;
|
||||
writePin(GP24, 0);
|
||||
// works on M1 mac
|
||||
break;
|
||||
}
|
||||
//#endif
|
||||
|
||||
if (!handle_bios_hotkeys(keycode, record)) {
|
||||
return false;
|
||||
}
|
||||
@@ -233,6 +294,8 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||
default:
|
||||
return true; // Process all other keycodes normally
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool led_update_kb(led_t led_state) {
|
||||
|
||||
@@ -313,10 +313,26 @@ bool handle_idle(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
static bool rgb_init = false;
|
||||
static uint16_t rgb_init_timer = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Overriding behavior of matrix_scan from quantum/matrix.c
|
||||
*/
|
||||
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
if (!rgb_init) {
|
||||
if (!bios_mode) {
|
||||
//if (rgb_init_timer > 0 && TIMER_DIFF_16(timer_read(), rgb_init_timer) >= 10000) {
|
||||
//if (rgb_init_timer > 0 && TIMER_DIFF_16(timer_read(), rgb_init_timer) >= 100) {
|
||||
//if (!bios_mode || rgb_init_timer > 0 && TIMER_DIFF_16(timer_read(), rgb_init_timer) >= 10000) {
|
||||
rgb_matrix_init();
|
||||
rgb_init = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
bool changed = false;
|
||||
|
||||
adc10ksample_t voltages[MATRIX_ROWS][MATRIX_COLS] = {};
|
||||
@@ -436,4 +452,8 @@ void matrix_init_custom(void) {
|
||||
// Set unused pins to input to avoid interfering. They're hooked up to rows 5 and 6
|
||||
setPinInput(GP6);
|
||||
setPinInput(GP7);
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
rgb_init_timer = timer_read();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@ RAW_ENABLE = no
|
||||
BACKLIGHT_ENABLE = yes
|
||||
BACKLIGHT_DRIVER = pwm
|
||||
|
||||
OS_DETECTION_ENABLE = yes
|
||||
#OS_DETECTION_DEBUG_ENABLE = yes
|
||||
|
||||
# Custom matrix scanning code via ADC
|
||||
CUSTOM_MATRIX = lite
|
||||
SRC += matrix.c analog.c
|
||||
|
||||
Reference in New Issue
Block a user