diff options
| author | Nicholas Keene <git@nicholaskeene.com> | 2016-05-02 21:35:58 -0500 | 
|---|---|---|
| committer | Nicholas Keene <git@nicholaskeene.com> | 2016-05-02 21:35:58 -0500 | 
| commit | 8b0274f60a47eae523e28b5a7c6c7f581b6d605a (patch) | |
| tree | b8c6194d89712ddaf5e22aef85274c12c53cb2f1 /tmk_core/common/avr | |
| parent | 1076c2b1226ed049a364971bf8e1edcd9ed45f6d (diff) | |
| parent | 2c070163ffffffde546fb00acaa2fbb96b93da64 (diff) | |
Merge branch 'master' of https://github.com/jackhumbert/qmk_firmware
Diffstat (limited to 'tmk_core/common/avr')
| -rw-r--r-- | tmk_core/common/avr/eeconfig.c | 32 | ||||
| -rw-r--r-- | tmk_core/common/avr/suspend.c | 18 | 
2 files changed, 36 insertions, 14 deletions
diff --git a/tmk_core/common/avr/eeconfig.c b/tmk_core/common/avr/eeconfig.c index 5bd47dc6ad..c5391f5cf5 100644 --- a/tmk_core/common/avr/eeconfig.c +++ b/tmk_core/common/avr/eeconfig.c @@ -5,24 +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_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) @@ -31,15 +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_update_audio(uint8_t val) { eeprom_update_byte(EECONFIG_AUDIO, val); }  #endif diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index caf0b06254..4980680198 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c @@ -9,10 +9,16 @@  #include "suspend.h"  #include "timer.h"  #include "led.h" +  #ifdef PROTOCOL_LUFA -#include "lufa.h" +	#include "lufa.h"  #endif +#ifdef AUDIO_ENABLE +    #include "audio.h" +#endif /* AUDIO_ENABLE */ + +  #define wdt_intr_enable(value)   \  __asm__ __volatile__ (  \ @@ -66,9 +72,17 @@ static void power_down(uint8_t wdto)      wdt_intr_enable(wdto);  #ifdef BACKLIGHT_ENABLE -backlight_set(0); +	backlight_set(0);  #endif +	// Turn off LED indicators +	led_set(0); + +	#ifdef AUDIO_ENABLE +        // This sometimes disables the start-up noise, so it's been disabled +		// stop_all_notes(); +	#endif /* AUDIO_ENABLE */ +      // TODO: more power saving      // See PicoPower application note      // - I/O port input with pullup  | 
