From ebc45d59dc06b054fe8ac7ee49d4ebe73581f38d Mon Sep 17 00:00:00 2001 From: Josh Klar Date: Mon, 15 Oct 2018 02:49:12 -0700 Subject: [PATCH] Address #52 almost entirely - target upstream builds of CircuitPython and simply copy (rsync) KMK source, a basic main.py, and the user's keymap to the CIRCUITPY drive --- .circleci/config.yml | 48 ---- .gitmodules | 4 - Makefile | 208 +++++------------- docs/debugging.md | 4 +- docs/flashing.md | 34 +-- .../handwire/circuitpython_samd51.py | 12 +- kmk/entrypoints/handwire/pyboard.py | 12 +- kmk/firmware.py | 4 +- kmk/internal_state.py | 10 +- kmk/entrypoints/global.py => main.py | 2 +- submodules.toml | 1 - .../kdb424/handwire_planck_featherm4.py | 3 + .../klardotsh/feather_m4_express/fourfour.py | 3 + .../itsybitsy_m4_express/threethree.py | 3 + vendor/circuitpython | 1 - 15 files changed, 103 insertions(+), 246 deletions(-) rename kmk/entrypoints/global.py => main.py (52%) delete mode 160000 vendor/circuitpython diff --git a/.circleci/config.yml b/.circleci/config.yml index d03782d..1b078d6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,38 +16,6 @@ jobs: - run: make test - build_feather_m4_express: - docker: - - image: 'kmkfw/base' - - environment: - KMK_TEST: 1 - PIPENV_VENV_IN_PROJECT: 1 - - steps: - - checkout - - restore_cache: - keys: - - v2-kmk-venv-{{ checksum "Pipfile.lock" }} - - - run: make SKIP_KEYMAP_VALIDATION=1 USER_KEYMAP=user_keymaps/noop.py build-feather-m4-express - - build_itsybitsy_m4_express: - docker: - - image: 'kmkfw/base' - - environment: - KMK_TEST: 1 - PIPENV_VENV_IN_PROJECT: 1 - - steps: - - checkout - - restore_cache: - keys: - - v2-kmk-venv-{{ checksum "Pipfile.lock" }} - - - run: make SKIP_KEYMAP_VALIDATION=1 USER_KEYMAP=user_keymaps/noop.py build-itsybitsy-m4-express - build_pyboard: docker: - image: 'kmkfw/base' @@ -74,22 +42,6 @@ workflows: only: /.*/ tags: only: /.*/ - - build_feather_m4_express: - filters: - branches: - only: /.*/ - tags: - only: /.*/ - requires: - - test - - build_itsybitsy_m4_express: - filters: - branches: - only: /.*/ - tags: - only: /.*/ - requires: - - test - build_pyboard: filters: branches: diff --git a/.gitmodules b/.gitmodules index e390585..4c2b8cd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,3 @@ -[submodule "circuitpython"] - path = vendor/circuitpython - url = https://github.com/kmkfw/circuitpython.git - ignore = dirty [submodule "upy-lib"] path = vendor/upy-lib url = https://github.com/kmkfw/micropython-lib.git diff --git a/Makefile b/Makefile index f79d8ef..f619a91 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,11 @@ .SILENT: .PHONY: \ - build-feather \ - circuitpy-deps \ - circuitpy-freeze-kmk-nrf \ devdeps \ - freeze-nrf-build-deps \ lint +.DEFAULT: all + DOCKER_BASE_TAG ?= latest DOCKER_TAG ?= latest @@ -17,6 +15,8 @@ AMPY_DELAY ?= 1.5 ARDUINO ?= /usr/share/arduino PIPENV ?= $(shell which pipenv) +all: copy-kmk copy-keymap copy-main.py + .docker_base: Dockerfile_base @echo "===> Building Docker base image kmkfw/base:${DOCKER_BASE_TAG}" @docker build -f Dockerfile_base -t kmkfw/base:${DOCKER_BASE_TAG} . @@ -75,15 +75,6 @@ test: lint micropython-build-unix @rsync -ah vendor/ build/ @touch .submodules -.circuitpy-deps: .submodules - @echo "===> Building circuitpython/mpy-cross" - @echo "===> Building circuitpython/mpy-cross" >> .build.log - @pipenv run $(MAKE) -C build/circuitpython/mpy-cross 2>&1 >> .build.log - @echo "===> Pulling Nordic BLE stack" - @echo "===> Pulling Nordic BLE stack" >> .build.log - @cd build/circuitpython/ports/nrf && ./drivers/bluetooth/download_ble_stack.sh 2>/dev/null >/dev/null - @touch .circuitpy-deps - .micropython-deps: .submodules @echo "===> Building micropython/mpy-cross" @echo "===> Building micropython/mpy-cross" >> .build.log @@ -91,7 +82,6 @@ test: lint micropython-build-unix @touch .micropython-deps submodules: .submodules -circuitpy-deps: .circuitpy-deps micropython-deps: .micropython-deps build/micropython/ports/unix/micropython: micropython-deps build/micropython/ports/unix/modules/.kmk_frozen @@ -101,10 +91,6 @@ build/micropython/ports/unix/micropython: micropython-deps build/micropython/por micropython-build-unix: build/micropython/ports/unix/micropython -freeze-atmel-samd-build-deps: build/circuitpython/ports/atmel-samd/modules/.kmk_frozen -freeze-nrf-build-deps: build/circuitpython/ports/nrf/freeze/.kmk_frozen -freeze-stm32-build-deps: build/micropython/ports/stm32/freeze/.kmk_frozen - build/micropython/ports/unix/modules/.kmk_frozen: upy-freeze.txt submodules.toml @echo "===> Preparing vendored dependencies for bundling into MicroPython for Unix" @echo "===> Preparing vendored dependencies for bundling into MicroPython for Unix" >> .build.log @@ -113,22 +99,6 @@ build/micropython/ports/unix/modules/.kmk_frozen: upy-freeze.txt submodules.toml xargs -I '{}' rsync -ah {} build/micropython/ports/unix/modules/ @touch $@ -build/circuitpython/ports/atmel-samd/modules/.kmk_frozen: upy-freeze.txt submodules.toml - @echo "===> Preparing vendored dependencies for bundling into CircuitPython for atmel-samd" - @echo "===> Preparing vendored dependencies for bundling into CircuitPython for atmel-samd" >> .build.log - @rm -rf build/circuitpython/ports/atmel-samd/modules/* - @cat upy-freeze.txt | egrep -v '(^#|^\s*$|^\s*\t*#)' | grep CIRCUITPY | cut -d'|' -f2- | \ - xargs -I '{}' rsync -ah {} build/circuitpython/ports/atmel-samd/modules/ - @touch $@ - -build/circuitpython/ports/nrf/freeze/.kmk_frozen: upy-freeze.txt submodules.toml - @echo "===> Preparing vendored dependencies for bundling into CircuitPython for NRF" - @echo "===> Preparing vendored dependencies for bundling into CircuitPython for NRF" >> .build.log - @rm -rf build/circuitpython/ports/nrf/freeze/* - @cat upy-freeze.txt | egrep -v '(^#|^\s*$|^\s*\t*#)' | grep CIRCUITPY | cut -d'|' -f2- | \ - xargs -I '{}' rsync -ah {} build/circuitpython/ports/nrf/freeze/ - @touch $@ - build/micropython/ports/stm32/freeze/.kmk_frozen: upy-freeze.txt submodules.toml @echo "===> Preparing vendored dependencies for bundling into MicroPython for STM32" @echo "===> Preparing vendored dependencies for bundling into MicroPython for STM32" >> .build.log @@ -138,66 +108,12 @@ build/micropython/ports/stm32/freeze/.kmk_frozen: upy-freeze.txt submodules.toml xargs -I '{}' rsync -ah {} build/micropython/ports/stm32/freeze/ @touch $@ -circuitpy-freeze-kmk-atmel-samd: freeze-atmel-samd-build-deps - @echo "===> Preparing KMK source for bundling into CircuitPython for atmel-samd" - @echo "===> Preparing KMK source for bundling into CircuitPython for atmel-samd" >> .build.log - @rm -rf build/circuitpython/ports/atmel-samd/modules/kmk* - @rsync -ah kmk build/circuitpython/ports/atmel-samd/modules/ --exclude kmk/micropython - -circuitpy-freeze-kmk-nrf: freeze-nrf-build-deps - @echo "===> Preparing KMK source for bundling into CircuitPython for NRF" - @echo "===> Preparing KMK source for bundling into CircuitPython for NRF" >> .build.log - @rm -rf build/circuitpython/ports/nrf/kmk* - @rsync -ah kmk build/circuitpython/ports/nrf/freeze/ --exclude kmk/micropython - micropython-freeze-kmk-stm32: freeze-stm32-build-deps @echo "===> Preparing KMK source for bundling into MicroPython for STM32" @echo "===> Preparing KMK source for bundling into MicroPython for STM32" >> .build.log @rm -rf build/micropython/ports/stm32/freeze/kmk* @rsync -ah kmk build/micropython/ports/stm32/freeze/ --exclude kmk/circuitpython -circuitpy-build-feather-m4-express: - @echo "===> Building CircuitPython for atmel-samd - Feather M4 Express" - @echo "===> Building CircuitPython for atmel-samd - Feather M4 Express" >> .build.log - @pipenv run $(MAKE) -C build/circuitpython/ports/atmel-samd BOARD=feather_m4_express FROZEN_MPY_DIRS="modules" clean all 2>&1 >> .build.log - -circuitpy-build-itsybitsy-m4-express: - @echo "===> Building CircuitPython for atmel-samd - ItsyBitsy M4 Express" - @echo "===> Building CircuitPython for atmel-samd - ItsyBitsy M4 Express" >> .build.log - @pipenv run $(MAKE) -C build/circuitpython/ports/atmel-samd BOARD=itsybitsy_m4_express FROZEN_MPY_DIRS="modules" clean all 2>&1 >> .build.log - -circuitpy-build-nrf: - @echo "===> Building CircuitPython for NRF - Feather NRF52832" - @echo "===> Building CircuitPython for NRF - Feather NRF52832" >> .build.log - @pipenv run $(MAKE) -C build/circuitpython/ports/nrf BOARD=feather_nrf52832 SERIAL=${AMPY_PORT} SD=s132 FROZEN_MPY_DIR=freeze clean all 2>&1 >> .build.log - -circuitpy-flash-feather-m4-express: - @echo - @echo "!!!!!!!!!!!!!!!!!!!!" - @echo "Flashing not available for Feather M4 Express over bossa right now" - @echo "First, double tap the reset button on the Feather. You should see a red light near the USB port" - @echo "Then, find and (if necessary) mount the USB drive that will show up (should be about 4MB)" - @echo "Copy build/circuitpython/ports/atmel-samd/build-feather_m4_express/firmware.uf2 to this device" - @echo "The device will auto-reboot. You may need to forcibly unmount the drive on Linuxes, with umount -f path/to/mountpoint" - @echo "!!!!!!!!!!!!!!!!!!!!" - @echo - -circuitpy-flash-itsybitsy-m4-express: - @echo - @echo "!!!!!!!!!!!!!!!!!!!!" - @echo "Flashing not available for ItsyBitsy M4 Express over bossa right now" - @echo "First, double tap the reset button on the ItsyBitsy. You should see a red light near the USB port" - @echo "Then, find and (if necessary) mount the USB drive that will show up (should be about 4MB)" - @echo "Copy build/circuitpython/ports/atmel-samd/build-itsybitsy_m4_express/firmware.uf2 to this device" - @echo "The device will auto-reboot. You may need to forcibly unmount the drive on Linuxes, with umount -f path/to/mountpoint" - @echo "!!!!!!!!!!!!!!!!!!!!" - @echo - -circuitpy-flash-nrf: circuitpy-build-nrf - @echo "===> Flashing CircuitPython with KMK and your keymap" - @echo "===> Flashing CircuitPython with KMK and your keymap" >> .build.log - @pipenv run $(MAKE) -C build/circuitpython/ports/nrf BOARD=feather_nrf52832 SERIAL=${AMPY_PORT} SD=s132 FROZEN_MPY_DIR=freeze dfu-gen dfu-flash 2>&1 >> .build.log - micropython-build-pyboard: @echo "===> Building MicroPython for STM32 - PYBV11" @echo "===> Building MicroPython for STM32 - PYBV11" >> .build.log @@ -208,74 +124,6 @@ micropython-flash-pyboard: micropython-build-pyboard @echo "===> Flashing MicroPython with KMK and your keymap" >> .build.log @pipenv run $(MAKE) -j4 -C build/micropython/ports/stm32/ BOARD=PYBV11 FROZEN_MPY_DIR=freeze deploy 2>&1 >> .build.log -circuitpy-flash-nrf-entrypoint: - @echo "===> Flashing entrypoint if it doesn't already exist" - @sleep 2 - @-timeout -k 5s 10s $(PIPENV) run ampy -p ${AMPY_PORT} -d ${AMPY_DELAY} -b ${AMPY_BAUD} rm main.py 2>/dev/null - @-timeout -k 5s 10s $(PIPENV) run ampy -p ${AMPY_PORT} -d ${AMPY_DELAY} -b ${AMPY_BAUD} put entrypoints/feather_nrf52832.py main.py - @echo "===> Flashed keyboard successfully!" - -ifndef USER_KEYMAP -build-feather-m4-express: - @echo "===> Must provide a USER_KEYMAP (usually from user_keymaps/...) to build!" && exit 1 - -flash-feather-m4-express: - @echo "===> Must provide a USER_KEYMAP (usually from user_keymaps/...) to build!" && exit 1 -else -ifndef SKIP_KEYMAP_VALIDATION -build-feather-m4-express: clean-build-log lint circuitpy-deps circuitpy-freeze-kmk-atmel-samd micropython-build-unix -else -build-feather-m4-express: clean-build-log lint circuitpy-deps circuitpy-freeze-kmk-atmel-samd -endif - @echo "===> Preparing keyboard script for bundling into CircuitPython for atmel-samd" -ifndef SKIP_KEYMAP_VALIDATION - @MICROPYPATH=./ ./bin/micropython.sh bin/keymap_sanity_check.py ${USER_KEYMAP} -endif - @rsync -ah ${USER_KEYMAP} build/circuitpython/ports/atmel-samd/modules/kmk_keyboard_user.py - @rsync -ah kmk/entrypoints/global.py build/circuitpython/ports/atmel-samd/modules/_main.py - @$(MAKE) circuitpy-build-feather-m4-express - -flash-feather-m4-express: build-feather-m4-express circuitpy-flash-feather-m4-express -endif - -ifndef USER_KEYMAP -build-feather-nrf52832: - @echo "===> Must provide a USER_KEYMAP (usually from user_keymaps/...) to build!" && exit 1 - -flash-feather-nrf52832: - @echo "===> Must provide a USER_KEYMAP (usually from user_keymaps/...) to build!" && exit 1 -else -build-feather-nrf52832: clean-build-log lint circuitpy-deps circuitpy-freeze-kmk-nrf - @echo "===> Preparing keyboard script for bundling into CircuitPython for NRF" - @rsync -ah ${USER_KEYMAP} build/circuitpython/ports/nrf/freeze/kmk_keyboard_user.py - @$(MAKE) circuitpy-build-nrf - -flash-feather-nrf52832: clean-build-log build-feather-nrf52832 circuitpy-flash-nrf circuitpy-flash-nrf-endpoint -endif - -ifndef USER_KEYMAP -build-itsybitsy-m4-express: - @echo "===> Must provide a USER_KEYMAP (usually from user_keymaps/...) to build!" && exit 1 - -flash-itsybitsy-m4-express: - @echo "===> Must provide a USER_KEYMAP (usually from user_keymaps/...) to build!" && exit 1 -else -ifndef SKIP_KEYMAP_VALIDATION -build-itsybitsy-m4-express: clean-build-log lint circuitpy-deps circuitpy-freeze-kmk-atmel-samd micropython-build-unix -else -build-itsybitsy-m4-express: clean-build-log lint circuitpy-deps circuitpy-freeze-kmk-atmel-samd -endif - @echo "===> Preparing keyboard script for bundling into CircuitPython for atmel-samd" -ifndef SKIP_KEYMAP_VALIDATION - @MICROPYPATH=./ ./bin/micropython.sh bin/keymap_sanity_check.py ${USER_KEYMAP} -endif - @rsync -ah ${USER_KEYMAP} build/circuitpython/ports/atmel-samd/modules/kmk_keyboard_user.py - @rsync -ah kmk/entrypoints/global.py build/circuitpython/ports/atmel-samd/modules/_main.py - @$(MAKE) circuitpy-build-itsybitsy-m4-express - -flash-itsybitsy-m4-express: build-itsybitsy-m4-express circuitpy-flash-itsybitsy-m4-express -endif - ifndef USER_KEYMAP build-pyboard: @echo "===> Must provide a USER_KEYMAP (usually from user_keymaps/...) to build!" && exit 1 @@ -292,7 +140,7 @@ endif ifndef SKIP_KEYMAP_VALIDATION @MICROPYPATH=./ ./bin/micropython.sh bin/keymap_sanity_check.py ${USER_KEYMAP} endif - @rsync -ah ${USER_KEYMAP} build/micropython/ports/stm32/freeze/kmk_keyboard_user.py + @rsync -ah ${USER_KEYMAP} build/micropython/ports/stm32/freeze/main.py @rsync -ah kmk/entrypoints/global.py build/micropython/ports/stm32/freeze/_main.py @rsync -ah kmk/entrypoints/handwire/pyboard_boot.py build/micropython/ports/stm32/freeze/_boot.py @$(MAKE) AMPY_PORT=/dev/ttyACM0 AMPY_BAUD=115200 micropython-build-pyboard @@ -301,7 +149,53 @@ flash-pyboard: build-pyboard micropython-flash-pyboard endif reset-bootloader: + @echo "===> Rebooting your board to bootloader (safe to ignore file not found errors)" @-timeout -k 5s 10s $(PIPENV) run ampy -p /dev/ttyACM0 -d ${AMPY_DELAY} -b ${AMPY_BAUD} run util/bootloader.py reset-board: + @echo "===> Rebooting your board (safe to ignore file not found errors)" @-timeout -k 5s 10s $(PIPENV) run ampy -p /dev/ttyACM0 -d ${AMPY_DELAY} -b ${AMPY_BAUD} run util/reset.py + +ifdef MOUNTPOINT +$(MOUNTPOINT)/kmk/.copied: $(shell find kmk/ -name "*.py" | xargs -0) + @echo "===> Copying KMK source folder" + @rsync -rh kmk $(MOUNTPOINT)/ + @cat upy-freeze.txt | egrep -v '(^#|^\s*$|^\s*\t*#)' | grep CIRCUITPY | cut -d'|' -f2- | \ + xargs -I '{}' rsync -h {} $(MOUNTPOINT)/ + @touch $(MOUNTPOINT)/kmk/.copied + @sync + +copy-kmk: $(MOUNTPOINT)/kmk/.copied +else +copy-kmk: + echo "**** MOUNTPOINT must be defined (wherever your CIRCUITPY drive is mounted) ****" && exit 1 +endif + +ifdef MOUNTPOINT +$(MOUNTPOINT)/main.py: main.py + @echo "===> Copying a basic main.py" + @rsync -rh main.py $@ + @sync + +copy-main.py: $(MOUNTPOINT)/main.py +else +copy-main.py: + echo "**** MOUNTPOINT must be defined (wherever your CIRCUITPY drive is mounted) ****" && exit 1 +endif + +ifdef MOUNTPOINT +ifndef USER_KEYMAP +$(MOUNTPOINT)/kmk_keyboard.py: + @echo "**** USER_KEYMAP must be defined (ex. USER_KEYMAP=user_keymaps/noop.py) ****" && exit 1 +else +$(MOUNTPOINT)/kmk_keyboard.py: $(USER_KEYMAP) + @echo "===> Copying your keymap to kmk_keyboard.py" + @rsync -rh $(USER_KEYMAP) $@ + @sync +endif # USER_KEYMAP + +copy-keymap: $(MOUNTPOINT)/kmk_keyboard.py +else +copy-keymap: + echo "**** MOUNTPOINT must be defined (wherever your CIRCUITPY drive is mounted) ****" && exit 1 +endif # MOUNTPOINT diff --git a/docs/debugging.md b/docs/debugging.md index 6080074..eb2ab9c 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -1,4 +1,4 @@ -#Debugging +# Debugging Debug will output most of the useful state to the console. This can be enable in your firmware by setting this in your keymap. NOTE that it will be MUCH slower, so only enable this when you need debugging. @@ -8,4 +8,4 @@ DEBUG_ENABLE = True The output can be viewed by connecting to the serial port of the keybord. Please refer to [THIS](https://learn.adafruit.com/welcome-to-circuitpython/kattni-connecting-to-the-serial-console) for more information when connecting to serial console. For Linux users, we recommend [picocom](https://github.com/npat-efault/picocom) or -[screen](https://www.gnu.org/software/screen/manual/screen.html) \ No newline at end of file +[screen](https://www.gnu.org/software/screen/manual/screen.html) diff --git a/docs/flashing.md b/docs/flashing.md index 53b7829..2b2d377 100644 --- a/docs/flashing.md +++ b/docs/flashing.md @@ -1,18 +1,26 @@ # Flashing Instructions -Flashing sequence: +KMK sits on top of an existing CircuitPython install, flash that for your board +as appropriate (see [Adafruit's +documentation](https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython), +though it doesn't cover all CircuitPython boards - you may need to glance around +the CircuitPython source or ask on Discord). We primarily target CircuitPython +4.0-alpha1 and above, though many features should work on 3.x. You'll only need +to flash CircuitPython once (unless we update our baseline supported version). -1. Press the `KC.RESET` keycode, or tap the RESET button. -2. Wait for the OS to detect the device -3. Flash a .hex file (May be done automatically) -4. Reset the device into application mode (May be done automatically) - -or: - - make flash- USER_KEYMAP=user_keymaps/... - -Example: - - make flash-feather-m4-express USER_KEYMAP=user_keymaps/kdb424/handwire_planck_featherm4.py +After CircuitPython has been flashed, a `CIRCUITPY` drive should show up on your +computer (some Linux/BSD users without drive automounting will want to poke +around `dmesg` to find the drive identifier and mount this drive manually +somewhere - ex. `mkdir -p ~/mnt && sudo mount -o uid=1000,gid=1000 /dev/sdf1 +~/mnt`, where `uid` and `gid` are your user ID and primary group ID, as found in +`id -u` and `id -g`). Take note of the path that this is mounted to (for MacOS +users, this will probably look something like `/Volumes/CIRCUITPY`). +To "flash" all of KMK, your keymap, and a basic `main.py` that will start +everything up, run `make MOUNTPOINT=/path/to/wherever +USER_KEYMAP=path/to/keymap.py`. For example, if my `CIRCUITPY` volume is mounted +to `~/mnt`, I might flash my development breadboard with the following: +```sh +make MOUNTPOINT=~/mnt USER_KEYMAP=user_keymaps/klardotsh/itsybitsy_m4_express/threethree.py +``` diff --git a/kmk/entrypoints/handwire/circuitpython_samd51.py b/kmk/entrypoints/handwire/circuitpython_samd51.py index 28bfca6..3fc33aa 100644 --- a/kmk/entrypoints/handwire/circuitpython_samd51.py +++ b/kmk/entrypoints/handwire/circuitpython_samd51.py @@ -5,14 +5,14 @@ def main(): from kmk.firmware import Firmware from kmk.matrix import MatrixScanner - import kmk_keyboard_user + import kmk_keyboard - cols = getattr(kmk_keyboard_user, 'cols') - diode_orientation = getattr(kmk_keyboard_user, 'diode_orientation') - keymap = getattr(kmk_keyboard_user, 'keymap') - rows = getattr(kmk_keyboard_user, 'rows') + cols = getattr(kmk_keyboard, 'cols') + diode_orientation = getattr(kmk_keyboard, 'diode_orientation') + keymap = getattr(kmk_keyboard, 'keymap') + rows = getattr(kmk_keyboard, 'rows') - debug_enable = getattr(kmk_keyboard_user, 'debug_enable', False) + debug_enable = getattr(kmk_keyboard, 'debug_enable', False) if debug_enable: from logging import DEBUG as log_level diff --git a/kmk/entrypoints/handwire/pyboard.py b/kmk/entrypoints/handwire/pyboard.py index 0a0562a..3bc80ec 100644 --- a/kmk/entrypoints/handwire/pyboard.py +++ b/kmk/entrypoints/handwire/pyboard.py @@ -8,13 +8,13 @@ from kmk.micropython.pyb_hid import HIDHelper def main(): - import kmk_keyboard_user - cols = getattr(kmk_keyboard_user, 'cols') - diode_orientation = getattr(kmk_keyboard_user, 'diode_orientation') - keymap = getattr(kmk_keyboard_user, 'keymap') - rows = getattr(kmk_keyboard_user, 'rows') + import kmk_keyboard + cols = getattr(kmk_keyboard, 'cols') + diode_orientation = getattr(kmk_keyboard, 'diode_orientation') + keymap = getattr(kmk_keyboard, 'keymap') + rows = getattr(kmk_keyboard, 'rows') - debug_enable = getattr(kmk_keyboard_user, 'debug_enable', False) + debug_enable = getattr(kmk_keyboard, 'debug_enable', False) if debug_enable: from logging import DEBUG as log_level diff --git a/kmk/firmware.py b/kmk/firmware.py index b8d098c..5e3ed19 100644 --- a/kmk/firmware.py +++ b/kmk/firmware.py @@ -19,8 +19,8 @@ class Firmware: logger = logging.getLogger(__name__) logger.setLevel(log_level) - import kmk_keyboard_user - self.encoders = getattr(kmk_keyboard_user, 'encoders', []) + import kmk_keyboard + self.encoders = getattr(kmk_keyboard, 'encoders', []) self.hydrated = False diff --git a/kmk/internal_state.py b/kmk/internal_state.py index c47f3cf..4effd4c 100644 --- a/kmk/internal_state.py +++ b/kmk/internal_state.py @@ -90,11 +90,11 @@ class InternalState: _oldstates = [] def __init__(self, preserve_intermediate_states=False): - import kmk_keyboard_user - self.unicode_mode = getattr(kmk_keyboard_user, 'unicode_mode', UnicodeModes.NOOP) - self.tap_time = getattr(kmk_keyboard_user, 'tap_time', 300) - self.leader_mode = getattr(kmk_keyboard_user, 'leader_mode', LeaderMode.ENTER) - self.leader_dictionary = getattr(kmk_keyboard_user, 'leader_dictionary', {}) + import kmk_keyboard + self.unicode_mode = getattr(kmk_keyboard, 'unicode_mode', UnicodeModes.NOOP) + self.tap_time = getattr(kmk_keyboard, 'tap_time', 300) + self.leader_mode = getattr(kmk_keyboard, 'leader_mode', LeaderMode.ENTER) + self.leader_dictionary = getattr(kmk_keyboard, 'leader_dictionary', {}) self.preserve_intermediate_states = preserve_intermediate_states def __enter__(self): diff --git a/kmk/entrypoints/global.py b/main.py similarity index 52% rename from kmk/entrypoints/global.py rename to main.py index c07d83c..5c482b5 100644 --- a/kmk/entrypoints/global.py +++ b/main.py @@ -1,4 +1,4 @@ -from kmk_keyboard_user import main +from kmk_keyboard import main if __name__ == '__main__': main() diff --git a/submodules.toml b/submodules.toml index 3d94545..79e0cde 100644 --- a/submodules.toml +++ b/submodules.toml @@ -1,4 +1,3 @@ [submodules] -"vendor/circuitpython" = "2cec23c" "vendor/micropython" = "65a49fa" "vendor/upy-lib" = "451b1c0" diff --git a/user_keymaps/kdb424/handwire_planck_featherm4.py b/user_keymaps/kdb424/handwire_planck_featherm4.py index 0011027..184661e 100644 --- a/user_keymaps/kdb424/handwire_planck_featherm4.py +++ b/user_keymaps/kdb424/handwire_planck_featherm4.py @@ -86,3 +86,6 @@ keymap = [ [KC.DF(0), KC.DF(1), KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.TRNS, KC.F1, KC.F2, KC.F3, KC.NO], ], ] + +if __name__ == '__main__': + main() diff --git a/user_keymaps/klardotsh/feather_m4_express/fourfour.py b/user_keymaps/klardotsh/feather_m4_express/fourfour.py index d52741d..a50fa83 100644 --- a/user_keymaps/klardotsh/feather_m4_express/fourfour.py +++ b/user_keymaps/klardotsh/feather_m4_express/fourfour.py @@ -71,3 +71,6 @@ keymap = [ [KC.O, KC.P, KC.Q], ], ] + +if __name__ == '__main__': + main() diff --git a/user_keymaps/klardotsh/itsybitsy_m4_express/threethree.py b/user_keymaps/klardotsh/itsybitsy_m4_express/threethree.py index f84c01a..47219c9 100644 --- a/user_keymaps/klardotsh/itsybitsy_m4_express/threethree.py +++ b/user_keymaps/klardotsh/itsybitsy_m4_express/threethree.py @@ -87,3 +87,6 @@ keymap = [ [KC.TRNS, KC.P, MACRO_HELLO_WORLD], ], ] + +if __name__ == '__main__': + main() diff --git a/vendor/circuitpython b/vendor/circuitpython deleted file mode 160000 index 2cec23c..0000000 --- a/vendor/circuitpython +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2cec23cb632b9c01c5c718444e05fa62f4fd8807