Remove kmk.util by moving reboot/bootloader to their only use location
This commit is contained in:
parent
02401e2ec0
commit
38e8102532
@ -1,5 +1,4 @@
|
||||
from kmk.kmktime import sleep_ms
|
||||
from kmk.util import reset_bootloader, reset_keyboard
|
||||
|
||||
|
||||
def passthrough(key, state, *args, **kwargs):
|
||||
@ -29,11 +28,28 @@ def default_released(key, state, KC, coord_int=None, coord_raw=None):
|
||||
|
||||
|
||||
def reset(*args, **kwargs):
|
||||
reset_keyboard()
|
||||
try:
|
||||
import machine
|
||||
|
||||
machine.reset()
|
||||
|
||||
except ImportError:
|
||||
import microcontroller
|
||||
|
||||
microcontroller.reset()
|
||||
|
||||
|
||||
def bootloader(*args, **kwargs):
|
||||
reset_bootloader()
|
||||
try:
|
||||
import machine
|
||||
|
||||
machine.bootloader()
|
||||
|
||||
except ImportError:
|
||||
import microcontroller
|
||||
|
||||
microcontroller.on_next_reset(microcontroller.RunMode.BOOTLOADER)
|
||||
microcontroller.reset()
|
||||
|
||||
|
||||
def debug_pressed(key, state, KC, *args, **kwargs):
|
||||
|
@ -25,7 +25,6 @@ import supervisor # isort:skip
|
||||
import kmk.consts # isort:skip
|
||||
import kmk.kmktime # isort:skip
|
||||
import kmk.types # isort:skip
|
||||
import kmk.util # isort:skip
|
||||
|
||||
from kmk.consts import LeaderMode, UnicodeMode, KMK_RELEASE # isort:skip
|
||||
from kmk.hid import USB_HID # isort:skip
|
||||
|
23
kmk/util.py
23
kmk/util.py
@ -1,23 +0,0 @@
|
||||
def reset_keyboard():
|
||||
try:
|
||||
import machine
|
||||
|
||||
machine.reset()
|
||||
|
||||
except ImportError:
|
||||
import microcontroller
|
||||
|
||||
microcontroller.reset()
|
||||
|
||||
|
||||
def reset_bootloader():
|
||||
try:
|
||||
import machine
|
||||
|
||||
machine.bootloader()
|
||||
|
||||
except ImportError:
|
||||
import microcontroller
|
||||
|
||||
microcontroller.on_next_reset(microcontroller.RunMode.BOOTLOADER)
|
||||
microcontroller.reset()
|
Loading…
Reference in New Issue
Block a user