Remove kmk.util by moving reboot/bootloader to their only use location

This commit is contained in:
Josh Klar 2019-07-24 23:45:37 -07:00
parent 02401e2ec0
commit 38e8102532
No known key found for this signature in database
GPG Key ID: A4A0C7B4E8EEE222
3 changed files with 19 additions and 27 deletions

View File

@ -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):

View File

@ -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

View File

@ -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()