void matrix_init_kb(void) { bootmagic_lite(); // If the EEPROM has the magic, the data is good. // OK to load from EEPROM. if (eeprom_is_valid()) { backlight_config_load(); // TODO: do something to "turn on" keymaps in EEPROM? } else { // If the EEPROM has not been saved before, or is out of date, // save the default values to the EEPROM. Default values // come from construction of the zeal_backlight_config instance. backlight_config_save(); // Clear the LED colors stored in EEPROM for ( int row=0; row < MATRIX_ROWS; row++ ) { HSV hsv; for ( int column=0; column < MATRIX_COLS; column++ ) { hsv.h = rand() & 0xFF; hsv.s = rand() & 0x7F; hsv.v = 255; backlight_set_key_color( row, column, hsv ); } } // This saves "empty" keymaps so it falls back to the keymaps // in the firmware (aka. progmem/flash) keymap_default_save(); // Save the magic number last, in case saving was interrupted eeprom_set_valid(true); } // Initialize LED drivers for backlight. backlight_init_drivers(); backlight_timer_init(); backlight_timer_enable(); matrix_init_user(); }
void matrix_init_quantum() { #ifdef BOOTMAGIC_LITE bootmagic_lite(); #endif if (!eeconfig_is_enabled()) { eeconfig_init(); } #ifdef BACKLIGHT_ENABLE backlight_init_ports(); #endif #ifdef AUDIO_ENABLE audio_init(); #endif #ifdef RGB_MATRIX_ENABLE rgb_matrix_init(); #endif #ifdef ENCODER_ENABLE encoder_init(); #endif matrix_init_kb(); }