Skip to content

Commit

Permalink
Merge pull request qmk#1 from qmk/master
Browse files Browse the repository at this point in the history
Update from original repo
  • Loading branch information
LouWii authored Sep 28, 2019
2 parents 931e9bd + 17794e0 commit 59c720f
Show file tree
Hide file tree
Showing 3,054 changed files with 65,374 additions and 444,214 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ quantum/version.h
CMakeLists.txt
cmake-build-debug
doxygen/
.DS_STORE
.DS_Store
/util/wsl_downloaded
/util/win_downloaded
/keyboards/*/Makefile
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@
[submodule "lib/googletest"]
path = lib/googletest
url = https://github.com/google/googletest
[submodule "lib/lufa"]
path = lib/lufa
url = https://github.com/qmk/lufa
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ addons:
- diffutils
- dos2unix
- doxygen
after_success:
after_script:
bash util/travis_compiled_push.sh
notifications:
webhooks:
Expand Down
7 changes: 6 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// Suggested extensions
{
"recommendations": [
"EditorConfig.EditorConfig"
"EditorConfig.EditorConfig",
"xaver.clang-format",
"ms-vscode.cpptools",
"bierner.github-markdown-preview",
"donjayamanne.git-extension-pack",
"CoenraadS.bracket-pair-colorizer-2"
]
}
12 changes: 7 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
"**/*.hex": true
},
"files.associations": {
"*.h": "c",
"*.c": "c",
"*.cpp": "cpp",
"*.hpp": "cpp",
"xstddef": "c"
"*.h": "c",
"*.c": "c",
"*.cpp": "cpp",
"*.hpp": "cpp",
"xstddef": "c",
"type_traits": "c",
"utility": "c"
}
}
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,9 @@ define PARSE_KEYBOARD
# The same if all was specified
else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,all),true)
$$(eval $$(call PARSE_ALL_KEYMAPS))
# List all keymaps for the given keyboard
else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,list-keymaps),true)
$$(eval $$(call LIST_ALL_KEYMAPS))
# Try to match the specified keyamp with the list of known keymaps
else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(KEYMAPS)),true)
$$(eval $$(call PARSE_KEYMAP,$$(MATCHED_ITEM)))
Expand Down Expand Up @@ -407,6 +410,16 @@ endef
# endif
# endef

# Prints a list of all known keymaps for the given keyboard
define LIST_ALL_KEYMAPS
COMMAND_true_LIST_KEYMAPS := \
printf "$$(KEYMAPS)\n";
COMMAND_false_LIST_KEYMAPS := \
printf "$$(MSG_AVAILABLE_KEYMAPS)\n"; \
printf "$$(KEYMAPS)\n";
COMMANDS += LIST_KEYMAPS
endef

# $1 Keymap
# This is the meat of compiling a keyboard, when entering this, everything is known
# keyboard, subproject, and keymap
Expand Down Expand Up @@ -548,6 +561,7 @@ ifndef SKIP_GIT
if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 1 --init lib/chibios; fi
if [ ! -e lib/chibios-contrib ]; then git submodule sync lib/chibios-contrib && git submodule update --depth 1 --init lib/chibios-contrib; fi
if [ ! -e lib/ugfx ]; then git submodule sync lib/ugfx && git submodule update --depth 1 --init lib/ugfx; fi
if [ ! -e lib/lufa ]; then git submodule sync lib/lufa && git submodule update --depth 1 --init lib/lufa; fi
git submodule status --recursive 2>/dev/null | \
while IFS= read -r x; do \
case "$$x" in \
Expand Down
92 changes: 39 additions & 53 deletions bin/qmk
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,17 @@
import os
import subprocess
import sys
from glob import glob
from time import strftime
from importlib import import_module
from importlib.util import find_spec
from time import strftime

# Add the QMK python libs to our path
script_dir = os.path.dirname(os.path.realpath(__file__))
qmk_dir = os.path.abspath(os.path.join(script_dir, '..'))
python_lib_dir = os.path.abspath(os.path.join(qmk_dir, 'lib', 'python'))
sys.path.append(python_lib_dir)

# Change to the root of our checkout
os.environ['ORIG_CWD'] = os.getcwd()
os.chdir(qmk_dir)

# Make sure our modules have been setup
with open('requirements.txt', 'r') as fd:
with open(os.path.join(qmk_dir, 'requirements.txt'), 'r') as fd:
for line in fd.readlines():
line = line.strip().replace('<', '=').replace('>', '=')

Expand All @@ -32,66 +26,58 @@ with open('requirements.txt', 'r') as fd:

module = line.split('=')[0] if '=' in line else line
if not find_spec(module):
print('Your QMK build environment is not fully setup!\n')
print('Please run `./util/qmk_install.sh` to setup QMK.')
print('Could not find module %s!', module)
print('Please run `pip3 install -r requirements.txt` to install the python dependencies.')
exit(255)

# Figure out our version
# TODO(skullydazed/anyone): Find a method that doesn't involve git. This is slow in docker and on windows.
command = ['git', 'describe', '--abbrev=6', '--dirty', '--always', '--tags']
result = subprocess.run(command, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = subprocess.run(command, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

if result.returncode == 0:
os.environ['QMK_VERSION'] = 'QMK ' + result.stdout.strip()
os.environ['QMK_VERSION'] = result.stdout.strip()
else:
os.environ['QMK_VERSION'] = 'QMK ' + strftime('%Y-%m-%d-%H:%M:%S')
os.environ['QMK_VERSION'] = 'nogit-' + strftime('%Y-%m-%d-%H:%M:%S') + '-dirty'

# Setup the CLI
import milc
milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}ψ{style_reset_all}'

# If we were invoked as `qmk <cmd>` massage sys.argv into `qmk-<cmd>`.
# This means we can't accept arguments to the qmk script itself.
script_name = os.path.basename(sys.argv[0])
if script_name == 'qmk':
if len(sys.argv) == 1:
milc.cli.log.error('No subcommand specified!\n')

if len(sys.argv) == 1 or sys.argv[1] in ['-h', '--help']:
milc.cli.echo('usage: qmk <subcommand> [...]')
milc.cli.echo('\nsubcommands:')
subcommands = glob(os.path.join(qmk_dir, 'bin', 'qmk-*'))
for subcommand in sorted(subcommands):
subcommand = os.path.basename(subcommand).split('-', 1)[1]
milc.cli.echo('\t%s', subcommand)
milc.cli.echo('\nqmk <subcommand> --help for more information')
exit(1)

if sys.argv[1] in ['-V', '--version']:
milc.cli.echo(os.environ['QMK_VERSION'])
exit(0)
milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}Ψ{style_reset_all}'

sys.argv[0] = script_name = '-'.join((script_name, sys.argv[1]))
del sys.argv[1]

# Look for which module to import
if script_name == 'qmk':
milc.cli.print_help()
exit(0)
elif not script_name.startswith('qmk-'):
milc.cli.log.error('Invalid symlink, must start with "qmk-": %s', script_name)
else:
subcommand = script_name.replace('-', '.').replace('_', '.').split('.')
subcommand.insert(1, 'cli')
subcommand = '.'.join(subcommand)
@milc.cli.entrypoint('QMK Helper Script')
def qmk_main(cli):
"""The function that gets run when no subcommand is provided.
"""
cli.print_help()


def main():
"""Setup our environment and then call the CLI entrypoint.
"""
# Change to the root of our checkout
os.environ['ORIG_CWD'] = os.getcwd()
os.chdir(qmk_dir)

try:
import_module(subcommand)
except ModuleNotFoundError as e:
if e.__class__.__name__ != subcommand:
raise
# Import the subcommands
import qmk.cli

milc.cli.log.error('Invalid subcommand! Could not import %s.', subcommand)
# Execute
return_code = milc.cli()

if return_code is False:
exit(1)

elif return_code is not True and isinstance(return_code, int):
if return_code < 0 or return_code > 255:
milc.cli.log.error('Invalid return_code: %d', return_code)
exit(255)

exit(return_code)

exit(0)


if __name__ == '__main__':
milc.cli()
main()
1 change: 0 additions & 1 deletion bin/qmk-compile-json

This file was deleted.

1 change: 0 additions & 1 deletion bin/qmk-doctor

This file was deleted.

1 change: 0 additions & 1 deletion bin/qmk-hello

This file was deleted.

1 change: 0 additions & 1 deletion bin/qmk-json-keymap

This file was deleted.

36 changes: 19 additions & 17 deletions bootloader.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,53 +19,55 @@
#
# Sets the bootloader defined in the keyboard's/keymap's rules.mk
# Current options:
# atmel-dfu
# lufa-dfu
# qmk-dfu
# halfkay
# caterina
# bootloadHID
#
# halfkay PJRC Teensy
# caterina Pro Micro (Sparkfun/generic)
# atmel-dfu Atmel factory DFU
# lufa-dfu LUFA DFU
# qmk-dfu QMK DFU (LUFA + blinkenlight)
# bootloadHID HIDBootFlash compatible (ATmega32A)
# USBasp USBaspLoader (ATmega328P)
#
# BOOTLOADER_SIZE can still be defined manually, but it's recommended
# you add any possible configuration to this list

ifeq ($(strip $(BOOTLOADER)), atmel-dfu)
OPT_DEFS += -DBOOTLOADER_ATMEL_DFU
OPT_DEFS += -DBOOTLOADER_DFU
ifeq ($(strip $(MCU)), atmega32u4)
BOOTLOADER_SIZE = 4096
ifneq (,$(filter $(MCU), at90usb646 atmega16u2 atmega16u4 atmega32u2 atmega32u4))
BOOTLOADER_SIZE = 4096
endif
ifeq ($(strip $(MCU)), at90usb1286)
BOOTLOADER_SIZE = 8192
BOOTLOADER_SIZE = 8192
endif
endif
ifeq ($(strip $(BOOTLOADER)), lufa-dfu)
OPT_DEFS += -DBOOTLOADER_LUFA_DFU
OPT_DEFS += -DBOOTLOADER_DFU
ifeq ($(strip $(MCU)), atmega32u4)
BOOTLOADER_SIZE = 4096
ifneq (,$(filter $(MCU), at90usb646 atmega16u2 atmega16u4 atmega32u2 atmega32u4))
BOOTLOADER_SIZE = 4096
endif
ifeq ($(strip $(MCU)), at90usb1286)
BOOTLOADER_SIZE = 8192
BOOTLOADER_SIZE = 8192
endif
endif
ifeq ($(strip $(BOOTLOADER)), qmk-dfu)
OPT_DEFS += -DBOOTLOADER_QMK_DFU
OPT_DEFS += -DBOOTLOADER_DFU
ifeq ($(strip $(MCU)), atmega32u4)
BOOTLOADER_SIZE = 4096
ifneq (,$(filter $(MCU), at90usb646 atmega16u2 atmega16u4 atmega32u2 atmega32u4))
BOOTLOADER_SIZE = 4096
endif
ifeq ($(strip $(MCU)), at90usb1286)
BOOTLOADER_SIZE = 8192
BOOTLOADER_SIZE = 8192
endif
endif
ifeq ($(strip $(BOOTLOADER)), halfkay)
OPT_DEFS += -DBOOTLOADER_HALFKAY
ifeq ($(strip $(MCU)), atmega32u4)
BOOTLOADER_SIZE = 512
BOOTLOADER_SIZE = 512
endif
ifeq ($(strip $(MCU)), at90usb1286)
BOOTLOADER_SIZE = 1024
BOOTLOADER_SIZE = 1024
endif
endif
ifeq ($(strip $(BOOTLOADER)), caterina)
Expand Down
2 changes: 1 addition & 1 deletion build_json.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ endif

# Generate the keymap.c
ifneq ("$(KEYMAP_JSON)","")
_ = $(shell test -e $(KEYMAP_C) || bin/qmk-json-keymap $(KEYMAP_JSON) -o $(KEYMAP_C))
_ = $(shell test -e $(KEYMAP_C) || bin/qmk json-keymap $(KEYMAP_JSON) -o $(KEYMAP_C))
endif
23 changes: 15 additions & 8 deletions common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -267,20 +267,21 @@ ifeq ($(strip $(ENCODER_ENABLE)), yes)
OPT_DEFS += -DENCODER_ENABLE
endif

ifeq ($(strip $(HAPTIC_ENABLE)), DRV2605L)
COMMON_VPATH += $(DRIVER_PATH)/haptic
SRC += haptic.c
HAPTIC_ENABLE ?= no
ifneq ($(strip $(HAPTIC_ENABLE)),no)
COMMON_VPATH += $(DRIVER_PATH)/haptic
SRC += haptic.c
OPT_DEFS += -DHAPTIC_ENABLE
endif

ifneq ($(filter DRV2605L, $(HAPTIC_ENABLE)), )
SRC += DRV2605L.c
QUANTUM_LIB_SRC += i2c_master.c
OPT_DEFS += -DHAPTIC_ENABLE
OPT_DEFS += -DDRV2605L
endif

ifeq ($(strip $(HAPTIC_ENABLE)), SOLENOID)
COMMON_VPATH += $(DRIVER_PATH)/haptic
SRC += haptic.c
ifneq ($(filter SOLENOID, $(HAPTIC_ENABLE)), )
SRC += solenoid.c
OPT_DEFS += -DHAPTIC_ENABLE
OPT_DEFS += -DSOLENOID_ENABLE
endif

Expand Down Expand Up @@ -358,3 +359,9 @@ ifeq ($(strip $(SPACE_CADET_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/process_keycode/process_space_cadet.c
OPT_DEFS += -DSPACE_CADET_ENABLE
endif


ifeq ($(strip $(DIP_SWITCH_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/dip_switch.c
OPT_DEFS += -DDIP_SWITCH_ENABLE
endif
Loading

0 comments on commit 59c720f

Please sign in to comment.