Most changes requested were done, and other general improvements.

This commit is contained in:
Kyle Brown 2018-09-26 23:19:11 -07:00
parent 14233b77d3
commit b3469d9fb2
4 changed files with 36 additions and 19 deletions

View File

@ -130,7 +130,6 @@ micropython-flash-pyboard-entrypoint:
@-timeout -k 5s 10s pipenv run ampy -p ${AMPY_PORT} -d ${AMPY_DELAY} -b ${AMPY_BAUD} rm /flash/boot.py 2>/dev/null
@-timeout -k 5s 10s pipenv run ampy -p ${AMPY_PORT} -d ${AMPY_DELAY} -b ${AMPY_BAUD} put kmk/entrypoints/global.py /flash/main.py
@-timeout -k 5s 10s pipenv run ampy -p ${AMPY_PORT} -d ${AMPY_DELAY} -b ${AMPY_BAUD} put kmk/entrypoints/handwire/pyboard_boot.py /flash/boot.py
@-timeout -k 5s 10s pipenv run ampy -p /dev/ttyACM0 -d ${AMPY_DELAY} -b ${AMPY_BAUD} run util/reset.py
@echo "===> Flashed keyboard successfully!"
circuitpy-flash-nrf-entrypoint:
@ -195,16 +194,22 @@ endif
@cp -av ${USER_KEYMAP} vendor/micropython/ports/stm32/freeze/kmk_keyboard_user.py
@$(MAKE) AMPY_PORT=/dev/ttyACM0 AMPY_BAUD=115200 micropython-build-pyboard
flash-pyboard-quick: lint devdeps micropython-deps micropython-freeze-kmk-stm32
@echo "===> Preparing keyboard script for bundling into MicroPython"
@cp -av ${USER_KEYMAP} vendor/micropython/ports/stm32/freeze/kmk_keyboard_user.py
@$(MAKE) AMPY_PORT=/dev/ttyACM0 AMPY_BAUD=115200 micropython-flash-pyboard
flash-pyboard: lint devdeps micropython-deps micropython-freeze-kmk-stm32
@echo "===> Preparing keyboard script for bundling into MicroPython"
@cp -av ${USER_KEYMAP} vendor/micropython/ports/stm32/freeze/kmk_keyboard_user.py
ifndef SKIP_ENTRYPOINTS
@$(MAKE) AMPY_PORT=/dev/ttyACM0 AMPY_BAUD=115200 micropython-flash-pyboard micropython-flash-pyboard-entrypoint
@$(MAKE) AMPY_PORT=/dev/ttyACM0 AMPY_BAUD=115200 reset-board
else
@$(MAKE) AMPY_PORT=/dev/ttyACM0 AMPY_BAUD=115200 micropython-flash-pyboard
endif
endif
reset-bootloader:
@-timeout -k 5s 10s pipenv run ampy -p /dev/ttyACM0 -d ${AMPY_DELAY} -b ${AMPY_BAUD} run util/bootloader.py
reset-board:
@-timeout -k 5s 10s pipenv run ampy -p /dev/ttyACM0 -d ${AMPY_DELAY} -b ${AMPY_BAUD} run util/reset.py
# Fully wipe the board with only stock CircuitPython
burn-it-all-with-fire: lint devdeps

View File

@ -8,3 +8,24 @@ def flatten_dict(d):
items[k] = v
return items
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()

View File

@ -1,8 +1,3 @@
try:
import machine
machine.bootloader()
from kmk.common.util import reset_bootloader
except ImportError:
import microcontroller
microcontroller.on_next_reset(microcontroller.RunMode.BOOTLOADER)
microcontroller.reset()
reset_bootloader()

View File

@ -1,7 +1,3 @@
try:
import machine
machine.reset()
from kmk.common.util import reset_keyboard
except ImportError:
import microcontroller
microcontroller.reset()
reset_keyboard()