From 620ac4b260fa663d12b11a0b15ac50379523c125 Mon Sep 17 00:00:00 2001 From: Eric Tang Date: Thu, 21 Apr 2016 19:35:18 -0700 Subject: [PATCH] Update functions used to write to EEPROM --- keyboard/atomic/keymaps/pvc/keymap.c | 2 +- keyboard/hhkb/rn42/rn42_task.c | 2 +- keyboard/planck/keymaps/default/keymap.c | 4 +-- keyboard/preonic/keymaps/default/keymap.c | 2 +- quantum/audio/audio.c | 6 ++-- quantum/keymap_common.c | 2 +- quantum/rgblight.c | 20 ++++++------- quantum/rgblight.h | 4 +-- tmk_core/common/avr/eeconfig.c | 30 +++++++++---------- tmk_core/common/backlight.c | 10 +++---- tmk_core/common/bootmagic.c | 6 ++-- tmk_core/common/eeconfig.h | 10 +++---- .../LUFA-git/Bootloaders/CDC/BootloaderCDC.c | 4 +-- .../LUFA-git/Bootloaders/DFU/BootloaderDFU.c | 2 +- 14 files changed, 52 insertions(+), 52 deletions(-) diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c index 36098f1e..95a26c5b 100644 --- a/keyboard/atomic/keymaps/pvc/keymap.c +++ b/keyboard/atomic/keymaps/pvc/keymap.c @@ -233,7 +233,7 @@ void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t l void persistant_default_layer_set(uint16_t default_layer) { - eeconfig_write_default_layer(default_layer); + eeconfig_update_default_layer(default_layer); default_layer_set(default_layer); } diff --git a/keyboard/hhkb/rn42/rn42_task.c b/keyboard/hhkb/rn42/rn42_task.c index 5107fef4..84001b3f 100644 --- a/keyboard/hhkb/rn42/rn42_task.c +++ b/keyboard/hhkb/rn42/rn42_task.c @@ -219,7 +219,7 @@ static void store_link(uint8_t *eeaddr) xprintf("%s(%d)\r\n", s, strlen(s)); if (strlen(s) == 12) { for (int i = 0; i < 12; i++) { - eeprom_write_byte(eeaddr+i, *(s+i)); + eeprom_update_byte(eeaddr+i, *(s+i)); dprintf("%c ", *(s+i)); } dprint("\r\n"); diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c index 3239dda7..19d24f6a 100644 --- a/keyboard/planck/keymaps/default/keymap.c +++ b/keyboard/planck/keymaps/default/keymap.c @@ -211,7 +211,7 @@ float goodbye[][2] = SONG(GOODBYE_SOUND); void persistant_default_layer_set(uint16_t default_layer) { - eeconfig_write_default_layer(default_layer); + eeconfig_update_default_layer(default_layer); default_layer_set(default_layer); } @@ -315,7 +315,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) } keymap_config.raw = eeconfig_read_keymap(); keymap_config.nkro = 1; - eeconfig_write_keymap(keymap_config.raw); + eeconfig_update_keymap(keymap_config.raw); } break; case 11: diff --git a/keyboard/preonic/keymaps/default/keymap.c b/keyboard/preonic/keymaps/default/keymap.c index f0d5ed60..3a6dfa31 100644 --- a/keyboard/preonic/keymaps/default/keymap.c +++ b/keyboard/preonic/keymaps/default/keymap.c @@ -200,7 +200,7 @@ float goodbye[][2] = SONG(GOODBYE_SOUND); #endif void persistant_default_layer_set(uint16_t default_layer) { - eeconfig_write_default_layer(default_layer); + eeconfig_update_default_layer(default_layer); default_layer_set(default_layer); } diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c index 3225557b..e85370d9 100644 --- a/quantum/audio/audio.c +++ b/quantum/audio/audio.c @@ -85,17 +85,17 @@ uint16_t envelope_index = 0; void audio_toggle(void) { audio_config.enable ^= 1; - eeconfig_write_audio(audio_config.raw); + eeconfig_update_audio(audio_config.raw); } void audio_on(void) { audio_config.enable = 1; - eeconfig_write_audio(audio_config.raw); + eeconfig_update_audio(audio_config.raw); } void audio_off(void) { audio_config.enable = 0; - eeconfig_write_audio(audio_config.raw); + eeconfig_update_audio(audio_config.raw); } #ifdef VIBRATO_ENABLE diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index 43debf4e..4b4bd621 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -245,7 +245,7 @@ static action_t keycode_to_action(uint16_t keycode) keymap_config.swap_lalt_lgui = 0; keymap_config.swap_ralt_rgui = 0; } - eeconfig_write_keymap(keymap_config.raw); + eeconfig_update_keymap(keymap_config.raw); break; case 0x5100 ... 0x5FFF: ; // Layer movement shortcuts diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 2215cf5c..5623c65d 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -107,17 +107,17 @@ void setrgb(uint8_t r, uint8_t g, uint8_t b, struct cRGB *led1) { uint32_t eeconfig_read_rgblight(void) { return eeprom_read_dword(EECONFIG_RGBLIGHT); } -void eeconfig_write_rgblight(uint32_t val) { - eeprom_write_dword(EECONFIG_RGBLIGHT, val); +void eeconfig_update_rgblight(uint32_t val) { + eeprom_update_dword(EECONFIG_RGBLIGHT, val); } -void eeconfig_write_rgblight_default(void) { - dprintf("eeconfig_write_rgblight_default\n"); +void eeconfig_update_rgblight_default(void) { + dprintf("eeconfig_update_rgblight_default\n"); rgblight_config.enable = 1; rgblight_config.mode = 1; rgblight_config.hue = 200; rgblight_config.sat = 204; rgblight_config.val = 204; - eeconfig_write_rgblight(rgblight_config.raw); + eeconfig_update_rgblight(rgblight_config.raw); } void eeconfig_debug_rgblight(void) { dprintf("rgblight_config eprom\n"); @@ -136,12 +136,12 @@ void rgblight_init(void) { if (!eeconfig_is_enabled()) { dprintf("rgblight_init eeconfig is not enabled.\n"); eeconfig_init(); - eeconfig_write_rgblight_default(); + eeconfig_update_rgblight_default(); } rgblight_config.raw = eeconfig_read_rgblight(); if (!rgblight_config.mode) { dprintf("rgblight_init rgblight_config.mode = 0. Write default values to EEPROM.\n"); - eeconfig_write_rgblight_default(); + eeconfig_update_rgblight_default(); rgblight_config.raw = eeconfig_read_rgblight(); } eeconfig_debug_rgblight(); // display current eeprom values @@ -189,7 +189,7 @@ void rgblight_mode(uint8_t mode) { } else { rgblight_config.mode = mode; } - eeconfig_write_rgblight(rgblight_config.raw); + eeconfig_update_rgblight(rgblight_config.raw); dprintf("rgblight mode: %u\n", rgblight_config.mode); if (rgblight_config.mode == 1) { rgblight_timer_disable(); @@ -206,7 +206,7 @@ void rgblight_mode(uint8_t mode) { void rgblight_toggle(void) { rgblight_config.enable ^= 1; - eeconfig_write_rgblight(rgblight_config.raw); + eeconfig_update_rgblight(rgblight_config.raw); dprintf("rgblight toggle: rgblight_config.enable = %u\n", rgblight_config.enable); if (rgblight_config.enable) { rgblight_mode(rgblight_config.mode); @@ -299,7 +299,7 @@ void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val){ rgblight_config.hue = hue; rgblight_config.sat = sat; rgblight_config.val = val; - eeconfig_write_rgblight(rgblight_config.raw); + eeconfig_update_rgblight(rgblight_config.raw); dprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); } } diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 9e156232..37e20757 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -66,8 +66,8 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b); #define EECONFIG_RGBLIGHT (uint8_t *)7 uint32_t eeconfig_read_rgblight(void); -void eeconfig_write_rgblight(uint32_t val); -void eeconfig_write_rgblight_default(void); +void eeconfig_update_rgblight(uint32_t val); +void eeconfig_update_rgblight_default(void); void eeconfig_debug_rgblight(void); void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1); diff --git a/tmk_core/common/avr/eeconfig.c b/tmk_core/common/avr/eeconfig.c index 25bb9e84..c5391f5c 100644 --- a/tmk_core/common/avr/eeconfig.c +++ b/tmk_core/common/avr/eeconfig.c @@ -5,27 +5,27 @@ void eeconfig_init(void) { - eeprom_write_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); - eeprom_write_byte(EECONFIG_DEBUG, 0); - eeprom_write_byte(EECONFIG_DEFAULT_LAYER, 0); - eeprom_write_byte(EECONFIG_KEYMAP, 0); - eeprom_write_byte(EECONFIG_MOUSEKEY_ACCEL, 0); + 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); #ifdef BACKLIGHT_ENABLE - eeprom_write_byte(EECONFIG_BACKLIGHT, 0); + eeprom_update_byte(EECONFIG_BACKLIGHT, 0); #endif #ifdef AUDIO_ENABLE - eeprom_write_byte(EECONFIG_AUDIO, 0xFF); // On by default + eeprom_update_byte(EECONFIG_AUDIO, 0xFF); // On by default #endif } void eeconfig_enable(void) { - eeprom_write_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); + eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); } void eeconfig_disable(void) { - eeprom_write_word(EECONFIG_MAGIC, 0xFFFF); + eeprom_update_word(EECONFIG_MAGIC, 0xFFFF); } bool eeconfig_is_enabled(void) @@ -34,20 +34,20 @@ bool eeconfig_is_enabled(void) } uint8_t eeconfig_read_debug(void) { return eeprom_read_byte(EECONFIG_DEBUG); } -void eeconfig_write_debug(uint8_t val) { eeprom_write_byte(EECONFIG_DEBUG, val); } +void eeconfig_update_debug(uint8_t val) { eeprom_update_byte(EECONFIG_DEBUG, val); } uint8_t eeconfig_read_default_layer(void) { return eeprom_read_byte(EECONFIG_DEFAULT_LAYER); } -void eeconfig_write_default_layer(uint8_t val) { eeprom_write_byte(EECONFIG_DEFAULT_LAYER, val); } +void eeconfig_update_default_layer(uint8_t val) { eeprom_update_byte(EECONFIG_DEFAULT_LAYER, val); } uint8_t eeconfig_read_keymap(void) { return eeprom_read_byte(EECONFIG_KEYMAP); } -void eeconfig_write_keymap(uint8_t val) { eeprom_write_byte(EECONFIG_KEYMAP, val); } +void eeconfig_update_keymap(uint8_t val) { eeprom_update_byte(EECONFIG_KEYMAP, val); } #ifdef BACKLIGHT_ENABLE uint8_t eeconfig_read_backlight(void) { return eeprom_read_byte(EECONFIG_BACKLIGHT); } -void eeconfig_write_backlight(uint8_t val) { eeprom_write_byte(EECONFIG_BACKLIGHT, val); } +void eeconfig_update_backlight(uint8_t val) { eeprom_update_byte(EECONFIG_BACKLIGHT, val); } #endif #ifdef AUDIO_ENABLE uint8_t eeconfig_read_audio(void) { return eeprom_read_byte(EECONFIG_AUDIO); } -void eeconfig_write_audio(uint8_t val) { eeprom_write_byte(EECONFIG_AUDIO, val); } -#endif \ No newline at end of file +void eeconfig_update_audio(uint8_t val) { eeprom_update_byte(EECONFIG_AUDIO, val); } +#endif diff --git a/tmk_core/common/backlight.c b/tmk_core/common/backlight.c index 558ad9b0..2f6fc1cd 100644 --- a/tmk_core/common/backlight.c +++ b/tmk_core/common/backlight.c @@ -37,7 +37,7 @@ void backlight_increase(void) { backlight_config.level++; backlight_config.enable = 1; - eeconfig_write_backlight(backlight_config.raw); + eeconfig_update_backlight(backlight_config.raw); } dprintf("backlight increase: %u\n", backlight_config.level); backlight_set(backlight_config.level); @@ -49,7 +49,7 @@ void backlight_decrease(void) { backlight_config.level--; backlight_config.enable = !!backlight_config.level; - eeconfig_write_backlight(backlight_config.raw); + eeconfig_update_backlight(backlight_config.raw); } dprintf("backlight decrease: %u\n", backlight_config.level); backlight_set(backlight_config.level); @@ -58,7 +58,7 @@ void backlight_decrease(void) void backlight_toggle(void) { backlight_config.enable ^= 1; - eeconfig_write_backlight(backlight_config.raw); + eeconfig_update_backlight(backlight_config.raw); dprintf("backlight toggle: %u\n", backlight_config.enable); backlight_set(backlight_config.enable ? backlight_config.level : 0); } @@ -71,7 +71,7 @@ void backlight_step(void) backlight_config.level = 0; } backlight_config.enable = !!backlight_config.level; - eeconfig_write_backlight(backlight_config.raw); + eeconfig_update_backlight(backlight_config.raw); dprintf("backlight step: %u\n", backlight_config.level); backlight_set(backlight_config.level); } @@ -80,6 +80,6 @@ void backlight_level(uint8_t level) { backlight_config.level ^= level; backlight_config.enable = !!backlight_config.level; - eeconfig_write_backlight(backlight_config.raw); + eeconfig_update_backlight(backlight_config.raw); backlight_set(backlight_config.level); } diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c index b002a585..2c1b1adf 100644 --- a/tmk_core/common/bootmagic.c +++ b/tmk_core/common/bootmagic.c @@ -52,7 +52,7 @@ void bootmagic(void) debug_config.enable = !debug_config.enable; } } - eeconfig_write_debug(debug_config.raw); + eeconfig_update_debug(debug_config.raw); /* keymap config */ keymap_config.raw = eeconfig_read_keymap(); @@ -80,7 +80,7 @@ void bootmagic(void) if (bootmagic_scan_keycode(BOOTMAGIC_HOST_NKRO)) { keymap_config.nkro = !keymap_config.nkro; } - eeconfig_write_keymap(keymap_config.raw); + eeconfig_update_keymap(keymap_config.raw); #ifdef NKRO_ENABLE keyboard_nkro = keymap_config.nkro; @@ -97,7 +97,7 @@ void bootmagic(void) if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_6)) { default_layer |= (1<<6); } if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_7)) { default_layer |= (1<<7); } if (default_layer) { - eeconfig_write_default_layer(default_layer); + eeconfig_update_default_layer(default_layer); default_layer_set((uint32_t)default_layer); } else { default_layer = eeconfig_read_default_layer(); diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h index ddefca13..ca47e0d2 100644 --- a/tmk_core/common/eeconfig.h +++ b/tmk_core/common/eeconfig.h @@ -60,22 +60,22 @@ void eeconfig_enable(void); void eeconfig_disable(void); uint8_t eeconfig_read_debug(void); -void eeconfig_write_debug(uint8_t val); +void eeconfig_update_debug(uint8_t val); uint8_t eeconfig_read_default_layer(void); -void eeconfig_write_default_layer(uint8_t val); +void eeconfig_update_default_layer(uint8_t val); uint8_t eeconfig_read_keymap(void); -void eeconfig_write_keymap(uint8_t val); +void eeconfig_update_keymap(uint8_t val); #ifdef BACKLIGHT_ENABLE uint8_t eeconfig_read_backlight(void); -void eeconfig_write_backlight(uint8_t val); +void eeconfig_update_backlight(uint8_t val); #endif #ifdef AUDIO_ENABLE uint8_t eeconfig_read_audio(void); -void eeconfig_write_audio(uint8_t val); +void eeconfig_update_audio(uint8_t val); #endif #endif diff --git a/tmk_core/protocol/lufa/LUFA-git/Bootloaders/CDC/BootloaderCDC.c b/tmk_core/protocol/lufa/LUFA-git/Bootloaders/CDC/BootloaderCDC.c index f66a483e..58bb3389 100644 --- a/tmk_core/protocol/lufa/LUFA-git/Bootloaders/CDC/BootloaderCDC.c +++ b/tmk_core/protocol/lufa/LUFA-git/Bootloaders/CDC/BootloaderCDC.c @@ -327,7 +327,7 @@ static void ReadWriteMemoryBlock(const uint8_t Command) else { /* Write the next EEPROM byte from the endpoint */ - eeprom_write_byte((uint8_t*)((intptr_t)(CurrAddress >> 1)), FetchNextCommandByte()); + eeprom_update_byte((uint8_t*)((intptr_t)(CurrAddress >> 1)), FetchNextCommandByte()); /* Increment the address counter after use */ CurrAddress += 2; @@ -581,7 +581,7 @@ static void CDC_Task(void) else if (Command == AVR109_COMMAND_WriteEEPROM) { /* Read the byte from the endpoint and write it to the EEPROM */ - eeprom_write_byte((uint8_t*)((intptr_t)(CurrAddress >> 1)), FetchNextCommandByte()); + eeprom_update_byte((uint8_t*)((intptr_t)(CurrAddress >> 1)), FetchNextCommandByte()); /* Increment the address after use */ CurrAddress += 2; diff --git a/tmk_core/protocol/lufa/LUFA-git/Bootloaders/DFU/BootloaderDFU.c b/tmk_core/protocol/lufa/LUFA-git/Bootloaders/DFU/BootloaderDFU.c index 0385bfc4..00e67326 100644 --- a/tmk_core/protocol/lufa/LUFA-git/Bootloaders/DFU/BootloaderDFU.c +++ b/tmk_core/protocol/lufa/LUFA-git/Bootloaders/DFU/BootloaderDFU.c @@ -370,7 +370,7 @@ void EVENT_USB_Device_ControlRequest(void) } /* Read the byte from the USB interface and write to to the EEPROM */ - eeprom_write_byte((uint8_t*)StartAddr, Endpoint_Read_8()); + eeprom_update_byte((uint8_t*)StartAddr, Endpoint_Read_8()); /* Adjust counters */ StartAddr++;