void eeprom_init(void) { if(erb(EE_MAGIC_OFFSET) != VERSION_1 || erb(EE_MAGIC_OFFSET+1) != VERSION_2) eeprom_factory_reset(0); led_mode = erb(EE_LED); #ifdef XLED switch (led_mode) { case 0: xled_pattern = 0; break; case 1: xled_pattern = 0xffff; break; case 2: xled_pattern = 0xff00; break; case 3: xled_pattern = 0xa000; break; case 4: xled_pattern = 0xaa00; break; } #endif #ifdef HAS_SLEEP sleep_time = erb(EE_SLEEPTIME); #endif }
// Set up the EEPROM system for use and read out the settings into the // global values. // // This includes checking the layout version and, if the version tag written // to the EEPROM doesn't match this software version we're running, we reset // the EEPROM values to their default settings. // void eeprom_setup(void) { // If our EEPROM layout has changed, reset everything. if (eeprom_read(EE_EEPROM_VERSION) != EEPROM_VERSION) { eeprom_factory_reset(); } // Read the EEPROM into the global settings. g_self_test_passed = eeprom_read(EE_FIRST_BOOT_CHECK); g_midi_channel = eeprom_read(EE_MIDI_CHANNEL); g_midi_velocity = eeprom_read(EE_MIDI_VELOCITY); g_led_keypress_enable = eeprom_read(EE_KEY_KEYPRESS_LED); g_key_fourbanks_mode = eeprom_read(EE_KEY_FOURBANKS); //g_exp_digital_read = eeprom_read(EE_EXP_DIGITAL_ENABLED); //g_exp_analog_read = eeprom_read(EE_EXP_ANALOG_ENABLED); g_auto_update = eeprom_read(EE_AUTO_UPDATE); g_device_mode = eeprom_read(EE_DEVICE_MODE); g_combos_enable = eeprom_read(EE_COMBOS_ENABLE); //g_multiplexer_enable = eeprom_read(EE_MULTIPLEXER_ENABLE); g_rotate_enable = eeprom_read(EE_ROTATE_ENABLE); }