avr/suspend: Add DISABLE_AVR_DEEP_SLEEP option

This commit is contained in:
Jay Greco 2023-03-21 03:43:56 +00:00
parent 50b12ece13
commit ae97f31d23
5 changed files with 10 additions and 4 deletions

View File

@ -74,6 +74,7 @@ OTHER_OPTION_NAMES = \
WATCHDOG_ENABLE \ WATCHDOG_ENABLE \
ERGOINU \ ERGOINU \
NO_USB_STARTUP_CHECK \ NO_USB_STARTUP_CHECK \
DISABLE_AVR_DEEP_SLEEP \
DISABLE_PROMICRO_LEDs \ DISABLE_PROMICRO_LEDs \
MITOSIS_DATAGROK_BOTTOMSPACE \ MITOSIS_DATAGROK_BOTTOMSPACE \
MITOSIS_DATAGROK_SLOWUART \ MITOSIS_DATAGROK_SLOWUART \

View File

@ -29,6 +29,7 @@
"COMBO_TERM": {"info_key": "combo.term", "value_type": "int"}, "COMBO_TERM": {"info_key": "combo.term", "value_type": "int"},
"DEBOUNCE": {"info_key": "debounce", "value_type": "int"}, "DEBOUNCE": {"info_key": "debounce", "value_type": "int"},
"DIODE_DIRECTION": {"info_key": "diode_direction"}, "DIODE_DIRECTION": {"info_key": "diode_direction"},
"DISABLE_AVR_DEEP_SLEEP": {"info_key": "disable_avr_deep_sleep", "value_type": "bool"},
"DOUBLE_TAP_SHIFT_TURNS_ON_CAPS_WORD": {"info_key": "caps_word.double_tap_shift_turns_on", "value_type": "bool"}, "DOUBLE_TAP_SHIFT_TURNS_ON_CAPS_WORD": {"info_key": "caps_word.double_tap_shift_turns_on", "value_type": "bool"},
"FORCE_NKRO": {"info_key": "usb.force_nkro", "value_type": "bool"}, "FORCE_NKRO": {"info_key": "usb.force_nkro", "value_type": "bool"},
"DYNAMIC_KEYMAP_EEPROM_MAX_ADDR": {"info_key": "dynamic_keymap.eeprom_max_addr", "value_type": "int"}, "DYNAMIC_KEYMAP_EEPROM_MAX_ADDR": {"info_key": "dynamic_keymap.eeprom_max_addr", "value_type": "int"},

View File

@ -455,6 +455,8 @@ Use these to enable or disable building certain features. The more you have enab
* Forces the keyboard to wait for a USB connection to be established before it starts up * Forces the keyboard to wait for a USB connection to be established before it starts up
* `NO_USB_STARTUP_CHECK` * `NO_USB_STARTUP_CHECK`
* Disables usb suspend check after keyboard startup. Usually the keyboard waits for the host to wake it up before any tasks are performed. This is useful for split keyboards as one half will not get a wakeup call but must send commands to the master. * Disables usb suspend check after keyboard startup. Usually the keyboard waits for the host to wake it up before any tasks are performed. This is useful for split keyboards as one half will not get a wakeup call but must send commands to the master.
* `DISABLE_AVR_DEEP_SLEEP`
* Disables AVR deep sleep. Similar to `NO_SUSPEND_POWER_DOWN` with the suspend routines executed, so backlight, audio, and OLED will be still turned off during sleep.
* `DEFERRED_EXEC_ENABLE` * `DEFERRED_EXEC_ENABLE`
* Enables deferred executor support -- timed delays before callbacks are invoked. See [deferred execution](custom_quantum_functions.md#deferred-execution) for more information. * Enables deferred executor support -- timed delays before callbacks are invoked. See [deferred execution](custom_quantum_functions.md#deferred-execution) for more information.
* `DYNAMIC_TAPPING_TERM_ENABLE` * `DYNAMIC_TAPPING_TERM_ENABLE`

View File

@ -13,9 +13,7 @@
# include "vusb.h" # include "vusb.h"
#endif #endif
// TODO: This needs some cleanup #if !defined(NO_SUSPEND_POWER_DOWN) && !defined(DISABLE_AVR_DEEP_SLEEP) && defined(WDT_vect)
#if !defined(NO_SUSPEND_POWER_DOWN) && defined(WDT_vect)
// clang-format off // clang-format off
#define wdt_intr_enable(value) \ #define wdt_intr_enable(value) \
@ -105,7 +103,7 @@ void suspend_power_down(void) {
#ifndef NO_SUSPEND_POWER_DOWN #ifndef NO_SUSPEND_POWER_DOWN
// Enter sleep state if possible (ie, the MCU has a watchdog timeout interrupt) // Enter sleep state if possible (ie, the MCU has a watchdog timeout interrupt)
# if defined(WDT_vect) # if defined(WDT_vect) && !defined(DISABLE_AVR_DEEP_SLEEP)
power_down(WDTO_15MS); power_down(WDTO_15MS);
# endif # endif
#endif #endif

View File

@ -68,6 +68,10 @@ ifeq ($(strip $(NO_USB_STARTUP_CHECK)), yes)
TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
endif endif
ifeq ($(strip $(DISABLE_AVR_DEEP_SLEEP)), yes)
TMK_COMMON_DEFS += -DDISABLE_AVR_DEEP_SLEEP
endif
ifeq ($(strip $(JOYSTICK_SHARED_EP)), yes) ifeq ($(strip $(JOYSTICK_SHARED_EP)), yes)
TMK_COMMON_DEFS += -DJOYSTICK_SHARED_EP TMK_COMMON_DEFS += -DJOYSTICK_SHARED_EP
SHARED_EP_ENABLE = yes SHARED_EP_ENABLE = yes