Basic mac vs linux modes
This commit is contained in:
31
keymaps/custom/os_detect.c
Normal file
31
keymaps/custom/os_detect.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "os_detection.h"
|
||||
#include "timer.h"
|
||||
#include "rgb_matrix.h"
|
||||
|
||||
#include "mac_mode.h"
|
||||
|
||||
bool mac_mode = false;
|
||||
bool mac_mode_manual = false;
|
||||
static bool os_detected = false;
|
||||
static uint32_t flash_start = 0;
|
||||
|
||||
// Poll OS detection after USB enumeration settles (~2s)
|
||||
// Flash indicator color for 500ms then restore default animation
|
||||
void matrix_scan_user(void) {
|
||||
if (!os_detected && !mac_mode_manual && timer_elapsed32(0) > 2000) {
|
||||
os_detected = true;
|
||||
os_variant_t os = detected_host_os();
|
||||
mac_mode = (os == OS_MACOS || os == OS_IOS);
|
||||
rgb_matrix_mode_noeeprom(RGB_MATRIX_SOLID_COLOR);
|
||||
if (mac_mode) {
|
||||
rgb_matrix_sethsv_noeeprom(HSV_GREEN);
|
||||
} else {
|
||||
rgb_matrix_sethsv_noeeprom(HSV_BLUE);
|
||||
}
|
||||
flash_start = timer_read32();
|
||||
}
|
||||
if (flash_start && timer_elapsed32(flash_start) > 500) {
|
||||
flash_start = 0;
|
||||
rgb_matrix_reload_from_eeprom();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user