You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.9 KiB
57 lines
1.9 KiB
10 years ago
|
#include <stdint.h>
|
||
|
#include <stdbool.h>
|
||
9 years ago
|
#include "eeprom.h"
|
||
10 years ago
|
#include "eeconfig.h"
|
||
|
|
||
|
void eeconfig_init(void)
|
||
|
{
|
||
9 years ago
|
eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER);
|
||
|
eeprom_update_byte(EECONFIG_DEBUG, 0);
|
||
|
eeprom_update_byte(EECONFIG_DEFAULT_LAYER, 0);
|
||
|
eeprom_update_byte(EECONFIG_KEYMAP, 0);
|
||
|
eeprom_update_byte(EECONFIG_MOUSEKEY_ACCEL, 0);
|
||
10 years ago
|
#ifdef BACKLIGHT_ENABLE
|
||
9 years ago
|
eeprom_update_byte(EECONFIG_BACKLIGHT, 0);
|
||
10 years ago
|
#endif
|
||
9 years ago
|
#ifdef AUDIO_ENABLE
|
||
9 years ago
|
eeprom_update_byte(EECONFIG_AUDIO, 0xFF); // On by default
|
||
|
#endif
|
||
|
#ifdef RGBLIGHT_ENABLE
|
||
|
eeprom_update_dword(EECONFIG_RGBLIGHT, 0);
|
||
9 years ago
|
#endif
|
||
10 years ago
|
}
|
||
|
|
||
|
void eeconfig_enable(void)
|
||
|
{
|
||
9 years ago
|
eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER);
|
||
10 years ago
|
}
|
||
|
|
||
|
void eeconfig_disable(void)
|
||
|
{
|
||
9 years ago
|
eeprom_update_word(EECONFIG_MAGIC, 0xFFFF);
|
||
10 years ago
|
}
|
||
|
|
||
|
bool eeconfig_is_enabled(void)
|
||
|
{
|
||
|
return (eeprom_read_word(EECONFIG_MAGIC) == EECONFIG_MAGIC_NUMBER);
|
||
|
}
|
||
|
|
||
|
uint8_t eeconfig_read_debug(void) { return eeprom_read_byte(EECONFIG_DEBUG); }
|
||
9 years ago
|
void eeconfig_update_debug(uint8_t val) { eeprom_update_byte(EECONFIG_DEBUG, val); }
|
||
10 years ago
|
|
||
|
uint8_t eeconfig_read_default_layer(void) { return eeprom_read_byte(EECONFIG_DEFAULT_LAYER); }
|
||
9 years ago
|
void eeconfig_update_default_layer(uint8_t val) { eeprom_update_byte(EECONFIG_DEFAULT_LAYER, val); }
|
||
10 years ago
|
|
||
|
uint8_t eeconfig_read_keymap(void) { return eeprom_read_byte(EECONFIG_KEYMAP); }
|
||
9 years ago
|
void eeconfig_update_keymap(uint8_t val) { eeprom_update_byte(EECONFIG_KEYMAP, val); }
|
||
10 years ago
|
|
||
|
#ifdef BACKLIGHT_ENABLE
|
||
|
uint8_t eeconfig_read_backlight(void) { return eeprom_read_byte(EECONFIG_BACKLIGHT); }
|
||
9 years ago
|
void eeconfig_update_backlight(uint8_t val) { eeprom_update_byte(EECONFIG_BACKLIGHT, val); }
|
||
10 years ago
|
#endif
|
||
9 years ago
|
|
||
|
#ifdef AUDIO_ENABLE
|
||
|
uint8_t eeconfig_read_audio(void) { return eeprom_read_byte(EECONFIG_AUDIO); }
|
||
9 years ago
|
void eeconfig_update_audio(uint8_t val) { eeprom_update_byte(EECONFIG_AUDIO, val); }
|
||
|
#endif
|