fl16: cleanup
Signed-off-by: Daniel Schaefer <dhs@frame.work>
This commit is contained in:
parent
d3bbd0beef
commit
05798c19c1
@ -66,21 +66,9 @@ void handle_factory_command(uint8_t *data) {
|
|||||||
break;
|
break;
|
||||||
case f_bios_mode:
|
case f_bios_mode:
|
||||||
if (command_data[0] == 0x01) {
|
if (command_data[0] == 0x01) {
|
||||||
bios_mode = true;
|
set_bios_mode(true);
|
||||||
// Red
|
|
||||||
#if defined(RGB_MATRIX_ENABLE)
|
|
||||||
rgb_matrix_sethsv_noeeprom(0, 0xFF, 0xFF);
|
|
||||||
rgb_matrix_mode_noeeprom(1);
|
|
||||||
#endif
|
|
||||||
writePin(GP24, 1);
|
|
||||||
} else {
|
} else {
|
||||||
// White
|
set_bios_mode(false);
|
||||||
#if defined(RGB_MATRIX_ENABLE)
|
|
||||||
rgb_matrix_sethsv_noeeprom(0, 0, 0xFF);
|
|
||||||
rgb_matrix_mode_noeeprom(1);
|
|
||||||
#endif
|
|
||||||
//bios_mode = false;
|
|
||||||
writePin(GP24, 0);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case f_factory_mode:
|
case f_factory_mode:
|
||||||
|
@ -67,6 +67,27 @@ 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
|
// If in BIOS mode, no matter what the keys have been remapped to, always send them as the F keys
|
||||||
bool bios_mode = true;
|
bool bios_mode = true;
|
||||||
|
void set_bios_mode(bool val) {
|
||||||
|
bios_mode = val;
|
||||||
|
|
||||||
|
#ifdef BIOS_HOTKEY_DEBUG
|
||||||
|
if (bios_mode) {
|
||||||
|
// Red
|
||||||
|
#if defined(RGB_MATRIX_ENABLE)
|
||||||
|
rgb_matrix_sethsv_noeeprom(0, 0xFF, 0xFF);
|
||||||
|
rgb_matrix_mode_noeeprom(1);
|
||||||
|
#endif
|
||||||
|
writePin(GP24, 1);
|
||||||
|
} else {
|
||||||
|
// White
|
||||||
|
#if defined(RGB_MATRIX_ENABLE)
|
||||||
|
rgb_matrix_sethsv_noeeprom(0, 0, 0xFF);
|
||||||
|
rgb_matrix_mode_noeeprom(1);
|
||||||
|
#endif
|
||||||
|
writePin(GP24, 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
bool handle_bios_hotkeys(uint16_t keycode, keyrecord_t *record) {
|
bool handle_bios_hotkeys(uint16_t keycode, keyrecord_t *record) {
|
||||||
// Not in bios mode, no special handling, handle as normal
|
// Not in bios mode, no special handling, handle as normal
|
||||||
if (!bios_mode)
|
if (!bios_mode)
|
||||||
@ -176,11 +197,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
|||||||
process_record_user(keycode, record);
|
process_record_user(keycode, record);
|
||||||
|
|
||||||
os_variant_t os = detected_host_os();
|
os_variant_t os = detected_host_os();
|
||||||
#if defined(RGB_MATRIX_ENABLE)
|
set_bios_mode(true);
|
||||||
//rgb_matrix_mode_noeeprom(1);
|
|
||||||
#endif
|
|
||||||
bios_mode = true;
|
|
||||||
writePin(GP24, 0);
|
|
||||||
//#if defined(RGB_MATRIX_ENABLE)
|
//#if defined(RGB_MATRIX_ENABLE)
|
||||||
// switch (os) {
|
// switch (os) {
|
||||||
// case OS_UNSURE:
|
// case OS_UNSURE:
|
||||||
@ -217,19 +234,16 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
|||||||
case OS_UNSURE:
|
case OS_UNSURE:
|
||||||
break;
|
break;
|
||||||
case OS_LINUX:
|
case OS_LINUX:
|
||||||
bios_mode = false;
|
set_bios_mode(false);
|
||||||
writePin(GP24, 1);
|
|
||||||
break;
|
break;
|
||||||
case OS_WINDOWS:
|
case OS_WINDOWS:
|
||||||
bios_mode = false;
|
set_bios_mode(false);
|
||||||
writePin(GP24, 1);
|
|
||||||
break;
|
break;
|
||||||
case OS_MACOS:
|
case OS_MACOS:
|
||||||
break;
|
break;
|
||||||
case OS_UEFI:
|
case OS_UEFI:
|
||||||
case OS_IOS:
|
case OS_IOS:
|
||||||
bios_mode = true;
|
set_bios_mode(true);
|
||||||
writePin(GP24, 0);
|
|
||||||
// works on M1 mac
|
// works on M1 mac
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,12 @@ enum framework_keycodes {
|
|||||||
|
|
||||||
extern bool bios_mode;
|
extern bool bios_mode;
|
||||||
|
|
||||||
|
// Uncomment this to show hotkey mode with capslock LED and backlight
|
||||||
|
// hotkey mode on: capslock ON, RGB red
|
||||||
|
// hotkey mode off: capslock OFF, RGB white
|
||||||
|
//#define BIOS_HOTKEY_DEBUG
|
||||||
|
void set_bios_mode(bool val);
|
||||||
|
|
||||||
#define SLEEP_GPIO GP0
|
#define SLEEP_GPIO GP0
|
||||||
#define MUX_ENABLE_GPIO GP4
|
#define MUX_ENABLE_GPIO GP4
|
||||||
#define BOOT_DONE_GPIO GP5
|
#define BOOT_DONE_GPIO GP5
|
||||||
|
@ -313,26 +313,10 @@ bool handle_idle(void) {
|
|||||||
return false;
|
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
|
* Overriding behavior of matrix_scan from quantum/matrix.c
|
||||||
*/
|
*/
|
||||||
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
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;
|
bool changed = false;
|
||||||
|
|
||||||
adc10ksample_t voltages[MATRIX_ROWS][MATRIX_COLS] = {};
|
adc10ksample_t voltages[MATRIX_ROWS][MATRIX_COLS] = {};
|
||||||
@ -452,8 +436,4 @@ void matrix_init_custom(void) {
|
|||||||
// Set unused pins to input to avoid interfering. They're hooked up to rows 5 and 6
|
// Set unused pins to input to avoid interfering. They're hooked up to rows 5 and 6
|
||||||
setPinInput(GP6);
|
setPinInput(GP6);
|
||||||
setPinInput(GP7);
|
setPinInput(GP7);
|
||||||
|
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
|
||||||
rgb_init_timer = timer_read();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -54,10 +54,6 @@ void make_guess(void) {
|
|||||||
//if (setups_data.count < 3 && setups_data.cnt_zoid != 0) {
|
//if (setups_data.count < 3 && setups_data.cnt_zoid != 0) {
|
||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
//if (setups_data.cnt_zoid == 0) {
|
|
||||||
// detected_os = OS_UEFI;
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
if (setups_data.cnt_zoid == 0) {
|
if (setups_data.cnt_zoid == 0) {
|
||||||
detected_os = OS_UEFI;
|
detected_os = OS_UEFI;
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user