Skip to content

Commit

Permalink
Merge branch 'develop' into schema_improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tzarc authored Jul 27, 2021
2 parents 5b43c89 + 368efb5 commit 7e4b5f0
Show file tree
Hide file tree
Showing 403 changed files with 5,797 additions and 3,089 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ jobs:
output: ' '
fileOutput: ' '

- name: Run qmk cformat and qmk pyformat
- name: Run qmk format-c and qmk format-python
shell: 'bash {0}'
run: |
qmk cformat --core-only -n $(< ~/files.txt)
cformat_exit=$?
qmk pyformat -n
pyformat_exit=$?
qmk format-c --core-only -n $(< ~/files.txt)
format_c_exit=$?
qmk format-python -n
format_python_exit=$?
exit $((cformat_exit + pyformat_exit))
exit $((format_c_exit + format_python_exit))
6 changes: 6 additions & 0 deletions bootloader.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
# atmel-dfu Atmel factory DFU
# lufa-dfu LUFA DFU
# qmk-dfu QMK DFU (LUFA + blinkenlight)
# qmk-hid QMK HID (LUFA + blinkenlight)
# bootloadHID HIDBootFlash compatible (ATmega32A)
# USBasp USBaspLoader (ATmega328P)
# ARM:
Expand Down Expand Up @@ -67,6 +68,11 @@ ifeq ($(strip $(BOOTLOADER)), qmk-dfu)
BOOTLOADER_SIZE = 8192
endif
endif
ifeq ($(strip $(BOOTLOADER)), qmk-hid)
OPT_DEFS += -DBOOTLOADER_QMK_HID
OPT_DEFS += -DBOOTLOADER_HID
BOOTLOADER_SIZE = 4096
endif
ifeq ($(strip $(BOOTLOADER)), halfkay)
OPT_DEFS += -DBOOTLOADER_HALFKAY
ifeq ($(strip $(MCU)), atmega32u4)
Expand Down
13 changes: 11 additions & 2 deletions build_test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ GTEST_INTERNAL_INC :=\

$(GTEST_OUTPUT)_SRC :=\
googletest/src/gtest-all.cc\
googletest/src/gtest_main.cc\
googlemock/src/gmock-all.cc

$(GTEST_OUTPUT)_DEFS :=
Expand All @@ -35,14 +34,19 @@ CREATE_MAP := no

VPATH +=\
$(LIB_PATH)/googletest\
$(LIB_PATH)/googlemock
$(LIB_PATH)/googlemock\
$(LIB_PATH)/printf

all: elf

VPATH += $(COMMON_VPATH)
PLATFORM:=TEST
PLATFORM_KEY:=test

ifeq ($(strip $(DEBUG)), 1)
CONSOLE_ENABLE = yes
endif

ifneq ($(filter $(FULL_TESTS),$(TEST)),)
include tests/$(TEST)/rules.mk
endif
Expand All @@ -56,6 +60,11 @@ ifneq ($(filter $(FULL_TESTS),$(TEST)),)
include build_full_test.mk
endif

$(TEST)_SRC += \
tests/test_common/main.c \
$(LIB_PATH)/printf/printf.c \
$(COMMON_DIR)/printf.c

$(TEST_OBJ)/$(TEST)_SRC := $($(TEST)_SRC)
$(TEST_OBJ)/$(TEST)_INC := $($(TEST)_INC) $(VPATH) $(GTEST_INC)
$(TEST_OBJ)/$(TEST)_DEFS := $($(TEST)_DEFS)
Expand Down
8 changes: 2 additions & 6 deletions common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,6 @@ ifeq ($(strip $(LCD_ENABLE)), yes)
CIE1931_CURVE := yes
endif

# backward compat
ifeq ($(strip $(BACKLIGHT_CUSTOM_DRIVER)), yes)
BACKLIGHT_DRIVER := custom
endif

VALID_BACKLIGHT_TYPES := pwm timer software custom

BACKLIGHT_ENABLE ?= no
Expand Down Expand Up @@ -580,8 +575,9 @@ endif
HAPTIC_ENABLE ?= no
ifneq ($(strip $(HAPTIC_ENABLE)),no)
COMMON_VPATH += $(DRIVER_PATH)/haptic
SRC += haptic.c
OPT_DEFS += -DHAPTIC_ENABLE
SRC += $(QUANTUM_DIR)/haptic.c
SRC += $(QUANTUM_DIR)/process_keycode/process_haptic.c
endif

ifneq ($(filter DRV2605L, $(HAPTIC_ENABLE)), )
Expand Down
2 changes: 1 addition & 1 deletion data/schemas/keyboard.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
},
"bootloader": {
"type": "string",
"enum": ["atmel-dfu", "bootloadHID", "caterina", "halfkay", "kiibohd", "lufa-dfu", "lufa-ms", "micronucleus", "qmk-dfu", "stm32-dfu", "stm32duino", "unknown", "USBasp", "tinyuf2"],
"enum": ["atmel-dfu", "bootloadHID", "caterina", "halfkay", "kiibohd", "lufa-dfu", "lufa-ms", "micronucleus", "qmk-dfu", "qmk-hid", "stm32-dfu", "stm32duino", "unknown", "USBasp", "tinyuf2"],
},
"bootloader_instructions": {
"type": "string",
Expand Down
27 changes: 19 additions & 8 deletions docs/cli_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ qmk config [-ro] [config_token1] [config_token2] [...] [config_tokenN]

## `qmk console`

This command lets you connect to keyboard consoles to get debugging messages. It only works if your keyboard firmware has been compiled with `CONSOLE_ENABLED=yes`.
This command lets you connect to keyboard consoles to get debugging messages. It only works if your keyboard firmware has been compiled with `CONSOLE_ENABLE=yes`.

**Usage**:

Expand Down Expand Up @@ -314,7 +314,18 @@ qmk clean [-a]

# Developer Commands

## `qmk cformat`
## `qmk format-text`

This command formats text files to have proper line endings.

Every text file in the repository needs to have Unix (LF) line ending.
If you are working on **Windows**, you must ensure that line endings are corrected in order to get your PRs merged.

```
qmk format-text
```

## `qmk format-c`

This command formats C code using clang-format.

Expand All @@ -325,25 +336,25 @@ Run it with `-a` to format all core code, or pass filenames on the command line
**Usage for specified files**:

```
qmk cformat [file1] [file2] [...] [fileN]
qmk format-c [file1] [file2] [...] [fileN]
```

**Usage for all core files**:

```
qmk cformat -a
qmk format-c -a
```

**Usage for only changed files against origin/master**:

```
qmk cformat
qmk format-c
```

**Usage for only changed files against branch_name**:

```
qmk cformat -b branch_name
qmk format-c -b branch_name
```

## `qmk docs`
Expand Down Expand Up @@ -398,14 +409,14 @@ $ qmk kle2json -f kle.txt -f
Ψ Wrote out to info.json
```

## `qmk pyformat`
## `qmk format-python`

This command formats python code in `qmk_firmware`.

**Usage**:

```
qmk pyformat
qmk format-python
```

## `qmk pytest`
Expand Down
4 changes: 2 additions & 2 deletions docs/cli_development.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@ cli.log.info('Reading from %s and writing to %s', cli.args.filename, cli.args.ou

# Testing, and Linting, and Formatting (oh my!)

We use nose2, flake8, and yapf to test, lint, and format code. You can use the `pytest` and `pyformat` subcommands to run these tests:
We use nose2, flake8, and yapf to test, lint, and format code. You can use the `pytest` and `format-py` subcommands to run these tests:

### Testing and Linting

qmk pytest

### Formatting

qmk pyformat
qmk format-py

## Formatting Details

Expand Down
8 changes: 4 additions & 4 deletions docs/de/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ qmk compile <configuratorExport.json>
qmk compile -kb <keyboard_name> -km <keymap_name>
```

## `qmk cformat`
## `qmk format-c`

Dieser Befehl formatiert C-Code im clang-Format. Benutze ihn ohne Argumente, um den core-Code zu formatieren, oder benutze Namen von Dateien in der CLI, um den Befehl auf bestimmte Dateien anzuwenden.

**Anwendung**:

```
qmk cformat [file1] [file2] [...] [fileN]
qmk format-c [file1] [file2] [...] [fileN]
```

## `qmk config`
Expand Down Expand Up @@ -148,14 +148,14 @@ Dieser Befehl erstellt eine neue Keymap basierend auf einer existierenden Standa
qmk new-keymap [-kb KEYBOARD] [-km KEYMAP]
```

## `qmk pyformat`
## `qmk format-py`

Dieser Befehl formatiert Python-Code in `qmk_firmware`.

**Anwendung**:

```
qmk pyformat
qmk format-py
```

## `qmk pytest`
Expand Down
1 change: 1 addition & 0 deletions docs/driver_installation_zadig.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ The device name here is the name that appears in Zadig, and may not be what the
|`stm32-dfu` |STM32 BOOTLOADER |`0483:DF11` |WinUSB |
|`kiibohd` |Kiibohd DFU Bootloader |`1C11:B007` |WinUSB |
|`stm32duino` |Maple 003 |`1EAF:0003` |WinUSB |
|`qmk-hid` |(keyboard name) Bootloader |`03EB:2067` |HidUsb |
2 changes: 1 addition & 1 deletion docs/faq_debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ For compatible platforms, [QMK Toolbox](https://github.com/qmk/qmk_toolbox) can
Prefer a terminal based solution? [hid_listen](https://www.pjrc.com/teensy/hid_listen.html), provided by PJRC, can also be used to display debug messages. Prebuilt binaries for Windows,Linux,and MacOS are available.
## Sending Your Own Debug Messages
## Sending Your Own Debug Messages :id=debug-api
Sometimes it's useful to print debug messages from within your [custom code](custom_quantum_functions.md). Doing so is pretty simple. Start by including `print.h` at the top of your file:
Expand Down
2 changes: 1 addition & 1 deletion docs/feature_dip_switch.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The callback functions can be inserted into your `<keyboard>.c`:

```c
bool dip_switch_update_kb(uint8_t index, bool active) {
if !(dip_switch_update_user(index, active)) { return false; }
if (!dip_switch_update_user(index, active)) { return false; }
return true;
}
```
Expand Down
29 changes: 1 addition & 28 deletions docs/feature_led_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ For inspiration and examples, check out the built-in effects under `quantum/led_
#define LED_MATRIX_FRAMEBUFFER_EFFECTS // enable framebuffer effects
#define LED_DISABLE_TIMEOUT 0 // number of milliseconds to wait until led automatically turns off
#define LED_DISABLE_AFTER_TIMEOUT 0 // OBSOLETE: number of ticks to wait until disabling effects
#define LED_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended
#define LED_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
#define LED_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
#define LED_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
#define LED_MATRIX_MAXIMUM_BRIGHTNESS 255 // limits maximum brightness of LEDs
Expand Down Expand Up @@ -350,30 +350,3 @@ void led_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
LED_MATRIX_INDICATOR_SET_VALUE(index, value);
}
```

## Suspended State :id=suspended-state
To use the suspend feature, make sure that `#define LED_DISABLE_WHEN_USB_SUSPENDED true` is added to the `config.h` file.

Additionally add this to your `<keyboard>.c`:

```c
void suspend_power_down_kb(void) {
led_matrix_set_suspend_state(true);
suspend_power_down_user();
}

void suspend_wakeup_init_kb(void) {
led_matrix_set_suspend_state(false);
suspend_wakeup_init_user();
}
```
or add this to your `keymap.c`:
```c
void suspend_power_down_user(void) {
led_matrix_set_suspend_state(true);
}
void suspend_wakeup_init_user(void) {
led_matrix_set_suspend_state(false);
}
```
27 changes: 0 additions & 27 deletions docs/feature_rgb_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -741,30 +741,3 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
}
}
```
### Suspended state :id=suspended-state
To use the suspend feature, make sure that `#define RGB_DISABLE_WHEN_USB_SUSPENDED true` is added to the `config.h` file.
Additionally add this to your `<keyboard>.c`:
```c
void suspend_power_down_kb(void) {
rgb_matrix_set_suspend_state(true);
suspend_power_down_user();
}
void suspend_wakeup_init_kb(void) {
rgb_matrix_set_suspend_state(false);
suspend_wakeup_init_user();
}
```
or add this to your `keymap.c`:
```c
void suspend_power_down_user(void) {
rgb_matrix_set_suspend_state(true);
}

void suspend_wakeup_init_user(void) {
rgb_matrix_set_suspend_state(false);
}
```
46 changes: 46 additions & 0 deletions docs/flashing.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,52 @@ Flashing sequence:
3. Flash a .hex file
4. Reset the device into application mode (may be done automatically)

### QMK HID

QMK maintains [a fork of the LUFA HID bootloader](https://github.com/qmk/lufa/tree/master/Bootloaders/HID), which uses a USB HID Endpoint for flashing in the way that the PJRC's Teensy Loader flasher and HalfKay bootloader work. Additionally, it performs a simple matrix scan for exiting the bootloader and returning to the application, as well as flashing an LED/making a ticking noise with a speaker when things are happening.

To ensure compatibility with the QMK HID bootloader, make sure this block is present in your `rules.mk`:

```make
# Bootloader selection
BOOTLOADER = qmk-hid
```

To enable the additional features, add the following defines to your `config.h`:

```c
#define QMK_ESC_OUTPUT F1 // COL pin if COL2ROW
#define QMK_ESC_INPUT D5 // ROW pin if COL2ROW
// Optional:
//#define QMK_LED E6
//#define QMK_SPEAKER C6
```

Currently we do not recommend making `QMK_ESC` the same key as the one designated for [Bootmagic Lite](feature_bootmagic.md#bootmagic-lite), as holding it down will cause the MCU to loop back and forth between entering and exiting the bootloader.

The manufacturer and product strings are automatically pulled from `config.h`, with " Bootloader" appended to the product string.

To generate this bootloader, use the `bootloader` target, eg. `make planck/rev4:default:bootloader`. To generate a production-ready .hex file (combining QMK and the bootloader), use the `production` target, eg. `make planck/rev4:default:production`.

Compatible flashers:

* TBD
* Currently, you need to either use the [Python script](https://github.com/qmk/lufa/tree/master/Bootloaders/HID/HostLoaderApp_python), or compile [`hid_bootloader_cli`](https://github.com/qmk/lufa/tree/master/Bootloaders/HID/HostLoaderApp), from the LUFA repo. Homebrew may (will) have support for this directly (via `brew install qmk/qmk/hid_bootloader_cli`).

Flashing sequence:

1. Enter the bootloader using any of the following methods:
* Press the `RESET` keycode
* Press the `RESET` button on the PCB if available
* short RST to GND quickly
2. Wait for the OS to detect the device
3. Flash a .hex file
4. Reset the device into application mode (may be done automatically)

### `make` Targets

* `:qmk-hid`: Checks every 5 seconds until a DFU device is available, and then flashes the firmware.

## STM32/APM32 DFU

All STM32 and APM32 MCUs, except for F103 (see the [STM32duino section](#stm32duino)) come preloaded with a factory bootloader that cannot be modified nor deleted.
Expand Down
Loading

0 comments on commit 7e4b5f0

Please sign in to comment.