Misc. cleanup around the tree

This commit is contained in:
Josh Klar 2018-09-16 20:50:05 -07:00
parent 7f88f4f415
commit 88807837d5
3 changed files with 13 additions and 7 deletions

View File

@ -50,14 +50,14 @@ vendor/circuitpython/ports/nrf/freeze/.kmk_frozen: upy-freeze.txt
vendor/micropython/ports/teensy/freeze/.kmk_frozen: upy-freeze.txt
@echo "===> Preparing vendored dependencies for bundling"
@mkdir vendor/micropython/ports/teensy/freeze/
@mkdir -p vendor/micropython/ports/teensy/freeze/
@rm -rf vendor/micropython/ports/teensy/freeze/*
@cat $< | xargs -I '{}' cp -a {} vendor/micropython/ports/teensy/freeze/
@touch $@
vendor/micropython/ports/stm32/freeze/.kmk_frozen: upy-freeze.txt
@echo "===> Preparing vendored dependencies for bundling"
@mkdir vendor/micropython/ports/stm32/freeze/
@mkdir -p vendor/micropython/ports/stm32/freeze/
@rm -rf vendor/micropython/ports/stm32/freeze/*
@cat $< | xargs -I '{}' cp -a {} vendor/micropython/ports/stm32/freeze/
@touch $@
@ -86,7 +86,6 @@ micropython-flash-teensy3.1:
@make -C vendor/micropython/ports/teensy/ BOARD=TEENSY_3.1 deploy
micropython-flash-pyboard:
@make -j4 -C vendor/micropython/ports/stm32/ BOARD=PYBV11 clean
@make -j4 -C vendor/micropython/ports/stm32/ BOARD=PYBV11 FROZEN_MPY_DIR=freeze deploy
micropython-flash-pyboard-entrypoint:
@ -96,7 +95,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 entrypoints/pyboard.py /flash/main.py
@-timeout -k 5s 10s pipenv run ampy -p ${AMPY_PORT} -d ${AMPY_DELAY} -b ${AMPY_BAUD} put entrypoints/pyboard_boot.py /flash/boot.py
@-timeout -k 5s 10s pipenv run ampy -p ${AMPY_PORT} -d ${AMPY_DELAY} -b ${AMPY_BAUD} reset
@echo "===> Flashed keyboard successfully!"
circuitpy-flash-nrf-entrypoint:

View File

@ -1,12 +1,16 @@
from logging import DEBUG
import machine
from kmk.common.consts import DiodeOrientation
from kmk.firmware import Firmware
def main():
cols = ('X10', 'X11', 'X12')
rows = ('X1', 'X2', 'X3')
p = machine.Pin.board
cols = (p.X10, p.X11, p.X12)
rows = (p.X1, p.X2, p.X3)
diode_orientation = DiodeOrientation.COLUMNS

View File

@ -8,7 +8,11 @@ class MatrixScanner(AbstractMatrixScanner):
def __init__(self, cols, rows, diode_orientation=DiodeOrientation.COLUMNS):
# A pin cannot be both a row and column, detect this by combining the
# two tuples into a set and validating that the length did not drop
unique_pins = set(cols) | set(rows)
#
# repr() hackery is because MicroPython Pin objects are not hashable.
# Technically we support passing either a string (hashable) or the
# Pin object directly here, so the hackaround is necessary.
unique_pins = {repr(c) for c in cols} | {repr(r) for r in rows}
if len(unique_pins) != len(cols) + len(rows):
raise ValueError('Cannot use a pin as both a column and row')