diff options
81 files changed, 750 insertions, 345 deletions
@@ -29,6 +29,13 @@ $(info QMK Firmware $(QMK_VERSION)) | |||
29 | endif | 29 | endif |
30 | endif | 30 | endif |
31 | 31 | ||
32 | # Determine which qmk cli to use | ||
33 | ifeq (, $(shell which qmk)) | ||
34 | QMK_BIN = bin/qmk | ||
35 | else | ||
36 | QMK_BIN = qmk | ||
37 | endif | ||
38 | |||
32 | # avoid 'Entering|Leaving directory' messages | 39 | # avoid 'Entering|Leaving directory' messages |
33 | MAKEFLAGS += --no-print-directory | 40 | MAKEFLAGS += --no-print-directory |
34 | 41 | ||
@@ -501,8 +508,8 @@ endef | |||
501 | %: | 508 | %: |
502 | # Check if we have the CMP tool installed | 509 | # Check if we have the CMP tool installed |
503 | cmp $(ROOT_DIR)/Makefile $(ROOT_DIR)/Makefile >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi; | 510 | cmp $(ROOT_DIR)/Makefile $(ROOT_DIR)/Makefile >/dev/null 2>&1; if [ $$? -gt 0 ]; then printf "$(MSG_NO_CMP)"; exit 1; fi; |
504 | # Ensure that bin/qmk works. | 511 | # Ensure that $(QMK_BIN) works. |
505 | if ! bin/qmk hello 1> /dev/null 2>&1; then printf "$(MSG_PYTHON_MISSING)"; exit 1; fi | 512 | if ! $(QMK_BIN) hello 1> /dev/null 2>&1; then printf "$(MSG_PYTHON_MISSING)"; exit 1; fi |
506 | # Check if the submodules are dirty, and display a warning if they are | 513 | # Check if the submodules are dirty, and display a warning if they are |
507 | ifndef SKIP_GIT | 514 | ifndef SKIP_GIT |
508 | if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 50 --init lib/chibios; fi | 515 | if [ ! -e lib/chibios ]; then git submodule sync lib/chibios && git submodule update --depth 50 --init lib/chibios; fi |
@@ -75,6 +75,8 @@ def main(): | |||
75 | os.environ['ORIG_CWD'] = os.getcwd() | 75 | os.environ['ORIG_CWD'] = os.getcwd() |
76 | os.chdir(qmk_dir) | 76 | os.chdir(qmk_dir) |
77 | 77 | ||
78 | print('Warning: The bin/qmk script is being deprecated. Please install the QMK CLI: python3 -m pip install qmk', file=sys.stderr) | ||
79 | |||
78 | # Import the subcommands | 80 | # Import the subcommands |
79 | import qmk.cli # noqa | 81 | import qmk.cli # noqa |
80 | 82 | ||
diff --git a/build_json.mk b/build_json.mk index 6e2f9c4c8..8822be6a1 100644 --- a/build_json.mk +++ b/build_json.mk | |||
@@ -28,4 +28,4 @@ endif | |||
28 | 28 | ||
29 | # Generate the keymap.c | 29 | # Generate the keymap.c |
30 | $(KEYBOARD_OUTPUT)/src/keymap.c: $(KEYMAP_JSON) | 30 | $(KEYBOARD_OUTPUT)/src/keymap.c: $(KEYMAP_JSON) |
31 | bin/qmk json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON) | 31 | $(QMK_BIN) json2c --quiet --output $(KEYMAP_C) $(KEYMAP_JSON) |
diff --git a/build_keyboard.mk b/build_keyboard.mk index 366d1f5d2..74046a094 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk | |||
@@ -12,6 +12,9 @@ endif | |||
12 | 12 | ||
13 | include common.mk | 13 | include common.mk |
14 | 14 | ||
15 | # Set the qmk cli to use | ||
16 | QMK_BIN ?= qmk | ||
17 | |||
15 | # Set the filename for the final firmware binary | 18 | # Set the filename for the final firmware binary |
16 | KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD)) | 19 | KEYBOARD_FILESAFE := $(subst /,_,$(KEYBOARD)) |
17 | TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP) | 20 | TARGET ?= $(KEYBOARD_FILESAFE)_$(KEYMAP) |
@@ -97,7 +100,7 @@ MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP) | |||
97 | MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP) | 100 | MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP) |
98 | 101 | ||
99 | # Pull in rules from info.json | 102 | # Pull in rules from info.json |
100 | INFO_RULES_MK = $(shell bin/qmk generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/rules.mk) | 103 | INFO_RULES_MK = $(shell $(QMK_BIN) generate-rules-mk --quiet --escape --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/rules.mk) |
101 | include $(INFO_RULES_MK) | 104 | include $(INFO_RULES_MK) |
102 | 105 | ||
103 | # Check for keymap.json first, so we can regenerate keymap.c | 106 | # Check for keymap.json first, so we can regenerate keymap.c |
@@ -294,10 +297,10 @@ endif | |||
294 | CONFIG_H += $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h | 297 | CONFIG_H += $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h |
295 | 298 | ||
296 | $(KEYBOARD_OUTPUT)/src/info_config.h: $(INFO_JSON_FILES) | 299 | $(KEYBOARD_OUTPUT)/src/info_config.h: $(INFO_JSON_FILES) |
297 | bin/qmk generate-config-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_config.h | 300 | $(QMK_BIN) generate-config-h --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/info_config.h |
298 | 301 | ||
299 | $(KEYBOARD_OUTPUT)/src/layouts.h: $(INFO_JSON_FILES) | 302 | $(KEYBOARD_OUTPUT)/src/layouts.h: $(INFO_JSON_FILES) |
300 | bin/qmk generate-layouts --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/layouts.h | 303 | $(QMK_BIN) generate-layouts --quiet --keyboard $(KEYBOARD) --output $(KEYBOARD_OUTPUT)/src/layouts.h |
301 | 304 | ||
302 | generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h | 305 | generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/layouts.h |
303 | 306 | ||
diff --git a/common_features.mk b/common_features.mk index 8c9d0a90c..fdc481fd2 100644 --- a/common_features.mk +++ b/common_features.mk | |||
@@ -223,11 +223,10 @@ VALID_LED_MATRIX_TYPES := IS31FL3731 custom | |||
223 | 223 | ||
224 | ifeq ($(strip $(LED_MATRIX_ENABLE)), yes) | 224 | ifeq ($(strip $(LED_MATRIX_ENABLE)), yes) |
225 | ifeq ($(filter $(LED_MATRIX_DRIVER),$(VALID_LED_MATRIX_TYPES)),) | 225 | ifeq ($(filter $(LED_MATRIX_DRIVER),$(VALID_LED_MATRIX_TYPES)),) |
226 | $(error LED_MATRIX_DRIVER="$(LED_MATRIX_DRIVER)" is not a valid matrix type) | 226 | $(error "$(LED_MATRIX_DRIVER)" is not a valid matrix type) |
227 | else | 227 | else |
228 | BACKLIGHT_ENABLE = yes | ||
229 | BACKLIGHT_DRIVER = custom | ||
230 | OPT_DEFS += -DLED_MATRIX_ENABLE | 228 | OPT_DEFS += -DLED_MATRIX_ENABLE |
229 | SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c | ||
231 | SRC += $(QUANTUM_DIR)/led_matrix.c | 230 | SRC += $(QUANTUM_DIR)/led_matrix.c |
232 | SRC += $(QUANTUM_DIR)/led_matrix_drivers.c | 231 | SRC += $(QUANTUM_DIR)/led_matrix_drivers.c |
233 | endif | 232 | endif |
@@ -422,10 +421,6 @@ ifeq ($(strip $(TERMINAL_ENABLE)), yes) | |||
422 | OPT_DEFS += -DUSER_PRINT | 421 | OPT_DEFS += -DUSER_PRINT |
423 | endif | 422 | endif |
424 | 423 | ||
425 | ifeq ($(strip $(USB_HID_ENABLE)), yes) | ||
426 | include $(TMK_DIR)/protocol/usb_hid.mk | ||
427 | endif | ||
428 | |||
429 | ifeq ($(strip $(WPM_ENABLE)), yes) | 424 | ifeq ($(strip $(WPM_ENABLE)), yes) |
430 | SRC += $(QUANTUM_DIR)/wpm.c | 425 | SRC += $(QUANTUM_DIR)/wpm.c |
431 | OPT_DEFS += -DWPM_ENABLE | 426 | OPT_DEFS += -DWPM_ENABLE |
@@ -459,6 +454,23 @@ ifeq ($(strip $(DIP_SWITCH_ENABLE)), yes) | |||
459 | SRC += $(QUANTUM_DIR)/dip_switch.c | 454 | SRC += $(QUANTUM_DIR)/dip_switch.c |
460 | endif | 455 | endif |
461 | 456 | ||
457 | VALID_MAGIC_TYPES := yes full lite | ||
458 | BOOTMAGIC_ENABLE ?= no | ||
459 | ifneq ($(strip $(BOOTMAGIC_ENABLE)), no) | ||
460 | ifeq ($(filter $(BOOTMAGIC_ENABLE),$(VALID_MAGIC_TYPES)),) | ||
461 | $(error BOOTMAGIC_ENABLE="$(BOOTMAGIC_ENABLE)" is not a valid type of magic) | ||
462 | endif | ||
463 | ifeq ($(strip $(BOOTMAGIC_ENABLE)), lite) | ||
464 | OPT_DEFS += -DBOOTMAGIC_LITE | ||
465 | QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/bootmagic_lite.c | ||
466 | else | ||
467 | OPT_DEFS += -DBOOTMAGIC_ENABLE | ||
468 | QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/bootmagic_full.c | ||
469 | endif | ||
470 | endif | ||
471 | COMMON_VPATH += $(QUANTUM_DIR)/bootmagic | ||
472 | QUANTUM_SRC += $(QUANTUM_DIR)/bootmagic/magic.c | ||
473 | |||
462 | VALID_CUSTOM_MATRIX_TYPES:= yes lite no | 474 | VALID_CUSTOM_MATRIX_TYPES:= yes lite no |
463 | 475 | ||
464 | CUSTOM_MATRIX ?= no | 476 | CUSTOM_MATRIX ?= no |
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md index fd866bd57..878acaf8b 100644 --- a/docs/feature_rgb_matrix.md +++ b/docs/feature_rgb_matrix.md | |||
@@ -439,6 +439,8 @@ These are defined in [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blo | |||
439 | #define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set | 439 | #define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS // Sets the default brightness value, if none has been set |
440 | #define RGB_MATRIX_STARTUP_SPD 127 // Sets the default animation speed, if none has been set | 440 | #define RGB_MATRIX_STARTUP_SPD 127 // Sets the default animation speed, if none has been set |
441 | #define RGB_MATRIX_DISABLE_KEYCODES // disables control of rgb matrix by keycodes (must use code functions to control the feature) | 441 | #define RGB_MATRIX_DISABLE_KEYCODES // disables control of rgb matrix by keycodes (must use code functions to control the feature) |
442 | #define RGB_MATRIX_SPLIT { X, Y } // (Optional) For split keyboards, the number of LEDs connected on each half. X = left, Y = Right. | ||
443 | // If RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is enabled, you also will want to enable SPLIT_TRANSPORT_MIRROR | ||
442 | ``` | 444 | ``` |
443 | 445 | ||
444 | ## EEPROM storage :id=eeprom-storage | 446 | ## EEPROM storage :id=eeprom-storage |
diff --git a/docs/keycodes.md b/docs/keycodes.md index 9acf8b683..f3c519b13 100644 --- a/docs/keycodes.md +++ b/docs/keycodes.md | |||
@@ -516,6 +516,9 @@ See also: [One Shot Keys](one_shot_keys.md) | |||
516 | |------------|----------------------------------| | 516 | |------------|----------------------------------| |
517 | |`OSM(mod)` |Hold `mod` for one keypress | | 517 | |`OSM(mod)` |Hold `mod` for one keypress | |
518 | |`OSL(layer)`|Switch to `layer` for one keypress| | 518 | |`OSL(layer)`|Switch to `layer` for one keypress| |
519 | |`OS_ON` |Turns One Shot keys on | | ||
520 | |`OS_OFF` |Turns One Shot keys off | | ||
521 | |`OS_TOGG` |Toggles One Shot keys status | | ||
519 | 522 | ||
520 | ## Space Cadet :id=space-cadet | 523 | ## Space Cadet :id=space-cadet |
521 | 524 | ||
diff --git a/docs/one_shot_keys.md b/docs/one_shot_keys.md index 9a082d7d6..9fc548629 100644 --- a/docs/one_shot_keys.md +++ b/docs/one_shot_keys.md | |||
@@ -17,6 +17,9 @@ You can control the behavior of one shot keys by defining these in `config.h`: | |||
17 | 17 | ||
18 | * `OSM(mod)` - Momentarily hold down *mod*. You must use the `MOD_*` keycodes as shown in [Mod Tap](mod_tap.md), not the `KC_*` codes. | 18 | * `OSM(mod)` - Momentarily hold down *mod*. You must use the `MOD_*` keycodes as shown in [Mod Tap](mod_tap.md), not the `KC_*` codes. |
19 | * `OSL(layer)` - momentary switch to *layer*. | 19 | * `OSL(layer)` - momentary switch to *layer*. |
20 | * `OS_ON` - Turns on One Shot keys. | ||
21 | * `OS_OFF` - Turns off One Shot keys. OSM act as regular mod keys, OSL act like `MO`. | ||
22 | * `ON_TOGG` - Toggles the one shot key status. | ||
20 | 23 | ||
21 | Sometimes, you want to activate a one-shot key as part of a macro or tap dance routine. | 24 | Sometimes, you want to activate a one-shot key as part of a macro or tap dance routine. |
22 | 25 | ||
diff --git a/docs/ws2812_driver.md b/docs/ws2812_driver.md index cca6827ec..fa14f02fd 100644 --- a/docs/ws2812_driver.md +++ b/docs/ws2812_driver.md | |||
@@ -102,11 +102,14 @@ Configure the hardware via your config.h: | |||
102 | #define WS2812_PWM_DRIVER PWMD2 // default: PWMD2 | 102 | #define WS2812_PWM_DRIVER PWMD2 // default: PWMD2 |
103 | #define WS2812_PWM_CHANNEL 2 // default: 2 | 103 | #define WS2812_PWM_CHANNEL 2 // default: 2 |
104 | #define WS2812_PWM_PAL_MODE 2 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2 | 104 | #define WS2812_PWM_PAL_MODE 2 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2 |
105 | //#define WS2812_PWM_COMPLEMENTARY_OUTPUT // Define for a complementary timer output (TIMx_CHyN); omit for a normal timer output (TIMx_CHy). | ||
105 | #define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. | 106 | #define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. |
106 | #define WS2812_DMA_CHANNEL 2 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. | 107 | #define WS2812_DMA_CHANNEL 2 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU. |
107 | #define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM2_UP // DMAMUX configuration for TIMx_UP -- only required if your MCU has a DMAMUX peripheral, see the respective reference manual for the appropriate values for your MCU. | 108 | #define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM2_UP // DMAMUX configuration for TIMx_UP -- only required if your MCU has a DMAMUX peripheral, see the respective reference manual for the appropriate values for your MCU. |
108 | ``` | 109 | ``` |
109 | 110 | ||
111 | Note that using a complementary timer output (TIMx_CHyN) is possible only for advanced-control timers (TIM1, TIM8, TIM20 on STM32), and the `STM32_PWM_USE_ADVANCED` option in mcuconf.h must be set to `TRUE`. Complementary outputs of general-purpose timers are not supported due to ChibiOS limitations. | ||
112 | |||
110 | You must also turn on the PWM feature in your halconf.h and mcuconf.h | 113 | You must also turn on the PWM feature in your halconf.h and mcuconf.h |
111 | 114 | ||
112 | #### Testing Notes | 115 | #### Testing Notes |
diff --git a/drivers/chibios/ws2812_pwm.c b/drivers/chibios/ws2812_pwm.c index 140120d48..e6af55b6b 100644 --- a/drivers/chibios/ws2812_pwm.c +++ b/drivers/chibios/ws2812_pwm.c | |||
@@ -27,6 +27,15 @@ | |||
27 | # error "please consult your MCU's datasheet and specify in your config.h: #define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM?_UP" | 27 | # error "please consult your MCU's datasheet and specify in your config.h: #define WS2812_DMAMUX_ID STM32_DMAMUX1_TIM?_UP" |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #ifndef WS2812_PWM_COMPLEMENTARY_OUTPUT | ||
31 | # define WS2812_PWM_OUTPUT_MODE PWM_OUTPUT_ACTIVE_HIGH | ||
32 | #else | ||
33 | # if !STM32_PWM_USE_ADVANCED | ||
34 | # error "WS2812_PWM_COMPLEMENTARY_OUTPUT requires STM32_PWM_USE_ADVANCED == TRUE" | ||
35 | # endif | ||
36 | # define WS2812_PWM_OUTPUT_MODE PWM_COMPLEMENTARY_OUTPUT_ACTIVE_HIGH | ||
37 | #endif | ||
38 | |||
30 | // Push Pull or Open Drain Configuration | 39 | // Push Pull or Open Drain Configuration |
31 | // Default Push Pull | 40 | // Default Push Pull |
32 | #ifndef WS2812_EXTERNAL_PULLUP | 41 | #ifndef WS2812_EXTERNAL_PULLUP |
@@ -247,7 +256,7 @@ void ws2812_init(void) { | |||
247 | .channels = | 256 | .channels = |
248 | { | 257 | { |
249 | [0 ... 3] = {.mode = PWM_OUTPUT_DISABLED, .callback = NULL}, // Channels default to disabled | 258 | [0 ... 3] = {.mode = PWM_OUTPUT_DISABLED, .callback = NULL}, // Channels default to disabled |
250 | [WS2812_PWM_CHANNEL - 1] = {.mode = PWM_OUTPUT_ACTIVE_HIGH, .callback = NULL}, // Turn on the channel we care about | 259 | [WS2812_PWM_CHANNEL - 1] = {.mode = WS2812_PWM_OUTPUT_MODE, .callback = NULL}, // Turn on the channel we care about |
251 | }, | 260 | }, |
252 | .cr2 = 0, | 261 | .cr2 = 0, |
253 | .dier = TIM_DIER_UDE, // DMA on update event for next period | 262 | .dier = TIM_DIER_UDE, // DMA on update event for next period |
diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h index 72ab21247..00896f01c 100644 --- a/drivers/oled/oled_driver.h +++ b/drivers/oled/oled_driver.h | |||
@@ -158,6 +158,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
158 | # define OLED_I2C_TIMEOUT 100 | 158 | # define OLED_I2C_TIMEOUT 100 |
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | #if !defined(OLED_UPDATE_INTERVAL) && defined(SPLIT_KEYBOARD) | ||
162 | # define OLED_UPDATE_INTERVAL 50 | ||
163 | #endif | ||
164 | |||
161 | typedef struct __attribute__((__packed__)) { | 165 | typedef struct __attribute__((__packed__)) { |
162 | uint8_t *current_element; | 166 | uint8_t *current_element; |
163 | uint16_t remaining_element_count; | 167 | uint16_t remaining_element_count; |
diff --git a/keyboards/aeboards/ext65/rev2/config.h b/keyboards/aeboards/ext65/rev2/config.h index 541f07ee9..dc1bfb71c 100644 --- a/keyboards/aeboards/ext65/rev2/config.h +++ b/keyboards/aeboards/ext65/rev2/config.h | |||
@@ -74,3 +74,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
74 | #define BACKLIGHT_LEVELS 6 | 74 | #define BACKLIGHT_LEVELS 6 |
75 | #define BACKLIGHT_BREATHING | 75 | #define BACKLIGHT_BREATHING |
76 | #define BREATHING_PERIOD 6 | 76 | #define BREATHING_PERIOD 6 |
77 | |||
78 | #define SLEEP_LED_GPT_DRIVER GPTD1 | ||
diff --git a/keyboards/aeboards/ext65/rev2/halconf.h b/keyboards/aeboards/ext65/rev2/halconf.h index 6e2f53640..9fa1eca60 100644 --- a/keyboards/aeboards/ext65/rev2/halconf.h +++ b/keyboards/aeboards/ext65/rev2/halconf.h | |||
@@ -27,5 +27,7 @@ | |||
27 | 27 | ||
28 | #define HAL_USE_SPI TRUE | 28 | #define HAL_USE_SPI TRUE |
29 | 29 | ||
30 | #define HAL_USE_GPT TRUE | ||
31 | |||
30 | #include_next <halconf.h> | 32 | #include_next <halconf.h> |
31 | 33 | ||
diff --git a/keyboards/aeboards/ext65/rev2/mcuconf.h b/keyboards/aeboards/ext65/rev2/mcuconf.h index 26ce80615..43d53d4f2 100644 --- a/keyboards/aeboards/ext65/rev2/mcuconf.h +++ b/keyboards/aeboards/ext65/rev2/mcuconf.h | |||
@@ -32,3 +32,5 @@ | |||
32 | #undef STM32_SPI_USE_SPI2 | 32 | #undef STM32_SPI_USE_SPI2 |
33 | #define STM32_SPI_USE_SPI2 TRUE | 33 | #define STM32_SPI_USE_SPI2 TRUE |
34 | 34 | ||
35 | #undef STM32_GPT_USE_TIM1 | ||
36 | #define STM32_GPT_USE_TIM1 TRUE | ||
diff --git a/keyboards/cannonkeys/an_c/rules.mk b/keyboards/cannonkeys/an_c/rules.mk index 8ed2d0ead..7309744d1 100644 --- a/keyboards/cannonkeys/an_c/rules.mk +++ b/keyboards/cannonkeys/an_c/rules.mk | |||
@@ -11,7 +11,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys | |||
11 | EXTRAKEY_ENABLE = yes # Audio control and System control | 11 | EXTRAKEY_ENABLE = yes # Audio control and System control |
12 | CONSOLE_ENABLE = yes # Console for debug | 12 | CONSOLE_ENABLE = yes # Console for debug |
13 | COMMAND_ENABLE = yes # Commands for debug and configuration | 13 | COMMAND_ENABLE = yes # Commands for debug and configuration |
14 | SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | 14 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
15 | NKRO_ENABLE = yes # USB Nkey Rollover | 15 | NKRO_ENABLE = yes # USB Nkey Rollover |
16 | CUSTOM_MATRIX = no # Custom matrix file | 16 | CUSTOM_MATRIX = no # Custom matrix file |
17 | BACKLIGHT_ENABLE = yes | 17 | BACKLIGHT_ENABLE = yes |
diff --git a/keyboards/cannonkeys/chimera65/rules.mk b/keyboards/cannonkeys/chimera65/rules.mk index 4d940da78..a08f2fa49 100644 --- a/keyboards/cannonkeys/chimera65/rules.mk +++ b/keyboards/cannonkeys/chimera65/rules.mk | |||
@@ -11,7 +11,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys | |||
11 | EXTRAKEY_ENABLE = yes # Audio control and System control | 11 | EXTRAKEY_ENABLE = yes # Audio control and System control |
12 | CONSOLE_ENABLE = yes # Console for debug | 12 | CONSOLE_ENABLE = yes # Console for debug |
13 | COMMAND_ENABLE = yes # Commands for debug and configuration | 13 | COMMAND_ENABLE = yes # Commands for debug and configuration |
14 | SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | 14 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
15 | NKRO_ENABLE = yes # USB Nkey Rollover | 15 | NKRO_ENABLE = yes # USB Nkey Rollover |
16 | CUSTOM_MATRIX = no # Custom matrix file | 16 | CUSTOM_MATRIX = no # Custom matrix file |
17 | BACKLIGHT_ENABLE = yes | 17 | BACKLIGHT_ENABLE = yes |
diff --git a/keyboards/cannonkeys/instant60/rules.mk b/keyboards/cannonkeys/instant60/rules.mk index 0973ad954..e5ba2903b 100644 --- a/keyboards/cannonkeys/instant60/rules.mk +++ b/keyboards/cannonkeys/instant60/rules.mk | |||
@@ -10,7 +10,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys | |||
10 | EXTRAKEY_ENABLE = yes # Audio control and System control | 10 | EXTRAKEY_ENABLE = yes # Audio control and System control |
11 | CONSOLE_ENABLE = yes # Console for debug | 11 | CONSOLE_ENABLE = yes # Console for debug |
12 | COMMAND_ENABLE = yes # Commands for debug and configuration | 12 | COMMAND_ENABLE = yes # Commands for debug and configuration |
13 | SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | 13 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
14 | NKRO_ENABLE = yes # USB Nkey Rollover | 14 | NKRO_ENABLE = yes # USB Nkey Rollover |
15 | CUSTOM_MATRIX = no # Custom matrix file | 15 | CUSTOM_MATRIX = no # Custom matrix file |
16 | BACKLIGHT_ENABLE = yes | 16 | BACKLIGHT_ENABLE = yes |
diff --git a/keyboards/cannonkeys/iron165/rules.mk b/keyboards/cannonkeys/iron165/rules.mk index 3925458dd..9de75a614 100644 --- a/keyboards/cannonkeys/iron165/rules.mk +++ b/keyboards/cannonkeys/iron165/rules.mk | |||
@@ -9,7 +9,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys | |||
9 | EXTRAKEY_ENABLE = yes # Audio control and System control | 9 | EXTRAKEY_ENABLE = yes # Audio control and System control |
10 | CONSOLE_ENABLE = yes # Console for debug | 10 | CONSOLE_ENABLE = yes # Console for debug |
11 | COMMAND_ENABLE = yes # Commands for debug and configuration | 11 | COMMAND_ENABLE = yes # Commands for debug and configuration |
12 | SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | 12 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
13 | NKRO_ENABLE = yes # USB Nkey Rollover | 13 | NKRO_ENABLE = yes # USB Nkey Rollover |
14 | CUSTOM_MATRIX = no # Custom matrix file | 14 | CUSTOM_MATRIX = no # Custom matrix file |
15 | BACKLIGHT_ENABLE = yes | 15 | BACKLIGHT_ENABLE = yes |
diff --git a/keyboards/cannonkeys/satisfaction75/rules.mk b/keyboards/cannonkeys/satisfaction75/rules.mk index e3abea546..3861b4849 100644 --- a/keyboards/cannonkeys/satisfaction75/rules.mk +++ b/keyboards/cannonkeys/satisfaction75/rules.mk | |||
@@ -15,7 +15,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys | |||
15 | EXTRAKEY_ENABLE = yes # Audio control and System control | 15 | EXTRAKEY_ENABLE = yes # Audio control and System control |
16 | CONSOLE_ENABLE = yes # Console for debug | 16 | CONSOLE_ENABLE = yes # Console for debug |
17 | COMMAND_ENABLE = yes # Commands for debug and configuration | 17 | COMMAND_ENABLE = yes # Commands for debug and configuration |
18 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | 18 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
19 | NKRO_ENABLE = yes # USB Nkey Rollover | 19 | NKRO_ENABLE = yes # USB Nkey Rollover |
20 | CUSTOM_MATRIX = no # Custom matrix file | 20 | CUSTOM_MATRIX = no # Custom matrix file |
21 | ENCODER_ENABLE = yes | 21 | ENCODER_ENABLE = yes |
diff --git a/keyboards/cannonkeys/savage65/rules.mk b/keyboards/cannonkeys/savage65/rules.mk index 8e1b984fd..2454573d2 100644 --- a/keyboards/cannonkeys/savage65/rules.mk +++ b/keyboards/cannonkeys/savage65/rules.mk | |||
@@ -11,7 +11,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys | |||
11 | EXTRAKEY_ENABLE = yes # Audio control and System control | 11 | EXTRAKEY_ENABLE = yes # Audio control and System control |
12 | CONSOLE_ENABLE = yes # Console for debug | 12 | CONSOLE_ENABLE = yes # Console for debug |
13 | COMMAND_ENABLE = yes # Commands for debug and configuration | 13 | COMMAND_ENABLE = yes # Commands for debug and configuration |
14 | SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | 14 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
15 | NKRO_ENABLE = yes # USB Nkey Rollover | 15 | NKRO_ENABLE = yes # USB Nkey Rollover |
16 | CUSTOM_MATRIX = no # Custom matrix file | 16 | CUSTOM_MATRIX = no # Custom matrix file |
17 | BACKLIGHT_ENABLE = yes | 17 | BACKLIGHT_ENABLE = yes |
diff --git a/keyboards/cannonkeys/tmov2/rules.mk b/keyboards/cannonkeys/tmov2/rules.mk index 9b29e8fd1..294c873ee 100644 --- a/keyboards/cannonkeys/tmov2/rules.mk +++ b/keyboards/cannonkeys/tmov2/rules.mk | |||
@@ -11,7 +11,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys | |||
11 | EXTRAKEY_ENABLE = yes # Audio control and System control | 11 | EXTRAKEY_ENABLE = yes # Audio control and System control |
12 | CONSOLE_ENABLE = yes # Console for debug | 12 | CONSOLE_ENABLE = yes # Console for debug |
13 | COMMAND_ENABLE = yes # Commands for debug and configuration | 13 | COMMAND_ENABLE = yes # Commands for debug and configuration |
14 | SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | 14 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
15 | NKRO_ENABLE = yes # USB Nkey Rollover | 15 | NKRO_ENABLE = yes # USB Nkey Rollover |
16 | CUSTOM_MATRIX = no # Custom matrix file | 16 | CUSTOM_MATRIX = no # Custom matrix file |
17 | BACKLIGHT_ENABLE = yes | 17 | BACKLIGHT_ENABLE = yes |
diff --git a/keyboards/cannonkeys/tsukuyomi/rules.mk b/keyboards/cannonkeys/tsukuyomi/rules.mk index ce881f198..4e7791a79 100644 --- a/keyboards/cannonkeys/tsukuyomi/rules.mk +++ b/keyboards/cannonkeys/tsukuyomi/rules.mk | |||
@@ -10,7 +10,7 @@ EXTRAKEY_ENABLE = yes # Audio control and System control | |||
10 | CONSOLE_ENABLE = yes # Console for debug | 10 | CONSOLE_ENABLE = yes # Console for debug |
11 | COMMAND_ENABLE = yes # Commands for debug and configuration | 11 | COMMAND_ENABLE = yes # Commands for debug and configuration |
12 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | 12 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE |
13 | SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | 13 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
14 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | 14 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work |
15 | NKRO_ENABLE = yes # USB Nkey Rollover | 15 | NKRO_ENABLE = yes # USB Nkey Rollover |
16 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality | 16 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality |
diff --git a/keyboards/crkbd/rev1/common/config.h b/keyboards/crkbd/rev1/common/config.h index a2c2cde0b..b468fe395 100644 --- a/keyboards/crkbd/rev1/common/config.h +++ b/keyboards/crkbd/rev1/common/config.h | |||
@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
23 | 23 | ||
24 | #ifdef RGB_MATRIX_ENABLE | 24 | #ifdef RGB_MATRIX_ENABLE |
25 | # define RGB_MATRIX_SPLIT { 27, 27 } | 25 | # define RGB_MATRIX_SPLIT { 27, 27 } |
26 | # define SPLIT_TRANSPORT_MIRROR | ||
26 | #endif | 27 | #endif |
27 | 28 | ||
28 | #define DIODE_DIRECTION COL2ROW | 29 | #define DIODE_DIRECTION COL2ROW |
diff --git a/keyboards/crkbd/rev1/common/rules.mk b/keyboards/crkbd/rev1/common/rules.mk index 0b8106e3f..d38a61809 100644 --- a/keyboards/crkbd/rev1/common/rules.mk +++ b/keyboards/crkbd/rev1/common/rules.mk | |||
@@ -1,2 +1 @@ | |||
1 | SPLIT_KEYBOARD = yes | SPLIT_KEYBOARD = yes | |
2 | SPLIT_TRANSPORT = mirror # for when Split Mirroring drops, it will maintain mirroring functionality | ||
diff --git a/keyboards/crkbd/rev1/rev1.c b/keyboards/crkbd/rev1/rev1.c index f2df8942a..347f98150 100644 --- a/keyboards/crkbd/rev1/rev1.c +++ b/keyboards/crkbd/rev1/rev1.c | |||
@@ -87,7 +87,7 @@ led_config_t g_led_config = { { | |||
87 | 87 | ||
88 | void matrix_init_kb(void) { | 88 | void matrix_init_kb(void) { |
89 | 89 | ||
90 | #ifdef RGB_MATRIX_ENABLE | 90 | #if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_SPLIT) |
91 | if (!isLeftHand) { | 91 | if (!isLeftHand) { |
92 | g_led_config = (led_config_t){ { | 92 | g_led_config = (led_config_t){ { |
93 | { 51, 50, 45, 44, 37, 36 }, | 93 | { 51, 50, 45, 44, 37, 36 }, |
diff --git a/keyboards/daji/seis_cinco/rules.mk b/keyboards/daji/seis_cinco/rules.mk index fa34092cd..768e50069 100644 --- a/keyboards/daji/seis_cinco/rules.mk +++ b/keyboards/daji/seis_cinco/rules.mk | |||
@@ -11,7 +11,7 @@ EXTRAKEY_ENABLE = yes # Audio control and System control | |||
11 | CONSOLE_ENABLE = no # Console for debug | 11 | CONSOLE_ENABLE = no # Console for debug |
12 | COMMAND_ENABLE = no # Commands for debug and configuration | 12 | COMMAND_ENABLE = no # Commands for debug and configuration |
13 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | 13 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE |
14 | SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | 14 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
15 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | 15 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work |
16 | NKRO_ENABLE = yes # USB Nkey Rollover | 16 | NKRO_ENABLE = yes # USB Nkey Rollover |
17 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | 17 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality |
diff --git a/keyboards/handwired/ck4x4/rules.mk b/keyboards/handwired/ck4x4/rules.mk index 0709f341b..e5785270b 100644 --- a/keyboards/handwired/ck4x4/rules.mk +++ b/keyboards/handwired/ck4x4/rules.mk | |||
@@ -10,7 +10,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys | |||
10 | EXTRAKEY_ENABLE = yes # Audio control and System control | 10 | EXTRAKEY_ENABLE = yes # Audio control and System control |
11 | CONSOLE_ENABLE = yes # Console for debug | 11 | CONSOLE_ENABLE = yes # Console for debug |
12 | COMMAND_ENABLE = yes # Commands for debug and configuration | 12 | COMMAND_ENABLE = yes # Commands for debug and configuration |
13 | SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | 13 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
14 | NKRO_ENABLE = yes # USB Nkey Rollover | 14 | NKRO_ENABLE = yes # USB Nkey Rollover |
15 | CUSTOM_MATRIX = no # Custom matrix file | 15 | CUSTOM_MATRIX = no # Custom matrix file |
16 | 16 | ||
diff --git a/keyboards/handwired/onekey/rules.mk b/keyboards/handwired/onekey/rules.mk index 259050d55..df2ec1ecf 100644 --- a/keyboards/handwired/onekey/rules.mk +++ b/keyboards/handwired/onekey/rules.mk | |||
@@ -7,9 +7,9 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | |||
7 | CONSOLE_ENABLE = yes # Console for debug(+400) | 7 | CONSOLE_ENABLE = yes # Console for debug(+400) |
8 | COMMAND_ENABLE = no # Commands for debug and configuration | 8 | COMMAND_ENABLE = no # Commands for debug and configuration |
9 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | 9 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE |
10 | SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | 10 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
11 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | 11 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work |
12 | NKRO_ENABLE = yes # USB Nkey Rollover | 12 | NKRO_ENABLE = yes # USB Nkey Rollover |
13 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default | 13 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default |
14 | RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow | 14 | RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow |
15 | MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) | 15 | MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) |
diff --git a/keyboards/projectkb/alice/config.h b/keyboards/projectkb/alice/config.h new file mode 100644 index 000000000..95fb682e1 --- /dev/null +++ b/keyboards/projectkb/alice/config.h | |||
@@ -0,0 +1,3 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #define SLEEP_LED_GPT_DRIVER GPTD1 | ||
diff --git a/keyboards/projectkb/alice/halconf.h b/keyboards/projectkb/alice/halconf.h index b17808ffe..0016e53ba 100644 --- a/keyboards/projectkb/alice/halconf.h +++ b/keyboards/projectkb/alice/halconf.h | |||
@@ -27,5 +27,7 @@ | |||
27 | 27 | ||
28 | #define HAL_USE_SPI TRUE | 28 | #define HAL_USE_SPI TRUE |
29 | 29 | ||
30 | #define HAL_USE_GPT TRUE | ||
31 | |||
30 | #include_next <halconf.h> | 32 | #include_next <halconf.h> |
31 | 33 | ||
diff --git a/keyboards/projectkb/alice/mcuconf.h b/keyboards/projectkb/alice/mcuconf.h index 4bfc7f946..6e0f1a50d 100644 --- a/keyboards/projectkb/alice/mcuconf.h +++ b/keyboards/projectkb/alice/mcuconf.h | |||
@@ -32,3 +32,5 @@ | |||
32 | #undef STM32_SPI_USE_SPI2 | 32 | #undef STM32_SPI_USE_SPI2 |
33 | #define STM32_SPI_USE_SPI2 TRUE | 33 | #define STM32_SPI_USE_SPI2 TRUE |
34 | 34 | ||
35 | #undef STM32_GPT_USE_TIM1 | ||
36 | #define STM32_GPT_USE_TIM1 TRUE | ||
diff --git a/keyboards/projectkb/signature87/rules.mk b/keyboards/projectkb/signature87/rules.mk index fe0d976d1..caad4c83c 100644 --- a/keyboards/projectkb/signature87/rules.mk +++ b/keyboards/projectkb/signature87/rules.mk | |||
@@ -9,7 +9,7 @@ MOUSEKEY_ENABLE = yes # Mouse keys | |||
9 | EXTRAKEY_ENABLE = yes # Audio control and System control | 9 | EXTRAKEY_ENABLE = yes # Audio control and System control |
10 | CONSOLE_ENABLE = yes # Console for debug | 10 | CONSOLE_ENABLE = yes # Console for debug |
11 | COMMAND_ENABLE = yes # Commands for debug and configuration | 11 | COMMAND_ENABLE = yes # Commands for debug and configuration |
12 | SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | 12 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
13 | NKRO_ENABLE = yes # USB Nkey Rollover | 13 | NKRO_ENABLE = yes # USB Nkey Rollover |
14 | BACKLIGHT_ENABLE = no | 14 | BACKLIGHT_ENABLE = no |
15 | 15 | ||
diff --git a/keyboards/ramonimbao/wete/config.h b/keyboards/ramonimbao/wete/config.h index 5d68a7efd..3d8955009 100644 --- a/keyboards/ramonimbao/wete/config.h +++ b/keyboards/ramonimbao/wete/config.h | |||
@@ -46,6 +46,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
46 | #define RGBLED_NUM 24 | 46 | #define RGBLED_NUM 24 |
47 | #define RGBLIGHT_ANIMATIONS | 47 | #define RGBLIGHT_ANIMATIONS |
48 | 48 | ||
49 | #define SLEEP_LED_GPT_DRIVER GPTD1 | ||
50 | |||
49 | /* define if matrix has ghost */ | 51 | /* define if matrix has ghost */ |
50 | //#define MATRIX_HAS_GHOST | 52 | //#define MATRIX_HAS_GHOST |
51 | 53 | ||
diff --git a/keyboards/ramonimbao/wete/halconf.h b/keyboards/ramonimbao/wete/halconf.h index c43440a45..b3de873be 100644 --- a/keyboards/ramonimbao/wete/halconf.h +++ b/keyboards/ramonimbao/wete/halconf.h | |||
@@ -23,5 +23,7 @@ | |||
23 | 23 | ||
24 | #define HAL_USE_PWM TRUE | 24 | #define HAL_USE_PWM TRUE |
25 | 25 | ||
26 | #define HAL_USE_GPT TRUE | ||
27 | |||
26 | #include_next <halconf.h> | 28 | #include_next <halconf.h> |
27 | 29 | ||
diff --git a/keyboards/ramonimbao/wete/mcuconf.h b/keyboards/ramonimbao/wete/mcuconf.h index b7f2c481c..7a2e87776 100644 --- a/keyboards/ramonimbao/wete/mcuconf.h +++ b/keyboards/ramonimbao/wete/mcuconf.h | |||
@@ -35,3 +35,5 @@ | |||
35 | #undef STM32_SPI_USE_SPI2 | 35 | #undef STM32_SPI_USE_SPI2 |
36 | #define STM32_SPI_USE_SPI2 TRUE | 36 | #define STM32_SPI_USE_SPI2 TRUE |
37 | 37 | ||
38 | #undef STM32_GPT_USE_TIM1 | ||
39 | #define STM32_GPT_USE_TIM1 TRUE | ||
diff --git a/keyboards/readme.md b/keyboards/readme.md index 6b7b92e0c..a23d0845b 100644 --- a/keyboards/readme.md +++ b/keyboards/readme.md | |||
@@ -63,4 +63,4 @@ These keyboards are part of the QMK repository, but their manufacturers are not | |||
63 | * [Vision Division](/keyboards/vision_division) — Full Size / Split Linear Keyboard by IBNobody. | 63 | * [Vision Division](/keyboards/vision_division) — Full Size / Split Linear Keyboard by IBNobody. |
64 | * [XD004](/keyboards/xd004) — 1x4 macro keyboard sold by KPrepublic. | 64 | * [XD004](/keyboards/xd004) — 1x4 macro keyboard sold by KPrepublic. |
65 | * [XD75](/keyboards/xd75) — 15x5 ortholinear keyboard by XIUDI. | 65 | * [XD75](/keyboards/xd75) — 15x5 ortholinear keyboard by XIUDI. |
66 | * [YMDK NP21](/keyboards/ymdk_np21) — ps2avrGB based number pad (numpad) sold by YMDK on Aliexpress. | 66 | * [YMDK NP21](/keyboards/ymdk_np21) — ps2avrGB based number pad (numpad) sold by YMDK on Aliexpress. |
diff --git a/keyboards/westfoxtrot/prophet/config.h b/keyboards/westfoxtrot/prophet/config.h index 4f447e4ca..0f2ddc1dc 100644 --- a/keyboards/westfoxtrot/prophet/config.h +++ b/keyboards/westfoxtrot/prophet/config.h | |||
@@ -30,3 +30,5 @@ | |||
30 | #define LOCKING_SUPPORT_ENABLE | 30 | #define LOCKING_SUPPORT_ENABLE |
31 | /* Locking resynchronize hack */ | 31 | /* Locking resynchronize hack */ |
32 | #define LOCKING_RESYNC_ENABLE | 32 | #define LOCKING_RESYNC_ENABLE |
33 | |||
34 | #define SLEEP_LED_GPT_DRIVER GPTD1 | ||
diff --git a/keyboards/westfoxtrot/prophet/halconf.h b/keyboards/westfoxtrot/prophet/halconf.h new file mode 100644 index 000000000..cbfd1307f --- /dev/null +++ b/keyboards/westfoxtrot/prophet/halconf.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* Copyright 2020 QMK | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | /* | ||
18 | * This file was auto-generated by: | ||
19 | * `qmk chibios-confmigrate -i keyboards/projectkb/alice/halconf.h -r platforms/chibios/common/configs/halconf.h` | ||
20 | */ | ||
21 | |||
22 | #pragma once | ||
23 | |||
24 | #define HAL_USE_GPT TRUE | ||
25 | |||
26 | #include_next <halconf.h> | ||
27 | |||
diff --git a/keyboards/westfoxtrot/prophet/mcuconf.h b/keyboards/westfoxtrot/prophet/mcuconf.h index 2665f9c9e..550141af6 100644 --- a/keyboards/westfoxtrot/prophet/mcuconf.h +++ b/keyboards/westfoxtrot/prophet/mcuconf.h | |||
@@ -23,6 +23,5 @@ | |||
23 | 23 | ||
24 | #include_next <mcuconf.h> | 24 | #include_next <mcuconf.h> |
25 | 25 | ||
26 | #undef STM32_PWM_USE_TIM3 | 26 | #undef STM32_GPT_USE_TIM1 |
27 | #define STM32_PWM_USE_TIM3 TRUE | 27 | #define STM32_GPT_USE_TIM1 TRUE |
28 | |||
diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py index 3c6f0d001..233d1034b 100644 --- a/lib/python/qmk/commands.py +++ b/lib/python/qmk/commands.py | |||
@@ -180,6 +180,7 @@ def compile_configurator_json(user_keymap, bootloader=None, parallel=1, **env_va | |||
180 | f'VERBOSE={verbose}', | 180 | f'VERBOSE={verbose}', |
181 | f'COLOR={color}', | 181 | f'COLOR={color}', |
182 | 'SILENT=false', | 182 | 'SILENT=false', |
183 | 'QMK_BIN=qmk', | ||
183 | ]) | 184 | ]) |
184 | 185 | ||
185 | return make_command | 186 | return make_command |
diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py index 82c42a20e..bfecebdd7 100644 --- a/lib/python/qmk/tests/test_cli_commands.py +++ b/lib/python/qmk/tests/test_cli_commands.py | |||
@@ -8,7 +8,7 @@ is_windows = 'windows' in platform.platform().lower() | |||
8 | 8 | ||
9 | 9 | ||
10 | def check_subcommand(command, *args): | 10 | def check_subcommand(command, *args): |
11 | cmd = ['bin/qmk', command, *args] | 11 | cmd = ['qmk', command, *args] |
12 | result = run(cmd, stdout=PIPE, stderr=STDOUT, universal_newlines=True) | 12 | result = run(cmd, stdout=PIPE, stderr=STDOUT, universal_newlines=True) |
13 | return result | 13 | return result |
14 | 14 | ||
@@ -17,7 +17,7 @@ def check_subcommand_stdin(file_to_read, command, *args): | |||
17 | """Pipe content of a file to a command and return output. | 17 | """Pipe content of a file to a command and return output. |
18 | """ | 18 | """ |
19 | with open(file_to_read, encoding='utf-8') as my_file: | 19 | with open(file_to_read, encoding='utf-8') as my_file: |
20 | cmd = ['bin/qmk', command, *args] | 20 | cmd = ['qmk', command, *args] |
21 | result = run(cmd, stdin=my_file, stdout=PIPE, stderr=STDOUT, universal_newlines=True) | 21 | result = run(cmd, stdin=my_file, stdout=PIPE, stderr=STDOUT, universal_newlines=True) |
22 | return result | 22 | return result |
23 | 23 | ||
diff --git a/quantum/bootmagic/bootmagic.h b/quantum/bootmagic/bootmagic.h new file mode 100644 index 000000000..959750178 --- /dev/null +++ b/quantum/bootmagic/bootmagic.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* Copyright 2021 QMK | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 3 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | #if defined(BOOTMAGIC_ENABLE) | ||
19 | # include "bootmagic_full.h" | ||
20 | #elif defined(BOOTMAGIC_LITE) | ||
21 | # include "bootmagic_lite.h" | ||
22 | #endif | ||
23 | |||
24 | void bootmagic(void); | ||
diff --git a/tmk_core/common/bootmagic.c b/quantum/bootmagic/bootmagic_full.c index c1b3adf94..a7a0dcfcb 100644 --- a/tmk_core/common/bootmagic.c +++ b/quantum/bootmagic/bootmagic_full.c | |||
@@ -1,3 +1,18 @@ | |||
1 | /* Copyright 2021 QMK | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 3 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
1 | #include <stdint.h> | 16 | #include <stdint.h> |
2 | #include <stdbool.h> | 17 | #include <stdbool.h> |
3 | #include "wait.h" | 18 | #include "wait.h" |
@@ -10,18 +25,35 @@ | |||
10 | #include "eeconfig.h" | 25 | #include "eeconfig.h" |
11 | #include "bootmagic.h" | 26 | #include "bootmagic.h" |
12 | 27 | ||
13 | keymap_config_t keymap_config; | 28 | /** \brief Scan Keycode |
14 | |||
15 | /** \brief Bootmagic | ||
16 | * | 29 | * |
17 | * FIXME: needs doc | 30 | * FIXME: needs doc |
18 | */ | 31 | */ |
19 | void bootmagic(void) { | 32 | static bool scan_keycode(uint8_t keycode) { |
20 | /* check signature */ | 33 | for (uint8_t r = 0; r < MATRIX_ROWS; r++) { |
21 | if (!eeconfig_is_enabled()) { | 34 | matrix_row_t matrix_row = matrix_get_row(r); |
22 | eeconfig_init(); | 35 | for (uint8_t c = 0; c < MATRIX_COLS; c++) { |
36 | if (matrix_row & ((matrix_row_t)1 << c)) { | ||
37 | if (keycode == keymap_key_to_keycode(0, (keypos_t){.row = r, .col = c})) { | ||
38 | return true; | ||
39 | } | ||
40 | } | ||
41 | } | ||
23 | } | 42 | } |
43 | return false; | ||
44 | } | ||
45 | |||
46 | /** \brief Bootmagic Scan Keycode | ||
47 | * | ||
48 | * FIXME: needs doc | ||
49 | */ | ||
50 | static bool bootmagic_scan_keycode(uint8_t keycode) { | ||
51 | if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false; | ||
52 | |||
53 | return scan_keycode(keycode); | ||
54 | } | ||
24 | 55 | ||
56 | void bootmagic(void) { | ||
25 | /* do scans in case of bounce */ | 57 | /* do scans in case of bounce */ |
26 | print("bootmagic scan: ... "); | 58 | print("bootmagic scan: ... "); |
27 | uint8_t scan = 100; | 59 | uint8_t scan = 100; |
@@ -46,8 +78,6 @@ void bootmagic(void) { | |||
46 | bootloader_jump(); | 78 | bootloader_jump(); |
47 | } | 79 | } |
48 | 80 | ||
49 | /* debug enable */ | ||
50 | debug_config.raw = eeconfig_read_debug(); | ||
51 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_ENABLE)) { | 81 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_ENABLE)) { |
52 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_MATRIX)) { | 82 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEBUG_MATRIX)) { |
53 | debug_config.matrix = !debug_config.matrix; | 83 | debug_config.matrix = !debug_config.matrix; |
@@ -61,8 +91,6 @@ void bootmagic(void) { | |||
61 | } | 91 | } |
62 | eeconfig_update_debug(debug_config.raw); | 92 | eeconfig_update_debug(debug_config.raw); |
63 | 93 | ||
64 | /* keymap config */ | ||
65 | keymap_config.raw = eeconfig_read_keymap(); | ||
66 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK)) { | 94 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_SWAP_CONTROL_CAPSLOCK)) { |
67 | keymap_config.swap_control_capslock = !keymap_config.swap_control_capslock; | 95 | keymap_config.swap_control_capslock = !keymap_config.swap_control_capslock; |
68 | } | 96 | } |
@@ -93,71 +121,27 @@ void bootmagic(void) { | |||
93 | uint8_t default_layer = 0; | 121 | uint8_t default_layer = 0; |
94 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { | 122 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_0)) { |
95 | default_layer |= (1 << 0); | 123 | default_layer |= (1 << 0); |
96 | } | 124 | } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_1)) { |
97 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_1)) { | ||
98 | default_layer |= (1 << 1); | 125 | default_layer |= (1 << 1); |
99 | } | 126 | } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_2)) { |
100 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_2)) { | ||
101 | default_layer |= (1 << 2); | 127 | default_layer |= (1 << 2); |
102 | } | 128 | } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_3)) { |
103 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_3)) { | ||
104 | default_layer |= (1 << 3); | 129 | default_layer |= (1 << 3); |
105 | } | 130 | } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_4)) { |
106 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_4)) { | ||
107 | default_layer |= (1 << 4); | 131 | default_layer |= (1 << 4); |
108 | } | 132 | } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_5)) { |
109 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_5)) { | ||
110 | default_layer |= (1 << 5); | 133 | default_layer |= (1 << 5); |
111 | } | 134 | } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_6)) { |
112 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_6)) { | ||
113 | default_layer |= (1 << 6); | 135 | default_layer |= (1 << 6); |
114 | } | 136 | } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_7)) { |
115 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_DEFAULT_LAYER_7)) { | ||
116 | default_layer |= (1 << 7); | 137 | default_layer |= (1 << 7); |
117 | } | 138 | } |
118 | if (default_layer) { | 139 | eeconfig_update_default_layer(default_layer); |
119 | eeconfig_update_default_layer(default_layer); | ||
120 | default_layer_set((layer_state_t)default_layer); | ||
121 | } else { | ||
122 | default_layer = eeconfig_read_default_layer(); | ||
123 | default_layer_set((layer_state_t)default_layer); | ||
124 | } | ||
125 | /* Also initialize layer state to trigger callback functions for layer_state */ | ||
126 | layer_state_set_kb((layer_state_t)layer_state); | ||
127 | 140 | ||
128 | /* EE_HANDS handedness */ | 141 | /* EE_HANDS handedness */ |
129 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_LEFT)) { | 142 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_LEFT)) { |
130 | eeconfig_update_handedness(true); | 143 | eeconfig_update_handedness(true); |
131 | } | 144 | } else if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_RIGHT)) { |
132 | if (bootmagic_scan_keycode(BOOTMAGIC_KEY_EE_HANDS_RIGHT)) { | ||
133 | eeconfig_update_handedness(false); | 145 | eeconfig_update_handedness(false); |
134 | } | 146 | } |
135 | } | 147 | } |
136 | |||
137 | /** \brief Scan Keycode | ||
138 | * | ||
139 | * FIXME: needs doc | ||
140 | */ | ||
141 | static bool scan_keycode(uint8_t keycode) { | ||
142 | for (uint8_t r = 0; r < MATRIX_ROWS; r++) { | ||
143 | matrix_row_t matrix_row = matrix_get_row(r); | ||
144 | for (uint8_t c = 0; c < MATRIX_COLS; c++) { | ||
145 | if (matrix_row & ((matrix_row_t)1 << c)) { | ||
146 | if (keycode == keymap_key_to_keycode(0, (keypos_t){.row = r, .col = c})) { | ||
147 | return true; | ||
148 | } | ||
149 | } | ||
150 | } | ||
151 | } | ||
152 | return false; | ||
153 | } | ||
154 | |||
155 | /** \brief Bootmagic Scan Keycode | ||
156 | * | ||
157 | * FIXME: needs doc | ||
158 | */ | ||
159 | bool bootmagic_scan_keycode(uint8_t keycode) { | ||
160 | if (!scan_keycode(BOOTMAGIC_KEY_SALT)) return false; | ||
161 | |||
162 | return scan_keycode(keycode); | ||
163 | } | ||
diff --git a/tmk_core/common/bootmagic.h b/quantum/bootmagic/bootmagic_full.h index 8209d0194..28f914c1b 100644 --- a/tmk_core/common/bootmagic.h +++ b/quantum/bootmagic/bootmagic_full.h | |||
@@ -1,3 +1,19 @@ | |||
1 | /* Copyright 2021 QMK | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 3 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
1 | #pragma once | 17 | #pragma once |
2 | 18 | ||
3 | /* FIXME: Add special doxygen comments for defines here. */ | 19 | /* FIXME: Add special doxygen comments for defines here. */ |
@@ -96,7 +112,4 @@ | |||
96 | #endif | 112 | #endif |
97 | #ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_7 | 113 | #ifndef BOOTMAGIC_KEY_DEFAULT_LAYER_7 |
98 | # define BOOTMAGIC_KEY_DEFAULT_LAYER_7 KC_7 | 114 | # define BOOTMAGIC_KEY_DEFAULT_LAYER_7 KC_7 |
99 | #endif | 115 | #endif \ No newline at end of file |
100 | |||
101 | void bootmagic(void); | ||
102 | bool bootmagic_scan_keycode(uint8_t keycode); | ||
diff --git a/tmk_core/common/bootmagic_lite.c b/quantum/bootmagic/bootmagic_lite.c index cbf756a17..9cbdcb0bb 100644 --- a/tmk_core/common/bootmagic_lite.c +++ b/quantum/bootmagic/bootmagic_lite.c | |||
@@ -1,3 +1,18 @@ | |||
1 | /* Copyright 2021 QMK | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 3 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
1 | #include "quantum.h" | 16 | #include "quantum.h" |
2 | 17 | ||
3 | /** \brief Reset eeprom | 18 | /** \brief Reset eeprom |
@@ -47,3 +62,5 @@ __attribute__((weak)) void bootmagic_lite(void) { | |||
47 | bootloader_jump(); | 62 | bootloader_jump(); |
48 | } | 63 | } |
49 | } | 64 | } |
65 | |||
66 | void bootmagic(void) { bootmagic_lite(); } | ||
diff --git a/quantum/bootmagic/bootmagic_lite.h b/quantum/bootmagic/bootmagic_lite.h new file mode 100644 index 000000000..17777e6b4 --- /dev/null +++ b/quantum/bootmagic/bootmagic_lite.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* Copyright 2021 QMK | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 3 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | #ifndef BOOTMAGIC_LITE_COLUMN | ||
19 | # define BOOTMAGIC_LITE_COLUMN 0 | ||
20 | #endif | ||
21 | #ifndef BOOTMAGIC_LITE_ROW | ||
22 | # define BOOTMAGIC_LITE_ROW 0 | ||
23 | #endif | ||
24 | |||
25 | void bootmagic_lite(void); | ||
diff --git a/quantum/bootmagic/magic.c b/quantum/bootmagic/magic.c new file mode 100644 index 000000000..f1cb11c39 --- /dev/null +++ b/quantum/bootmagic/magic.c | |||
@@ -0,0 +1,54 @@ | |||
1 | /* Copyright 2021 QMK | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 3 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #include <stdint.h> | ||
17 | #include <stdbool.h> | ||
18 | #include "wait.h" | ||
19 | #include "matrix.h" | ||
20 | #include "bootloader.h" | ||
21 | #include "debug.h" | ||
22 | #include "keymap.h" | ||
23 | #include "host.h" | ||
24 | #include "action_layer.h" | ||
25 | #include "eeconfig.h" | ||
26 | #include "bootmagic.h" | ||
27 | |||
28 | keymap_config_t keymap_config; | ||
29 | |||
30 | __attribute__((weak)) void bootmagic(void) {} | ||
31 | |||
32 | /** \brief Magic | ||
33 | * | ||
34 | * FIXME: Needs doc | ||
35 | */ | ||
36 | void magic(void) { | ||
37 | /* check signature */ | ||
38 | if (!eeconfig_is_enabled()) { | ||
39 | eeconfig_init(); | ||
40 | } | ||
41 | |||
42 | /* init globals */ | ||
43 | debug_config.raw = eeconfig_read_debug(); | ||
44 | keymap_config.raw = eeconfig_read_keymap(); | ||
45 | |||
46 | bootmagic(); | ||
47 | |||
48 | /* read here just incase bootmagic process changed its value */ | ||
49 | layer_state_t default_layer = (layer_state_t)eeconfig_read_default_layer(); | ||
50 | default_layer_set(default_layer); | ||
51 | |||
52 | /* Also initialize layer state to trigger callback functions for layer_state */ | ||
53 | layer_state_set_kb((layer_state_t)layer_state); | ||
54 | } | ||
diff --git a/quantum/bootmagic/magic.h b/quantum/bootmagic/magic.h new file mode 100644 index 000000000..2c3969b85 --- /dev/null +++ b/quantum/bootmagic/magic.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* Copyright 2021 QMK | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 3 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | void magic(void); | ||
diff --git a/quantum/keycode_config.h b/quantum/keycode_config.h index f878168c5..d7e334fdc 100644 --- a/quantum/keycode_config.h +++ b/quantum/keycode_config.h | |||
@@ -37,6 +37,7 @@ typedef union { | |||
37 | bool nkro : 1; | 37 | bool nkro : 1; |
38 | bool swap_lctl_lgui : 1; | 38 | bool swap_lctl_lgui : 1; |
39 | bool swap_rctl_rgui : 1; | 39 | bool swap_rctl_rgui : 1; |
40 | bool oneshot_disable : 1; | ||
40 | }; | 41 | }; |
41 | } keymap_config_t; | 42 | } keymap_config_t; |
42 | 43 | ||
diff --git a/quantum/led_matrix.c b/quantum/led_matrix.c index 4f1f06c7a..39bccdd58 100644 --- a/quantum/led_matrix.c +++ b/quantum/led_matrix.c | |||
@@ -45,10 +45,6 @@ led_eeconfig_t led_matrix_eeconfig; | |||
45 | # define LED_DISABLE_WHEN_USB_SUSPENDED false | 45 | # define LED_DISABLE_WHEN_USB_SUSPENDED false |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | #ifndef EECONFIG_LED_MATRIX | ||
49 | # define EECONFIG_LED_MATRIX EECONFIG_RGBLIGHT | ||
50 | #endif | ||
51 | |||
52 | #if !defined(LED_MATRIX_MAXIMUM_BRIGHTNESS) || LED_MATRIX_MAXIMUM_BRIGHTNESS > 255 | 48 | #if !defined(LED_MATRIX_MAXIMUM_BRIGHTNESS) || LED_MATRIX_MAXIMUM_BRIGHTNESS > 255 |
53 | # define LED_MATRIX_MAXIMUM_BRIGHTNESS 255 | 49 | # define LED_MATRIX_MAXIMUM_BRIGHTNESS 255 |
54 | #endif | 50 | #endif |
@@ -135,7 +131,7 @@ void led_matrix_set_suspend_state(bool state) { g_suspend_state = state; } | |||
135 | void led_matrix_all_off(void) { led_matrix_set_index_value_all(0); } | 131 | void led_matrix_all_off(void) { led_matrix_set_index_value_all(0); } |
136 | 132 | ||
137 | // Uniform brightness | 133 | // Uniform brightness |
138 | void led_matrix_uniform_brightness(void) { led_matrix_set_index_value_all(LED_MATRIX_MAXIMUM_BRIGHTNESS / BACKLIGHT_LEVELS * led_matrix_eeconfig.val); } | 134 | void led_matrix_uniform_brightness(void) { led_matrix_set_index_value_all(led_matrix_eeconfig.val); } |
139 | 135 | ||
140 | void led_matrix_custom(void) {} | 136 | void led_matrix_custom(void) {} |
141 | 137 | ||
@@ -344,5 +340,3 @@ void led_matrix_set_value(uint8_t val) { | |||
344 | led_matrix_set_value_noeeprom(val); | 340 | led_matrix_set_value_noeeprom(val); |
345 | eeconfig_update_led_matrix(led_matrix_eeconfig.raw); | 341 | eeconfig_update_led_matrix(led_matrix_eeconfig.raw); |
346 | } | 342 | } |
347 | |||
348 | void backlight_set(uint8_t val) { led_matrix_set_value(val); } | ||
diff --git a/quantum/led_matrix.h b/quantum/led_matrix.h index 85bae43c1..0817d1357 100644 --- a/quantum/led_matrix.h +++ b/quantum/led_matrix.h | |||
@@ -21,10 +21,6 @@ | |||
21 | 21 | ||
22 | #include "led_matrix_types.h" | 22 | #include "led_matrix_types.h" |
23 | 23 | ||
24 | #ifndef BACKLIGHT_ENABLE | ||
25 | # error You must define BACKLIGHT_ENABLE with LED_MATRIX_ENABLE | ||
26 | #endif | ||
27 | |||
28 | enum led_matrix_effects { | 24 | enum led_matrix_effects { |
29 | LED_MATRIX_UNIFORM_BRIGHTNESS = 1, | 25 | LED_MATRIX_UNIFORM_BRIGHTNESS = 1, |
30 | // All new effects go above this line | 26 | // All new effects go above this line |
diff --git a/quantum/process_keycode/process_backlight.c b/quantum/process_keycode/process_backlight.c index 4d12f6813..8b70339a5 100644 --- a/quantum/process_keycode/process_backlight.c +++ b/quantum/process_keycode/process_backlight.c | |||
@@ -16,11 +16,35 @@ | |||
16 | 16 | ||
17 | #include "process_backlight.h" | 17 | #include "process_backlight.h" |
18 | 18 | ||
19 | #include "backlight.h" | 19 | #ifdef LED_MATRIX_ENABLE |
20 | # include "led_matrix.h" | ||
21 | #else | ||
22 | # include "backlight.h" | ||
23 | #endif | ||
20 | 24 | ||
21 | bool process_backlight(uint16_t keycode, keyrecord_t *record) { | 25 | bool process_backlight(uint16_t keycode, keyrecord_t *record) { |
22 | if (record->event.pressed) { | 26 | if (record->event.pressed) { |
23 | switch (keycode) { | 27 | switch (keycode) { |
28 | #ifdef LED_MATRIX_ENABLE | ||
29 | case BL_ON: | ||
30 | led_matrix_enable(); | ||
31 | return false; | ||
32 | case BL_OFF: | ||
33 | led_matrix_disable(); | ||
34 | return false; | ||
35 | case BL_DEC: | ||
36 | led_matrix_decrease_val(); | ||
37 | return false; | ||
38 | case BL_INC: | ||
39 | led_matrix_increase_val(); | ||
40 | return false; | ||
41 | case BL_TOGG: | ||
42 | led_matrix_toggle(); | ||
43 | return false; | ||
44 | case BL_STEP: | ||
45 | led_matrix_step(); | ||
46 | return false; | ||
47 | #else | ||
24 | case BL_ON: | 48 | case BL_ON: |
25 | backlight_level(BACKLIGHT_LEVELS); | 49 | backlight_level(BACKLIGHT_LEVELS); |
26 | return false; | 50 | return false; |
@@ -39,10 +63,11 @@ bool process_backlight(uint16_t keycode, keyrecord_t *record) { | |||
39 | case BL_STEP: | 63 | case BL_STEP: |
40 | backlight_step(); | 64 | backlight_step(); |
41 | return false; | 65 | return false; |
42 | #ifdef BACKLIGHT_BREATHING | 66 | # ifdef BACKLIGHT_BREATHING |
43 | case BL_BRTG: | 67 | case BL_BRTG: |
44 | backlight_toggle_breathing(); | 68 | backlight_toggle_breathing(); |
45 | return false; | 69 | return false; |
70 | # endif | ||
46 | #endif | 71 | #endif |
47 | } | 72 | } |
48 | } | 73 | } |
diff --git a/quantum/quantum.c b/quantum/quantum.c index 80c4e8f00..59d95f2f5 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
@@ -15,6 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "quantum.h" | 17 | #include "quantum.h" |
18 | #include "magic.h" | ||
18 | 19 | ||
19 | #ifdef BLUETOOTH_ENABLE | 20 | #ifdef BLUETOOTH_ENABLE |
20 | # include "outputselect.h" | 21 | # include "outputselect.h" |
@@ -233,7 +234,7 @@ bool process_record_quantum(keyrecord_t *record) { | |||
233 | #ifdef AUDIO_ENABLE | 234 | #ifdef AUDIO_ENABLE |
234 | process_audio(keycode, record) && | 235 | process_audio(keycode, record) && |
235 | #endif | 236 | #endif |
236 | #ifdef BACKLIGHT_ENABLE | 237 | #if defined(BACKLIGHT_ENABLE) || defined(LED_MATRIX_ENABLE) |
237 | process_backlight(keycode, record) && | 238 | process_backlight(keycode, record) && |
238 | #endif | 239 | #endif |
239 | #ifdef STENO_ENABLE | 240 | #ifdef STENO_ENABLE |
@@ -318,6 +319,17 @@ bool process_record_quantum(keyrecord_t *record) { | |||
318 | set_output(OUTPUT_BLUETOOTH); | 319 | set_output(OUTPUT_BLUETOOTH); |
319 | return false; | 320 | return false; |
320 | #endif | 321 | #endif |
322 | #ifndef NO_ACTION_ONESHOT | ||
323 | case ONESHOT_TOGGLE: | ||
324 | oneshot_toggle(); | ||
325 | break; | ||
326 | case ONESHOT_ENABLE: | ||
327 | oneshot_enable(); | ||
328 | break; | ||
329 | case ONESHOT_DISABLE: | ||
330 | oneshot_disable(); | ||
331 | break; | ||
332 | #endif | ||
321 | } | 333 | } |
322 | } | 334 | } |
323 | 335 | ||
@@ -369,26 +381,20 @@ void tap_random_base64(void) { | |||
369 | } | 381 | } |
370 | 382 | ||
371 | void matrix_init_quantum() { | 383 | void matrix_init_quantum() { |
372 | #ifdef BOOTMAGIC_LITE | 384 | magic(); |
373 | bootmagic_lite(); | ||
374 | #endif | ||
375 | if (!eeconfig_is_enabled()) { | ||
376 | eeconfig_init(); | ||
377 | } | ||
378 | #if defined(LED_NUM_LOCK_PIN) || defined(LED_CAPS_LOCK_PIN) || defined(LED_SCROLL_LOCK_PIN) || defined(LED_COMPOSE_PIN) || defined(LED_KANA_PIN) | 385 | #if defined(LED_NUM_LOCK_PIN) || defined(LED_CAPS_LOCK_PIN) || defined(LED_SCROLL_LOCK_PIN) || defined(LED_COMPOSE_PIN) || defined(LED_KANA_PIN) |
379 | // TODO: remove calls to led_init_ports from keyboards and remove ifdef | 386 | // TODO: remove calls to led_init_ports from keyboards and remove ifdef |
380 | led_init_ports(); | 387 | led_init_ports(); |
381 | #endif | 388 | #endif |
382 | #ifdef BACKLIGHT_ENABLE | 389 | #ifdef BACKLIGHT_ENABLE |
383 | # ifdef LED_MATRIX_ENABLE | ||
384 | led_matrix_init(); | ||
385 | # else | ||
386 | backlight_init_ports(); | 390 | backlight_init_ports(); |
387 | # endif | ||
388 | #endif | 391 | #endif |
389 | #ifdef AUDIO_ENABLE | 392 | #ifdef AUDIO_ENABLE |
390 | audio_init(); | 393 | audio_init(); |
391 | #endif | 394 | #endif |
395 | #ifdef LED_MATRIX_ENABLE | ||
396 | led_matrix_init(); | ||
397 | #endif | ||
392 | #ifdef RGB_MATRIX_ENABLE | 398 | #ifdef RGB_MATRIX_ENABLE |
393 | rgb_matrix_init(); | 399 | rgb_matrix_init(); |
394 | #endif | 400 | #endif |
diff --git a/quantum/quantum.h b/quantum/quantum.h index b1600dd72..7c2dcaa82 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h | |||
@@ -30,11 +30,11 @@ | |||
30 | #include "keymap.h" | 30 | #include "keymap.h" |
31 | 31 | ||
32 | #ifdef BACKLIGHT_ENABLE | 32 | #ifdef BACKLIGHT_ENABLE |
33 | # ifdef LED_MATRIX_ENABLE | 33 | # include "backlight.h" |
34 | # include "led_matrix.h" | 34 | #endif |
35 | # else | 35 | |
36 | # include "backlight.h" | 36 | #ifdef LED_MATRIX_ENABLE |
37 | # endif | 37 | # include "led_matrix.h" |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #if defined(RGBLIGHT_ENABLE) | 40 | #if defined(RGBLIGHT_ENABLE) |
@@ -52,6 +52,7 @@ | |||
52 | #include "action_layer.h" | 52 | #include "action_layer.h" |
53 | #include "eeconfig.h" | 53 | #include "eeconfig.h" |
54 | #include "bootloader.h" | 54 | #include "bootloader.h" |
55 | #include "bootmagic.h" | ||
55 | #include "timer.h" | 56 | #include "timer.h" |
56 | #include "sync_timer.h" | 57 | #include "sync_timer.h" |
57 | #include "config_common.h" | 58 | #include "config_common.h" |
@@ -97,7 +98,7 @@ extern layer_state_t layer_state; | |||
97 | # include "process_music.h" | 98 | # include "process_music.h" |
98 | #endif | 99 | #endif |
99 | 100 | ||
100 | #ifdef BACKLIGHT_ENABLE | 101 | #if defined(BACKLIGHT_ENABLE) || defined(LED_MATRIX_ENABLE) |
101 | # include "process_backlight.h" | 102 | # include "process_backlight.h" |
102 | #endif | 103 | #endif |
103 | 104 | ||
@@ -258,15 +259,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record); | |||
258 | void post_process_record_kb(uint16_t keycode, keyrecord_t *record); | 259 | void post_process_record_kb(uint16_t keycode, keyrecord_t *record); |
259 | void post_process_record_user(uint16_t keycode, keyrecord_t *record); | 260 | void post_process_record_user(uint16_t keycode, keyrecord_t *record); |
260 | 261 | ||
261 | #ifndef BOOTMAGIC_LITE_COLUMN | ||
262 | # define BOOTMAGIC_LITE_COLUMN 0 | ||
263 | #endif | ||
264 | #ifndef BOOTMAGIC_LITE_ROW | ||
265 | # define BOOTMAGIC_LITE_ROW 0 | ||
266 | #endif | ||
267 | |||
268 | void bootmagic_lite(void); | ||
269 | |||
270 | void reset_keyboard(void); | 262 | void reset_keyboard(void); |
271 | 263 | ||
272 | void startup_user(void); | 264 | void startup_user(void); |
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 1863a7943..e697b71ba 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h | |||
@@ -569,6 +569,10 @@ enum quantum_keycodes { | |||
569 | 569 | ||
570 | #endif | 570 | #endif |
571 | 571 | ||
572 | ONESHOT_ENABLE, | ||
573 | ONESHOT_DISABLE, | ||
574 | ONESHOT_TOGGLE, | ||
575 | |||
572 | // always leave at the end | 576 | // always leave at the end |
573 | SAFE_RANGE | 577 | SAFE_RANGE |
574 | }; | 578 | }; |
@@ -870,3 +874,8 @@ enum quantum_keycodes { | |||
870 | #define DM_RSTP DYN_REC_STOP | 874 | #define DM_RSTP DYN_REC_STOP |
871 | #define DM_PLY1 DYN_MACRO_PLAY1 | 875 | #define DM_PLY1 DYN_MACRO_PLAY1 |
872 | #define DM_PLY2 DYN_MACRO_PLAY2 | 876 | #define DM_PLY2 DYN_MACRO_PLAY2 |
877 | |||
878 | // One Shot toggle | ||
879 | #define OS_TOGG ONESHOT_TOGGLE | ||
880 | #define OS_ON ONESHOT_ENABLE | ||
881 | #define OS_OFF ONESHOT_DISABLE | ||
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c index ec17b4d72..8aae48603 100644 --- a/quantum/rgb_matrix.c +++ b/quantum/rgb_matrix.c | |||
@@ -131,7 +131,7 @@ last_hit_t g_last_hit_tracker; | |||
131 | // internals | 131 | // internals |
132 | static uint8_t rgb_last_enable = UINT8_MAX; | 132 | static uint8_t rgb_last_enable = UINT8_MAX; |
133 | static uint8_t rgb_last_effect = UINT8_MAX; | 133 | static uint8_t rgb_last_effect = UINT8_MAX; |
134 | static effect_params_t rgb_effect_params = {0, 0xFF}; | 134 | static effect_params_t rgb_effect_params = {0, LED_FLAG_ALL, false}; |
135 | static rgb_task_states rgb_task_state = SYNCING; | 135 | static rgb_task_states rgb_task_state = SYNCING; |
136 | #if RGB_DISABLE_TIMEOUT > 0 | 136 | #if RGB_DISABLE_TIMEOUT > 0 |
137 | static uint32_t rgb_anykey_timer; | 137 | static uint32_t rgb_anykey_timer; |
@@ -143,6 +143,11 @@ static uint32_t rgb_timer_buffer; | |||
143 | static last_hit_t last_hit_buffer; | 143 | static last_hit_t last_hit_buffer; |
144 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED | 144 | #endif // RGB_MATRIX_KEYREACTIVE_ENABLED |
145 | 145 | ||
146 | // split rgb matrix | ||
147 | #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | ||
148 | const uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; | ||
149 | #endif | ||
150 | |||
146 | void eeconfig_read_rgb_matrix(void) { eeprom_read_block(&rgb_matrix_config, EECONFIG_RGB_MATRIX, sizeof(rgb_matrix_config)); } | 151 | void eeconfig_read_rgb_matrix(void) { eeprom_read_block(&rgb_matrix_config, EECONFIG_RGB_MATRIX, sizeof(rgb_matrix_config)); } |
147 | 152 | ||
148 | void eeconfig_update_rgb_matrix(void) { eeprom_update_block(&rgb_matrix_config, EECONFIG_RGB_MATRIX, sizeof(rgb_matrix_config)); } | 153 | void eeconfig_update_rgb_matrix(void) { eeprom_update_block(&rgb_matrix_config, EECONFIG_RGB_MATRIX, sizeof(rgb_matrix_config)); } |
@@ -153,6 +158,7 @@ void eeconfig_update_rgb_matrix_default(void) { | |||
153 | rgb_matrix_config.mode = RGB_MATRIX_STARTUP_MODE; | 158 | rgb_matrix_config.mode = RGB_MATRIX_STARTUP_MODE; |
154 | rgb_matrix_config.hsv = (HSV){RGB_MATRIX_STARTUP_HUE, RGB_MATRIX_STARTUP_SAT, RGB_MATRIX_STARTUP_VAL}; | 159 | rgb_matrix_config.hsv = (HSV){RGB_MATRIX_STARTUP_HUE, RGB_MATRIX_STARTUP_SAT, RGB_MATRIX_STARTUP_VAL}; |
155 | rgb_matrix_config.speed = RGB_MATRIX_STARTUP_SPD; | 160 | rgb_matrix_config.speed = RGB_MATRIX_STARTUP_SPD; |
161 | rgb_matrix_config.flags = LED_FLAG_ALL; | ||
156 | eeconfig_update_rgb_matrix(); | 162 | eeconfig_update_rgb_matrix(); |
157 | } | 163 | } |
158 | 164 | ||
@@ -164,6 +170,7 @@ void eeconfig_debug_rgb_matrix(void) { | |||
164 | dprintf("rgb_matrix_config.hsv.s = %d\n", rgb_matrix_config.hsv.s); | 170 | dprintf("rgb_matrix_config.hsv.s = %d\n", rgb_matrix_config.hsv.s); |
165 | dprintf("rgb_matrix_config.hsv.v = %d\n", rgb_matrix_config.hsv.v); | 171 | dprintf("rgb_matrix_config.hsv.v = %d\n", rgb_matrix_config.hsv.v); |
166 | dprintf("rgb_matrix_config.speed = %d\n", rgb_matrix_config.speed); | 172 | dprintf("rgb_matrix_config.speed = %d\n", rgb_matrix_config.speed); |
173 | dprintf("rgb_matrix_config.flags = %d\n", rgb_matrix_config.flags); | ||
167 | } | 174 | } |
168 | 175 | ||
169 | __attribute__((weak)) uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { return 0; } | 176 | __attribute__((weak)) uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { return 0; } |
@@ -180,9 +187,22 @@ uint8_t rgb_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *l | |||
180 | 187 | ||
181 | void rgb_matrix_update_pwm_buffers(void) { rgb_matrix_driver.flush(); } | 188 | void rgb_matrix_update_pwm_buffers(void) { rgb_matrix_driver.flush(); } |
182 | 189 | ||
183 | void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { rgb_matrix_driver.set_color(index, red, green, blue); } | 190 | void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
191 | #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | ||
192 | if (!is_keyboard_left() && index >= k_rgb_matrix_split[0]) | ||
193 | rgb_matrix_driver.set_color(index - k_rgb_matrix_split[0], red, green, blue); | ||
194 | else if (is_keyboard_left() && index < k_rgb_matrix_split[0]) | ||
195 | #endif | ||
196 | rgb_matrix_driver.set_color(index, red, green, blue); | ||
197 | } | ||
184 | 198 | ||
185 | void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { rgb_matrix_driver.set_color_all(red, green, blue); } | 199 | void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue) { |
200 | #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | ||
201 | for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) rgb_matrix_set_color(i, red, green, blue); | ||
202 | #else | ||
203 | rgb_matrix_driver.set_color_all(red, green, blue); | ||
204 | #endif | ||
205 | } | ||
186 | 206 | ||
187 | void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) { | 207 | void process_rgb_matrix(uint8_t row, uint8_t col, bool pressed) { |
188 | #ifndef RGB_MATRIX_SPLIT | 208 | #ifndef RGB_MATRIX_SPLIT |
@@ -315,6 +335,10 @@ static void rgb_task_start(void) { | |||
315 | static void rgb_task_render(uint8_t effect) { | 335 | static void rgb_task_render(uint8_t effect) { |
316 | bool rendering = false; | 336 | bool rendering = false; |
317 | rgb_effect_params.init = (effect != rgb_last_effect) || (rgb_matrix_config.enable != rgb_last_enable); | 337 | rgb_effect_params.init = (effect != rgb_last_effect) || (rgb_matrix_config.enable != rgb_last_enable); |
338 | if (rgb_effect_params.flags != rgb_matrix_config.flags) { | ||
339 | rgb_effect_params.flags = rgb_matrix_config.flags; | ||
340 | rgb_matrix_set_color_all(0, 0, 0); | ||
341 | } | ||
318 | 342 | ||
319 | // each effect can opt to do calculations | 343 | // each effect can opt to do calculations |
320 | // and/or request PWM buffer updates. | 344 | // and/or request PWM buffer updates. |
@@ -618,6 +642,6 @@ void rgb_matrix_decrease_speed_helper(bool write_to_eeprom) { rgb_matrix_set_spe | |||
618 | void rgb_matrix_decrease_speed_noeeprom(void) { rgb_matrix_decrease_speed_helper(false); } | 642 | void rgb_matrix_decrease_speed_noeeprom(void) { rgb_matrix_decrease_speed_helper(false); } |
619 | void rgb_matrix_decrease_speed(void) { rgb_matrix_decrease_speed_helper(true); } | 643 | void rgb_matrix_decrease_speed(void) { rgb_matrix_decrease_speed_helper(true); } |
620 | 644 | ||
621 | led_flags_t rgb_matrix_get_flags(void) { return rgb_effect_params.flags; } | 645 | led_flags_t rgb_matrix_get_flags(void) { return rgb_matrix_config.flags; } |
622 | 646 | ||
623 | void rgb_matrix_set_flags(led_flags_t flags) { rgb_effect_params.flags = flags; } | 647 | void rgb_matrix_set_flags(led_flags_t flags) { rgb_matrix_config.flags = flags; } |
diff --git a/quantum/rgb_matrix_types.h b/quantum/rgb_matrix_types.h index 7b8171fb2..1a37922af 100644 --- a/quantum/rgb_matrix_types.h +++ b/quantum/rgb_matrix_types.h | |||
@@ -85,10 +85,11 @@ typedef struct PACKED { | |||
85 | typedef union { | 85 | typedef union { |
86 | uint32_t raw; | 86 | uint32_t raw; |
87 | struct PACKED { | 87 | struct PACKED { |
88 | uint8_t enable : 2; | 88 | uint8_t enable : 2; |
89 | uint8_t mode : 6; | 89 | uint8_t mode : 6; |
90 | HSV hsv; | 90 | HSV hsv; |
91 | uint8_t speed; // EECONFIG needs to be increased to support this | 91 | uint8_t speed; // EECONFIG needs to be increased to support this |
92 | led_flags_t flags; | ||
92 | }; | 93 | }; |
93 | } rgb_config_t; | 94 | } rgb_config_t; |
94 | 95 | ||
diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c index 2ae44e6e1..9e75e19ce 100644 --- a/quantum/split_common/split_util.c +++ b/quantum/split_common/split_util.c | |||
@@ -1,3 +1,18 @@ | |||
1 | /* Copyright 2021 QMK | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 3 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
1 | #include "split_util.h" | 16 | #include "split_util.h" |
2 | #include "matrix.h" | 17 | #include "matrix.h" |
3 | #include "keyboard.h" | 18 | #include "keyboard.h" |
@@ -6,14 +21,7 @@ | |||
6 | #include "transport.h" | 21 | #include "transport.h" |
7 | #include "quantum.h" | 22 | #include "quantum.h" |
8 | #include "wait.h" | 23 | #include "wait.h" |
9 | 24 | #include "usb_util.h" | |
10 | #ifdef PROTOCOL_LUFA | ||
11 | # include <LUFA/Drivers/USB/USB.h> | ||
12 | #endif | ||
13 | |||
14 | #ifdef PROTOCOL_VUSB | ||
15 | # include <usbdrv/usbdrv.h> | ||
16 | #endif | ||
17 | 25 | ||
18 | #ifdef EE_HANDS | 26 | #ifdef EE_HANDS |
19 | # include "eeconfig.h" | 27 | # include "eeconfig.h" |
@@ -31,56 +39,21 @@ | |||
31 | # define SPLIT_USB_TIMEOUT_POLL 10 | 39 | # define SPLIT_USB_TIMEOUT_POLL 10 |
32 | #endif | 40 | #endif |
33 | 41 | ||
34 | #ifdef PROTOCOL_CHIBIOS | ||
35 | # define SPLIT_USB_DETECT // Force this on for now | ||
36 | #endif | ||
37 | |||
38 | volatile bool isLeftHand = true; | 42 | volatile bool isLeftHand = true; |
39 | 43 | ||
40 | #if defined(SPLIT_USB_DETECT) | 44 | #if defined(SPLIT_USB_DETECT) |
41 | # if defined(PROTOCOL_LUFA) | 45 | static bool usbIsActive(void) { |
42 | static inline bool usbHasActiveConnection(void) { return USB_Device_IsAddressSet(); } | ||
43 | static inline void usbDisable(void) { | ||
44 | USB_Disable(); | ||
45 | USB_DeviceState = DEVICE_STATE_Unattached; | ||
46 | } | ||
47 | # elif defined(PROTOCOL_CHIBIOS) | ||
48 | static inline bool usbHasActiveConnection(void) { return usbGetDriverStateI(&USBD1) == USB_ACTIVE; } | ||
49 | static inline void usbDisable(void) { usbStop(&USBD1); } | ||
50 | # elif defined(PROTOCOL_VUSB) | ||
51 | static inline bool usbHasActiveConnection(void) { | ||
52 | usbPoll(); | ||
53 | return usbConfiguration; | ||
54 | } | ||
55 | static inline void usbDisable(void) { usbDeviceDisconnect(); } | ||
56 | # else | ||
57 | static inline bool usbHasActiveConnection(void) { return true; } | ||
58 | static inline void usbDisable(void) {} | ||
59 | # endif | ||
60 | |||
61 | bool usbIsActive(void) { | ||
62 | for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) { | 46 | for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) { |
63 | // This will return true if a USB connection has been established | 47 | // This will return true if a USB connection has been established |
64 | if (usbHasActiveConnection()) { | 48 | if (usb_connected_state()) { |
65 | return true; | 49 | return true; |
66 | } | 50 | } |
67 | wait_ms(SPLIT_USB_TIMEOUT_POLL); | 51 | wait_ms(SPLIT_USB_TIMEOUT_POLL); |
68 | } | 52 | } |
69 | |||
70 | // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow | ||
71 | usbDisable(); | ||
72 | |||
73 | return false; | 53 | return false; |
74 | } | 54 | } |
75 | #elif defined(PROTOCOL_LUFA) && defined(OTGPADE) | ||
76 | static inline bool usbIsActive(void) { | ||
77 | USB_OTGPAD_On(); // enables VBUS pad | ||
78 | wait_us(5); | ||
79 | |||
80 | return USB_VBUS_GetStatus(); // checks state of VBUS | ||
81 | } | ||
82 | #else | 55 | #else |
83 | static inline bool usbIsActive(void) { return true; } | 56 | static inline bool usbIsActive(void) { return usb_vbus_state(); } |
84 | #endif | 57 | #endif |
85 | 58 | ||
86 | #ifdef SPLIT_HAND_MATRIX_GRID | 59 | #ifdef SPLIT_HAND_MATRIX_GRID |
@@ -126,6 +99,11 @@ __attribute__((weak)) bool is_keyboard_master(void) { | |||
126 | // only check once, as this is called often | 99 | // only check once, as this is called often |
127 | if (usbstate == UNKNOWN) { | 100 | if (usbstate == UNKNOWN) { |
128 | usbstate = usbIsActive() ? MASTER : SLAVE; | 101 | usbstate = usbIsActive() ? MASTER : SLAVE; |
102 | |||
103 | // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow | ||
104 | if (usbstate == SLAVE) { | ||
105 | usb_disable(); | ||
106 | } | ||
129 | } | 107 | } |
130 | 108 | ||
131 | return (usbstate == MASTER); | 109 | return (usbstate == MASTER); |
diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c index 61b61ea08..27a1c0d3a 100644 --- a/quantum/split_common/transport.c +++ b/quantum/split_common/transport.c | |||
@@ -22,6 +22,10 @@ static pin_t encoders_pad[] = ENCODERS_PAD_A; | |||
22 | # define NUMBER_OF_ENCODERS (sizeof(encoders_pad) / sizeof(pin_t)) | 22 | # define NUMBER_OF_ENCODERS (sizeof(encoders_pad) / sizeof(pin_t)) |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | ||
26 | # include "rgb_matrix.h" | ||
27 | #endif | ||
28 | |||
25 | #if defined(USE_I2C) | 29 | #if defined(USE_I2C) |
26 | 30 | ||
27 | # include "i2c_master.h" | 31 | # include "i2c_master.h" |
@@ -54,6 +58,10 @@ typedef struct _I2C_slave_buffer_t { | |||
54 | # ifdef WPM_ENABLE | 58 | # ifdef WPM_ENABLE |
55 | uint8_t current_wpm; | 59 | uint8_t current_wpm; |
56 | # endif | 60 | # endif |
61 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | ||
62 | rgb_config_t rgb_matrix; | ||
63 | bool rgb_suspend_state; | ||
64 | # endif | ||
57 | } I2C_slave_buffer_t; | 65 | } I2C_slave_buffer_t; |
58 | 66 | ||
59 | static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg; | 67 | static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_reg; |
@@ -68,6 +76,8 @@ static I2C_slave_buffer_t *const i2c_buffer = (I2C_slave_buffer_t *)i2c_slave_re | |||
68 | # define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync) | 76 | # define I2C_RGB_START offsetof(I2C_slave_buffer_t, rgblight_sync) |
69 | # define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state) | 77 | # define I2C_ENCODER_START offsetof(I2C_slave_buffer_t, encoder_state) |
70 | # define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm) | 78 | # define I2C_WPM_START offsetof(I2C_slave_buffer_t, current_wpm) |
79 | # define I2C_RGB_MATRIX_START offsetof(I2C_slave_buffer_t, rgb_matrix) | ||
80 | # define I2C_RGB_SUSPEND_START offsetof(I2C_slave_buffer_t, rgb_suspend_state) | ||
71 | 81 | ||
72 | # define TIMEOUT 100 | 82 | # define TIMEOUT 100 |
73 | 83 | ||
@@ -141,6 +151,11 @@ bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) | |||
141 | # endif | 151 | # endif |
142 | # endif | 152 | # endif |
143 | 153 | ||
154 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | ||
155 | i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_MATRIX_START, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix), TIMEOUT); | ||
156 | i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_RGB_SUSPEND_START, (void *)g_suspend_state, sizeof(i2c_buffer->rgb_suspend_state), TIMEOUT); | ||
157 | # endif | ||
158 | |||
144 | # ifndef DISABLE_SYNC_TIMER | 159 | # ifndef DISABLE_SYNC_TIMER |
145 | i2c_buffer->sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; | 160 | i2c_buffer->sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; |
146 | i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_SYNC_TIME_START, (void *)&i2c_buffer->sync_timer, sizeof(i2c_buffer->sync_timer), TIMEOUT); | 161 | i2c_writeReg(SLAVE_I2C_ADDRESS, I2C_SYNC_TIME_START, (void *)&i2c_buffer->sync_timer, sizeof(i2c_buffer->sync_timer), TIMEOUT); |
@@ -186,6 +201,11 @@ void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) | |||
186 | set_oneshot_mods(i2c_buffer->oneshot_mods); | 201 | set_oneshot_mods(i2c_buffer->oneshot_mods); |
187 | # endif | 202 | # endif |
188 | # endif | 203 | # endif |
204 | |||
205 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | ||
206 | memcpy((void *)i2c_buffer->rgb_matrix, (void *)rgb_matrix_config, sizeof(i2c_buffer->rgb_matrix)); | ||
207 | memcpy((void *)i2c_buffer->rgb_suspend_state, (void *)g_suspend_state, sizeof(i2c_buffer->rgb_suspend_state)); | ||
208 | # endif | ||
189 | } | 209 | } |
190 | 210 | ||
191 | void transport_master_init(void) { i2c_init(); } | 211 | void transport_master_init(void) { i2c_init(); } |
@@ -226,6 +246,10 @@ typedef struct _Serial_m2s_buffer_t { | |||
226 | # ifdef WPM_ENABLE | 246 | # ifdef WPM_ENABLE |
227 | uint8_t current_wpm; | 247 | uint8_t current_wpm; |
228 | # endif | 248 | # endif |
249 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | ||
250 | rgb_config_t rgb_matrix; | ||
251 | bool rgb_suspend_state; | ||
252 | # endif | ||
229 | } Serial_m2s_buffer_t; | 253 | } Serial_m2s_buffer_t; |
230 | 254 | ||
231 | # if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) | 255 | # if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) |
@@ -333,18 +357,24 @@ bool transport_master(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) | |||
333 | 357 | ||
334 | # ifdef WPM_ENABLE | 358 | # ifdef WPM_ENABLE |
335 | // Write wpm to slave | 359 | // Write wpm to slave |
336 | serial_m2s_buffer.current_wpm = get_current_wpm(); | 360 | serial_m2s_buffer.current_wpm = get_current_wpm(); |
337 | # endif | 361 | # endif |
338 | 362 | ||
339 | # ifdef SPLIT_MODS_ENABLE | 363 | # ifdef SPLIT_MODS_ENABLE |
340 | serial_m2s_buffer.real_mods = get_mods(); | 364 | serial_m2s_buffer.real_mods = get_mods(); |
341 | serial_m2s_buffer.weak_mods = get_weak_mods(); | 365 | serial_m2s_buffer.weak_mods = get_weak_mods(); |
342 | # ifndef NO_ACTION_ONESHOT | 366 | # ifndef NO_ACTION_ONESHOT |
343 | serial_m2s_buffer.oneshot_mods = get_oneshot_mods(); | 367 | serial_m2s_buffer.oneshot_mods = get_oneshot_mods(); |
344 | # endif | 368 | # endif |
345 | # endif | 369 | # endif |
370 | |||
371 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | ||
372 | serial_m2s_buffer.rgb_matrix = rgb_matrix_config; | ||
373 | serial_m2s_buffer.rgb_suspend_state = g_suspend_state; | ||
374 | # endif | ||
375 | |||
346 | # ifndef DISABLE_SYNC_TIMER | 376 | # ifndef DISABLE_SYNC_TIMER |
347 | serial_m2s_buffer.sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; | 377 | serial_m2s_buffer.sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; |
348 | # endif | 378 | # endif |
349 | return true; | 379 | return true; |
350 | } | 380 | } |
@@ -381,6 +411,11 @@ void transport_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) | |||
381 | set_oneshot_mods(serial_m2s_buffer.oneshot_mods); | 411 | set_oneshot_mods(serial_m2s_buffer.oneshot_mods); |
382 | # endif | 412 | # endif |
383 | # endif | 413 | # endif |
414 | |||
415 | # if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT) | ||
416 | rgb_matrix_config = serial_m2s_buffer.rgb_matrix; | ||
417 | g_suspend_state = serial_m2s_buffer.rgb_suspend_state; | ||
418 | # endif | ||
384 | } | 419 | } |
385 | 420 | ||
386 | #endif | 421 | #endif |
@@ -9,6 +9,12 @@ | |||
9 | 9 | ||
10 | This is a keyboard firmware based on the [tmk\_keyboard firmware](https://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR and ARM controllers, and more specifically, the [OLKB product line](https://olkb.com), the [ErgoDox EZ](https://ergodox-ez.com) keyboard, and the [Clueboard product line](https://clueboard.co). | 10 | This is a keyboard firmware based on the [tmk\_keyboard firmware](https://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR and ARM controllers, and more specifically, the [OLKB product line](https://olkb.com), the [ErgoDox EZ](https://ergodox-ez.com) keyboard, and the [Clueboard product line](https://clueboard.co). |
11 | 11 | ||
12 | # THIS IS THE DEVELOP BRANCH | ||
13 | |||
14 | Warning- This is the `develop` branch of QMK Firmware. You may encounter broken code here. Please see [Breaking Changes](https://docs.qmk.fm/#/breaking_changes) for more information. | ||
15 | |||
16 | # Original readme continues | ||
17 | |||
12 | ## Documentation | 18 | ## Documentation |
13 | 19 | ||
14 | * [See the official documentation on docs.qmk.fm](https://docs.qmk.fm) | 20 | * [See the official documentation on docs.qmk.fm](https://docs.qmk.fm) |
diff --git a/tmk_core/common.mk b/tmk_core/common.mk index 238b3c69f..2f8f81126 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk | |||
@@ -12,6 +12,7 @@ TMK_COMMON_SRC += $(COMMON_DIR)/host.c \ | |||
12 | $(COMMON_DIR)/sendchar_null.c \ | 12 | $(COMMON_DIR)/sendchar_null.c \ |
13 | $(COMMON_DIR)/eeconfig.c \ | 13 | $(COMMON_DIR)/eeconfig.c \ |
14 | $(COMMON_DIR)/report.c \ | 14 | $(COMMON_DIR)/report.c \ |
15 | $(COMMON_DIR)/usb_util.c \ | ||
15 | $(PLATFORM_COMMON_DIR)/suspend.c \ | 16 | $(PLATFORM_COMMON_DIR)/suspend.c \ |
16 | $(PLATFORM_COMMON_DIR)/timer.c \ | 17 | $(PLATFORM_COMMON_DIR)/timer.c \ |
17 | $(COMMON_DIR)/sync_timer.c \ | 18 | $(COMMON_DIR)/sync_timer.c \ |
@@ -24,28 +25,6 @@ else | |||
24 | include $(TMK_PATH)/$(COMMON_DIR)/lib_printf.mk | 25 | include $(TMK_PATH)/$(COMMON_DIR)/lib_printf.mk |
25 | endif | 26 | endif |
26 | 27 | ||
27 | # Option modules | ||
28 | BOOTMAGIC_ENABLE ?= no | ||
29 | VALID_MAGIC_TYPES := yes full lite | ||
30 | ifneq ($(strip $(BOOTMAGIC_ENABLE)), no) | ||
31 | ifeq ($(filter $(BOOTMAGIC_ENABLE),$(VALID_MAGIC_TYPES)),) | ||
32 | $(error BOOTMAGIC_ENABLE="$(BOOTMAGIC_ENABLE)" is not a valid type of magic) | ||
33 | endif | ||
34 | ifeq ($(strip $(BOOTMAGIC_ENABLE)), lite) | ||
35 | TMK_COMMON_DEFS += -DBOOTMAGIC_LITE | ||
36 | TMK_COMMON_SRC += $(COMMON_DIR)/bootmagic_lite.c | ||
37 | |||
38 | TMK_COMMON_DEFS += -DMAGIC_ENABLE | ||
39 | TMK_COMMON_SRC += $(COMMON_DIR)/magic.c | ||
40 | else | ||
41 | TMK_COMMON_DEFS += -DBOOTMAGIC_ENABLE | ||
42 | TMK_COMMON_SRC += $(COMMON_DIR)/bootmagic.c | ||
43 | endif | ||
44 | else | ||
45 | TMK_COMMON_DEFS += -DMAGIC_ENABLE | ||
46 | TMK_COMMON_SRC += $(COMMON_DIR)/magic.c | ||
47 | endif | ||
48 | |||
49 | SHARED_EP_ENABLE = no | 28 | SHARED_EP_ENABLE = no |
50 | MOUSE_SHARED_EP ?= yes | 29 | MOUSE_SHARED_EP ?= yes |
51 | ifeq ($(strip $(KEYBOARD_SHARED_EP)), yes) | 30 | ifeq ($(strip $(KEYBOARD_SHARED_EP)), yes) |
diff --git a/tmk_core/common/action_util.c b/tmk_core/common/action_util.c index 000503b08..a57c8bf66 100644 --- a/tmk_core/common/action_util.c +++ b/tmk_core/common/action_util.c | |||
@@ -147,12 +147,16 @@ void clear_oneshot_swaphands(void) { | |||
147 | * FIXME: needs doc | 147 | * FIXME: needs doc |
148 | */ | 148 | */ |
149 | void set_oneshot_layer(uint8_t layer, uint8_t state) { | 149 | void set_oneshot_layer(uint8_t layer, uint8_t state) { |
150 | oneshot_layer_data = layer << 3 | state; | 150 | if (!keymap_config.oneshot_disable) { |
151 | layer_on(layer); | 151 | oneshot_layer_data = layer << 3 | state; |
152 | layer_on(layer); | ||
152 | # if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) | 153 | # if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) |
153 | oneshot_layer_time = timer_read(); | 154 | oneshot_layer_time = timer_read(); |
154 | # endif | 155 | # endif |
155 | oneshot_layer_changed_kb(get_oneshot_layer()); | 156 | oneshot_layer_changed_kb(get_oneshot_layer()); |
157 | } else { | ||
158 | layer_on(layer); | ||
159 | } | ||
156 | } | 160 | } |
157 | /** \brief Reset oneshot layer | 161 | /** \brief Reset oneshot layer |
158 | * | 162 | * |
@@ -172,7 +176,7 @@ void reset_oneshot_layer(void) { | |||
172 | void clear_oneshot_layer_state(oneshot_fullfillment_t state) { | 176 | void clear_oneshot_layer_state(oneshot_fullfillment_t state) { |
173 | uint8_t start_state = oneshot_layer_data; | 177 | uint8_t start_state = oneshot_layer_data; |
174 | oneshot_layer_data &= ~state; | 178 | oneshot_layer_data &= ~state; |
175 | if (!get_oneshot_layer_state() && start_state != oneshot_layer_data) { | 179 | if ((!get_oneshot_layer_state() && start_state != oneshot_layer_data) || keymap_config.oneshot_disable) { |
176 | layer_off(get_oneshot_layer()); | 180 | layer_off(get_oneshot_layer()); |
177 | reset_oneshot_layer(); | 181 | reset_oneshot_layer(); |
178 | } | 182 | } |
@@ -182,6 +186,39 @@ void clear_oneshot_layer_state(oneshot_fullfillment_t state) { | |||
182 | * FIXME: needs doc | 186 | * FIXME: needs doc |
183 | */ | 187 | */ |
184 | bool is_oneshot_layer_active(void) { return get_oneshot_layer_state(); } | 188 | bool is_oneshot_layer_active(void) { return get_oneshot_layer_state(); } |
189 | |||
190 | /** \brief set oneshot | ||
191 | * | ||
192 | * FIXME: needs doc | ||
193 | */ | ||
194 | void oneshot_set(bool active) { | ||
195 | if (keymap_config.oneshot_disable != active) { | ||
196 | keymap_config.oneshot_disable = active; | ||
197 | eeconfig_update_keymap(keymap_config.raw); | ||
198 | dprintf("Oneshot: active: %d\n", active); | ||
199 | } | ||
200 | } | ||
201 | |||
202 | /** \brief toggle oneshot | ||
203 | * | ||
204 | * FIXME: needs doc | ||
205 | */ | ||
206 | void oneshot_toggle(void) { oneshot_set(!keymap_config.oneshot_disable); } | ||
207 | |||
208 | /** \brief enable oneshot | ||
209 | * | ||
210 | * FIXME: needs doc | ||
211 | */ | ||
212 | void oneshot_enable(void) { oneshot_set(true); } | ||
213 | |||
214 | /** \brief disable oneshot | ||
215 | * | ||
216 | * FIXME: needs doc | ||
217 | */ | ||
218 | void oneshot_disable(void) { oneshot_set(false); } | ||
219 | |||
220 | bool is_oneshot_enabled(void) { return keymap_config.oneshot_disable; } | ||
221 | |||
185 | #endif | 222 | #endif |
186 | 223 | ||
187 | /** \brief Send keyboard report | 224 | /** \brief Send keyboard report |
@@ -321,14 +358,17 @@ void del_oneshot_mods(uint8_t mods) { | |||
321 | * FIXME: needs doc | 358 | * FIXME: needs doc |
322 | */ | 359 | */ |
323 | void set_oneshot_mods(uint8_t mods) { | 360 | void set_oneshot_mods(uint8_t mods) { |
324 | if (oneshot_mods != mods) { | 361 | if (!keymap_config.oneshot_disable) { |
362 | if (oneshot_mods != mods) { | ||
325 | # if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) | 363 | # if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) |
326 | oneshot_time = timer_read(); | 364 | oneshot_time = timer_read(); |
327 | # endif | 365 | # endif |
328 | oneshot_mods = mods; | 366 | oneshot_mods = mods; |
329 | oneshot_mods_changed_kb(mods); | 367 | oneshot_mods_changed_kb(mods); |
368 | } | ||
330 | } | 369 | } |
331 | } | 370 | } |
371 | |||
332 | /** \brief clear oneshot mods | 372 | /** \brief clear oneshot mods |
333 | * | 373 | * |
334 | * FIXME: needs doc | 374 | * FIXME: needs doc |
diff --git a/tmk_core/common/action_util.h b/tmk_core/common/action_util.h index ff29f79b0..f2b3897ae 100644 --- a/tmk_core/common/action_util.h +++ b/tmk_core/common/action_util.h | |||
@@ -85,6 +85,11 @@ void oneshot_mods_changed_kb(uint8_t mods); | |||
85 | void oneshot_layer_changed_user(uint8_t layer); | 85 | void oneshot_layer_changed_user(uint8_t layer); |
86 | void oneshot_layer_changed_kb(uint8_t layer); | 86 | void oneshot_layer_changed_kb(uint8_t layer); |
87 | 87 | ||
88 | void oneshot_toggle(void); | ||
89 | void oneshot_enable(void); | ||
90 | void oneshot_disable(void); | ||
91 | bool is_oneshot_enabled(void); | ||
92 | |||
88 | /* inspect */ | 93 | /* inspect */ |
89 | uint8_t has_anymod(void); | 94 | uint8_t has_anymod(void); |
90 | 95 | ||
diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index 47a82a2ee..d52c8ac41 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c | |||
@@ -28,6 +28,10 @@ | |||
28 | # include "rgblight.h" | 28 | # include "rgblight.h" |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #ifdef RGB_MATRIX_ENABLE | ||
32 | # include "rgb_matrix.h" | ||
33 | #endif | ||
34 | |||
31 | /** \brief Suspend idle | 35 | /** \brief Suspend idle |
32 | * | 36 | * |
33 | * FIXME: needs doc | 37 | * FIXME: needs doc |
diff --git a/tmk_core/common/chibios/chibios_config.h b/tmk_core/common/chibios/chibios_config.h index b4d96465d..bebf026de 100644 --- a/tmk_core/common/chibios/chibios_config.h +++ b/tmk_core/common/chibios/chibios_config.h | |||
@@ -15,6 +15,8 @@ | |||
15 | */ | 15 | */ |
16 | #pragma once | 16 | #pragma once |
17 | 17 | ||
18 | #define SPLIT_USB_DETECT // Force this on for now | ||
19 | |||
18 | #if defined(STM32F1XX) | 20 | #if defined(STM32F1XX) |
19 | # define USE_GPIOV1 | 21 | # define USE_GPIOV1 |
20 | #endif | 22 | #endif |
diff --git a/tmk_core/common/chibios/sleep_led.c b/tmk_core/common/chibios/sleep_led.c index 5595eec0e..477056a45 100644 --- a/tmk_core/common/chibios/sleep_led.c +++ b/tmk_core/common/chibios/sleep_led.c | |||
@@ -9,21 +9,13 @@ | |||
9 | * Use LP timer on Kinetises, TIM14 on STM32F0. | 9 | * Use LP timer on Kinetises, TIM14 on STM32F0. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #if defined(KL2x) || defined(K20x) | 12 | #ifndef SLEEP_LED_GPT_DRIVER |
13 | 13 | # if defined(STM32F0XX) | |
14 | /* Use Low Power Timer (LPTMR) */ | 14 | # define SLEEP_LED_GPT_DRIVER GPTD14 |
15 | # define TIMER_INTERRUPT_VECTOR KINETIS_LPTMR0_IRQ_VECTOR | 15 | # endif |
16 | # define RESET_COUNTER LPTMR0->CSR |= LPTMRx_CSR_TCF | ||
17 | |||
18 | #elif defined(STM32F0XX) | ||
19 | |||
20 | /* Use TIM14 manually */ | ||
21 | # define TIMER_INTERRUPT_VECTOR STM32_TIM14_HANDLER | ||
22 | # define RESET_COUNTER STM32_TIM14->SR &= ~STM32_TIM_SR_UIF | ||
23 | |||
24 | #endif | 16 | #endif |
25 | 17 | ||
26 | #if defined(KL2x) || defined(K20x) || defined(STM32F0XX) /* common parts for timers/interrupts */ | 18 | #if defined(KL2x) || defined(K20x) || defined(SLEEP_LED_GPT_DRIVER) /* common parts for timers/interrupts */ |
27 | 19 | ||
28 | /* Breathing Sleep LED brighness(PWM On period) table | 20 | /* Breathing Sleep LED brighness(PWM On period) table |
29 | * (64[steps] * 4[duration]) / 64[PWM periods/s] = 4 second breath cycle | 21 | * (64[steps] * 4[duration]) / 64[PWM periods/s] = 4 second breath cycle |
@@ -33,10 +25,7 @@ | |||
33 | */ | 25 | */ |
34 | static const uint8_t breathing_table[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 6, 10, 15, 23, 32, 44, 58, 74, 93, 113, 135, 157, 179, 199, 218, 233, 245, 252, 255, 252, 245, 233, 218, 199, 179, 157, 135, 113, 93, 74, 58, 44, 32, 23, 15, 10, 6, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | 26 | static const uint8_t breathing_table[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 6, 10, 15, 23, 32, 44, 58, 74, 93, 113, 135, 157, 179, 199, 218, 233, 245, 252, 255, 252, 245, 233, 218, 199, 179, 157, 135, 113, 93, 74, 58, 44, 32, 23, 15, 10, 6, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
35 | 27 | ||
36 | /* interrupt handler */ | 28 | void sleep_led_timer_callback(void) { |
37 | OSAL_IRQ_HANDLER(TIMER_INTERRUPT_VECTOR) { | ||
38 | OSAL_IRQ_PROLOGUE(); | ||
39 | |||
40 | /* Software PWM | 29 | /* Software PWM |
41 | * timer:1111 1111 1111 1111 | 30 | * timer:1111 1111 1111 1111 |
42 | * \_____/\/ \_______/____ count(0-255) | 31 | * \_____/\/ \_______/____ count(0-255) |
@@ -64,17 +53,16 @@ OSAL_IRQ_HANDLER(TIMER_INTERRUPT_VECTOR) { | |||
64 | if (timer.pwm.count == breathing_table[timer.pwm.index]) { | 53 | if (timer.pwm.count == breathing_table[timer.pwm.index]) { |
65 | led_set(0); | 54 | led_set(0); |
66 | } | 55 | } |
67 | |||
68 | /* Reset the counter */ | ||
69 | RESET_COUNTER; | ||
70 | |||
71 | OSAL_IRQ_EPILOGUE(); | ||
72 | } | 56 | } |
73 | 57 | ||
74 | #endif /* common parts for known platforms */ | 58 | #endif /* common parts for known platforms */ |
75 | 59 | ||
76 | #if defined(KL2x) || defined(K20x) /* platform selection: familiar Kinetis chips */ | 60 | #if defined(KL2x) || defined(K20x) /* platform selection: familiar Kinetis chips */ |
77 | 61 | ||
62 | /* Use Low Power Timer (LPTMR) */ | ||
63 | # define TIMER_INTERRUPT_VECTOR KINETIS_LPTMR0_IRQ_VECTOR | ||
64 | # define RESET_COUNTER LPTMR0->CSR |= LPTMRx_CSR_TCF | ||
65 | |||
78 | /* LPTMR clock options */ | 66 | /* LPTMR clock options */ |
79 | # define LPTMR_CLOCK_MCGIRCLK 0 /* 4MHz clock */ | 67 | # define LPTMR_CLOCK_MCGIRCLK 0 /* 4MHz clock */ |
80 | # define LPTMR_CLOCK_LPO 1 /* 1kHz clock */ | 68 | # define LPTMR_CLOCK_LPO 1 /* 1kHz clock */ |
@@ -86,6 +74,18 @@ OSAL_IRQ_HANDLER(TIMER_INTERRUPT_VECTOR) { | |||
86 | # define SIM_SCGC5_LPTMR SIM_SCGC5_LPTIMER | 74 | # define SIM_SCGC5_LPTMR SIM_SCGC5_LPTIMER |
87 | # endif | 75 | # endif |
88 | 76 | ||
77 | /* interrupt handler */ | ||
78 | OSAL_IRQ_HANDLER(TIMER_INTERRUPT_VECTOR) { | ||
79 | OSAL_IRQ_PROLOGUE(); | ||
80 | |||
81 | sleep_led_timer_callback(); | ||
82 | |||
83 | /* Reset the counter */ | ||
84 | RESET_COUNTER; | ||
85 | |||
86 | OSAL_IRQ_EPILOGUE(); | ||
87 | } | ||
88 | |||
89 | /* Initialise the timer */ | 89 | /* Initialise the timer */ |
90 | void sleep_led_init(void) { | 90 | void sleep_led_init(void) { |
91 | /* Make sure the clock to the LPTMR is enabled */ | 91 | /* Make sure the clock to the LPTMR is enabled */ |
@@ -159,45 +159,23 @@ void sleep_led_toggle(void) { | |||
159 | LPTMR0->CSR ^= LPTMRx_CSR_TEN; | 159 | LPTMR0->CSR ^= LPTMRx_CSR_TEN; |
160 | } | 160 | } |
161 | 161 | ||
162 | #elif defined(STM32F0XX) /* platform selection: STM32F0XX */ | 162 | #elif defined(SLEEP_LED_GPT_DRIVER) |
163 | |||
164 | /* Initialise the timer */ | ||
165 | void sleep_led_init(void) { | ||
166 | /* enable clock */ | ||
167 | rccEnableTIM14(FALSE); /* low power enable = FALSE */ | ||
168 | rccResetTIM14(); | ||
169 | |||
170 | /* prescale */ | ||
171 | /* Assuming 48MHz internal clock */ | ||
172 | /* getting cca 65484 irqs/sec */ | ||
173 | STM32_TIM14->PSC = 733; | ||
174 | 163 | ||
175 | /* auto-reload */ | 164 | static void gptTimerCallback(GPTDriver *gptp) { |
176 | /* 0 => interrupt every time */ | 165 | (void)gptp; |
177 | STM32_TIM14->ARR = 3; | 166 | sleep_led_timer_callback(); |
167 | } | ||
178 | 168 | ||
179 | /* enable counter update event interrupt */ | 169 | static const GPTConfig gptcfg = {1000000, gptTimerCallback, 0, 0}; |
180 | STM32_TIM14->DIER |= STM32_TIM_DIER_UIE; | ||
181 | 170 | ||
182 | /* register interrupt vector */ | 171 | /* Initialise the timer */ |
183 | nvicEnableVector(STM32_TIM14_NUMBER, 2); /* vector, priority */ | 172 | void sleep_led_init(void) { gptStart(&SLEEP_LED_GPT_DRIVER, &gptcfg); } |
184 | } | ||
185 | 173 | ||
186 | void sleep_led_enable(void) { | 174 | void sleep_led_enable(void) { gptStartContinuous(&SLEEP_LED_GPT_DRIVER, gptcfg.frequency / 0xFFFF); } |
187 | /* Enable the timer */ | ||
188 | STM32_TIM14->CR1 = STM32_TIM_CR1_CEN | STM32_TIM_CR1_URS; | ||
189 | /* URS => update event only on overflow; setting UG bit disabled */ | ||
190 | } | ||
191 | 175 | ||
192 | void sleep_led_disable(void) { | 176 | void sleep_led_disable(void) { gptStopTimer(&SLEEP_LED_GPT_DRIVER); } |
193 | /* Disable the timer */ | ||
194 | STM32_TIM14->CR1 = 0; | ||
195 | } | ||
196 | 177 | ||
197 | void sleep_led_toggle(void) { | 178 | void sleep_led_toggle(void) { (SLEEP_LED_GPT_DRIVER.state == GPT_READY) ? sleep_led_enable() : sleep_led_disable(); } |
198 | /* Toggle the timer */ | ||
199 | STM32_TIM14->CR1 ^= STM32_TIM_CR1_CEN; | ||
200 | } | ||
201 | 179 | ||
202 | #else /* platform selection: not on familiar chips */ | 180 | #else /* platform selection: not on familiar chips */ |
203 | 181 | ||
diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c index 49e20641f..17f024cab 100644 --- a/tmk_core/common/chibios/suspend.c +++ b/tmk_core/common/chibios/suspend.c | |||
@@ -24,6 +24,10 @@ | |||
24 | # include "rgblight.h" | 24 | # include "rgblight.h" |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #ifdef RGB_MATRIX_ENABLE | ||
28 | # include "rgb_matrix.h" | ||
29 | #endif | ||
30 | |||
27 | /** \brief suspend idle | 31 | /** \brief suspend idle |
28 | * | 32 | * |
29 | * FIXME: needs doc | 33 | * FIXME: needs doc |
@@ -53,6 +57,10 @@ void suspend_power_down(void) { | |||
53 | backlight_set(0); | 57 | backlight_set(0); |
54 | #endif | 58 | #endif |
55 | 59 | ||
60 | #ifdef RGB_MATRIX_ENABLE | ||
61 | rgb_matrix_task(); | ||
62 | #endif | ||
63 | |||
56 | // Turn off LED indicators | 64 | // Turn off LED indicators |
57 | uint8_t leds_off = 0; | 65 | uint8_t leds_off = 0; |
58 | #if defined(BACKLIGHT_CAPS_LOCK) && defined(BACKLIGHT_ENABLE) | 66 | #if defined(BACKLIGHT_CAPS_LOCK) && defined(BACKLIGHT_ENABLE) |
diff --git a/tmk_core/common/eeconfig.c b/tmk_core/common/eeconfig.c index 5e3ebe6ee..92a509217 100644 --- a/tmk_core/common/eeconfig.c +++ b/tmk_core/common/eeconfig.c | |||
@@ -57,7 +57,7 @@ void eeconfig_init_quantum(void) { | |||
57 | eeprom_update_dword(EECONFIG_HAPTIC, 0); | 57 | eeprom_update_dword(EECONFIG_HAPTIC, 0); |
58 | eeprom_update_byte(EECONFIG_VELOCIKEY, 0); | 58 | eeprom_update_byte(EECONFIG_VELOCIKEY, 0); |
59 | eeprom_update_dword(EECONFIG_RGB_MATRIX, 0); | 59 | eeprom_update_dword(EECONFIG_RGB_MATRIX, 0); |
60 | eeprom_update_byte(EECONFIG_RGB_MATRIX_SPEED, 0); | 60 | eeprom_update_word(EECONFIG_RGB_MATRIX_EXTENDED, 0); |
61 | 61 | ||
62 | // TODO: Remove once ARM has a way to configure EECONFIG_HANDEDNESS | 62 | // TODO: Remove once ARM has a way to configure EECONFIG_HANDEDNESS |
63 | // within the emulated eeprom via dfu-util or another tool | 63 | // within the emulated eeprom via dfu-util or another tool |
diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h index 86b9e6f99..9e18fd4e1 100644 --- a/tmk_core/common/eeconfig.h +++ b/tmk_core/common/eeconfig.h | |||
@@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
21 | #include <stdbool.h> | 21 | #include <stdbool.h> |
22 | 22 | ||
23 | #ifndef EECONFIG_MAGIC_NUMBER | 23 | #ifndef EECONFIG_MAGIC_NUMBER |
24 | # define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEEB // When changing, decrement this value to avoid future re-init issues | 24 | # define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEEA // When changing, decrement this value to avoid future re-init issues |
25 | #endif | 25 | #endif |
26 | #define EECONFIG_MAGIC_NUMBER_OFF (uint16_t)0xFFFF | 26 | #define EECONFIG_MAGIC_NUMBER_OFF (uint16_t)0xFFFF |
27 | 27 | ||
@@ -43,12 +43,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
43 | #define EECONFIG_VELOCIKEY (uint8_t *)23 | 43 | #define EECONFIG_VELOCIKEY (uint8_t *)23 |
44 | 44 | ||
45 | #define EECONFIG_HAPTIC (uint32_t *)24 | 45 | #define EECONFIG_HAPTIC (uint32_t *)24 |
46 | |||
47 | // Mutually exclusive | ||
48 | #define EECONFIG_LED_MATRIX (uint32_t *)28 | ||
46 | #define EECONFIG_RGB_MATRIX (uint32_t *)28 | 49 | #define EECONFIG_RGB_MATRIX (uint32_t *)28 |
47 | #define EECONFIG_RGB_MATRIX_SPEED (uint8_t *)32 | 50 | // Speed & Flags |
51 | #define EECONFIG_LED_MATRIX_EXTENDED (uint16_t *)32 | ||
52 | #define EECONFIG_RGB_MATRIX_EXTENDED (uint16_t *)32 | ||
53 | |||
48 | // TODO: Combine these into a single word and single block of EEPROM | 54 | // TODO: Combine these into a single word and single block of EEPROM |
49 | #define EECONFIG_KEYMAP_UPPER_BYTE (uint8_t *)33 | 55 | #define EECONFIG_KEYMAP_UPPER_BYTE (uint8_t *)34 |
50 | // Size of EEPROM being used, other code can refer to this for available EEPROM | 56 | // Size of EEPROM being used, other code can refer to this for available EEPROM |
51 | #define EECONFIG_SIZE 34 | 57 | #define EECONFIG_SIZE 35 |
52 | /* debug bit */ | 58 | /* debug bit */ |
53 | #define EECONFIG_DEBUG_ENABLE (1 << 0) | 59 | #define EECONFIG_DEBUG_ENABLE (1 << 0) |
54 | #define EECONFIG_DEBUG_MATRIX (1 << 1) | 60 | #define EECONFIG_DEBUG_MATRIX (1 << 1) |
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index ce3255c06..65d9e00c7 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c | |||
@@ -34,11 +34,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
34 | #ifdef BACKLIGHT_ENABLE | 34 | #ifdef BACKLIGHT_ENABLE |
35 | # include "backlight.h" | 35 | # include "backlight.h" |
36 | #endif | 36 | #endif |
37 | #ifdef BOOTMAGIC_ENABLE | ||
38 | # include "bootmagic.h" | ||
39 | #else | ||
40 | # include "magic.h" | ||
41 | #endif | ||
42 | #ifdef MOUSEKEY_ENABLE | 37 | #ifdef MOUSEKEY_ENABLE |
43 | # include "mousekey.h" | 38 | # include "mousekey.h" |
44 | #endif | 39 | #endif |
@@ -296,11 +291,6 @@ void keyboard_init(void) { | |||
296 | #ifdef ADB_MOUSE_ENABLE | 291 | #ifdef ADB_MOUSE_ENABLE |
297 | adb_mouse_init(); | 292 | adb_mouse_init(); |
298 | #endif | 293 | #endif |
299 | #ifdef BOOTMAGIC_ENABLE | ||
300 | bootmagic(); | ||
301 | #else | ||
302 | magic(); | ||
303 | #endif | ||
304 | #ifdef BACKLIGHT_ENABLE | 294 | #ifdef BACKLIGHT_ENABLE |
305 | backlight_init(); | 295 | backlight_init(); |
306 | #endif | 296 | #endif |
diff --git a/tmk_core/common/magic.c b/tmk_core/common/magic.c deleted file mode 100644 index e14994164..000000000 --- a/tmk_core/common/magic.c +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | #include <stdint.h> | ||
2 | #include <stdbool.h> | ||
3 | #if defined(__AVR__) | ||
4 | # include <util/delay.h> | ||
5 | #endif | ||
6 | #include "matrix.h" | ||
7 | #include "bootloader.h" | ||
8 | #include "debug.h" | ||
9 | #include "keymap.h" | ||
10 | #include "host.h" | ||
11 | #include "action_layer.h" | ||
12 | #include "eeconfig.h" | ||
13 | #include "magic.h" | ||
14 | |||
15 | keymap_config_t keymap_config; | ||
16 | |||
17 | /** \brief Magic | ||
18 | * | ||
19 | * FIXME: Needs doc | ||
20 | */ | ||
21 | void magic(void) { | ||
22 | /* check signature */ | ||
23 | if (!eeconfig_is_enabled()) { | ||
24 | eeconfig_init(); | ||
25 | } | ||
26 | |||
27 | /* debug enable */ | ||
28 | debug_config.raw = eeconfig_read_debug(); | ||
29 | |||
30 | /* keymap config */ | ||
31 | keymap_config.raw = eeconfig_read_keymap(); | ||
32 | |||
33 | uint8_t default_layer = 0; | ||
34 | default_layer = eeconfig_read_default_layer(); | ||
35 | default_layer_set((layer_state_t)default_layer); | ||
36 | |||
37 | /* Also initialize layer state to trigger callback functions for layer_state */ | ||
38 | layer_state_set_kb((layer_state_t)layer_state); | ||
39 | } | ||
diff --git a/tmk_core/common/magic.h b/tmk_core/common/magic.h deleted file mode 100644 index a6552c04d..000000000 --- a/tmk_core/common/magic.h +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | #pragma once | ||
2 | |||
3 | void magic(void); | ||
diff --git a/tmk_core/common/usb_util.c b/tmk_core/common/usb_util.c new file mode 100644 index 000000000..e4c50fcb1 --- /dev/null +++ b/tmk_core/common/usb_util.c | |||
@@ -0,0 +1,29 @@ | |||
1 | /* Copyright 2021 QMK | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 3 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #include "usb_util.h" | ||
17 | #include "wait.h" | ||
18 | |||
19 | __attribute__((weak)) void usb_disable(void) {} | ||
20 | __attribute__((weak)) bool usb_connected_state(void) { return true; } | ||
21 | __attribute__((weak)) bool usb_vbus_state(void) { | ||
22 | #ifdef USB_VBUS_PIN | ||
23 | setPinInput(USB_VBUS_PIN); | ||
24 | wait_us(5); | ||
25 | return readPin(USB_VBUS_PIN); | ||
26 | #else | ||
27 | return true; | ||
28 | #endif | ||
29 | } | ||
diff --git a/tmk_core/common/usb_util.h b/tmk_core/common/usb_util.h new file mode 100644 index 000000000..4ebedb1e7 --- /dev/null +++ b/tmk_core/common/usb_util.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* Copyright 2021 QMK | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 3 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | #include <stdbool.h> | ||
19 | |||
20 | void usb_disable(void); | ||
21 | bool usb_connected_state(void); | ||
22 | bool usb_vbus_state(void); | ||
diff --git a/tmk_core/protocol.mk b/tmk_core/protocol.mk index 0c41642b9..cc87e8347 100644 --- a/tmk_core/protocol.mk +++ b/tmk_core/protocol.mk | |||
@@ -54,5 +54,9 @@ ifeq ($(strip $(XT_ENABLE)), yes) | |||
54 | OPT_DEFS += -DXT_ENABLE | 54 | OPT_DEFS += -DXT_ENABLE |
55 | endif | 55 | endif |
56 | 56 | ||
57 | ifeq ($(strip $(USB_HID_ENABLE)), yes) | ||
58 | include $(TMK_DIR)/protocol/usb_hid.mk | ||
59 | endif | ||
60 | |||
57 | # Search Path | 61 | # Search Path |
58 | VPATH += $(TMK_DIR)/protocol | 62 | VPATH += $(TMK_DIR)/protocol |
diff --git a/tmk_core/protocol/chibios.mk b/tmk_core/protocol/chibios.mk index 80554abb3..d01697835 100644 --- a/tmk_core/protocol/chibios.mk +++ b/tmk_core/protocol/chibios.mk | |||
@@ -6,6 +6,7 @@ SRC += $(CHIBIOS_DIR)/usb_main.c | |||
6 | SRC += $(CHIBIOS_DIR)/main.c | 6 | SRC += $(CHIBIOS_DIR)/main.c |
7 | SRC += usb_descriptor.c | 7 | SRC += usb_descriptor.c |
8 | SRC += $(CHIBIOS_DIR)/usb_driver.c | 8 | SRC += $(CHIBIOS_DIR)/usb_driver.c |
9 | SRC += $(CHIBIOS_DIR)/usb_util.c | ||
9 | SRC += $(LIBSRC) | 10 | SRC += $(LIBSRC) |
10 | 11 | ||
11 | VPATH += $(TMK_PATH)/$(PROTOCOL_DIR) | 12 | VPATH += $(TMK_PATH)/$(PROTOCOL_DIR) |
diff --git a/tmk_core/protocol/chibios/usb_util.c b/tmk_core/protocol/chibios/usb_util.c new file mode 100644 index 000000000..5945e8a8d --- /dev/null +++ b/tmk_core/protocol/chibios/usb_util.c | |||
@@ -0,0 +1,21 @@ | |||
1 | /* Copyright 2021 QMK | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 3 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #include <hal.h> | ||
17 | #include "usb_util.h" | ||
18 | |||
19 | void usb_disable(void) { usbStop(&USBD1); } | ||
20 | |||
21 | bool usb_connected_state(void) { return usbGetDriverStateI(&USBD1) == USB_ACTIVE; } | ||
diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa.mk index 1cc1fa04e..9d9fb728b 100644 --- a/tmk_core/protocol/lufa.mk +++ b/tmk_core/protocol/lufa.mk | |||
@@ -44,6 +44,7 @@ ifeq ($(strip $(VIRTSER_ENABLE)), yes) | |||
44 | endif | 44 | endif |
45 | 45 | ||
46 | SRC += $(LUFA_SRC) | 46 | SRC += $(LUFA_SRC) |
47 | SRC += $(LUFA_DIR)/usb_util.c | ||
47 | 48 | ||
48 | # Search Path | 49 | # Search Path |
49 | VPATH += $(TMK_PATH)/$(LUFA_DIR) | 50 | VPATH += $(TMK_PATH)/$(LUFA_DIR) |
diff --git a/tmk_core/protocol/lufa/usb_util.c b/tmk_core/protocol/lufa/usb_util.c new file mode 100644 index 000000000..9e943a21b --- /dev/null +++ b/tmk_core/protocol/lufa/usb_util.c | |||
@@ -0,0 +1,34 @@ | |||
1 | /* Copyright 2021 QMK | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 3 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #include <LUFA/Drivers/USB/USB.h> | ||
17 | #include "usb_util.h" | ||
18 | #include "wait.h" | ||
19 | |||
20 | void usb_disable(void) { | ||
21 | USB_Disable(); | ||
22 | USB_DeviceState = DEVICE_STATE_Unattached; | ||
23 | } | ||
24 | |||
25 | bool usb_connected_state(void) { return USB_Device_IsAddressSet(); } | ||
26 | |||
27 | #if defined(OTGPADE) | ||
28 | bool usb_vbus_state(void) { | ||
29 | USB_OTGPAD_On(); // enables VBUS pad | ||
30 | wait_us(5); | ||
31 | |||
32 | return USB_VBUS_GetStatus(); // checks state of VBUS | ||
33 | } | ||
34 | #endif | ||
diff --git a/tmk_core/protocol/vusb.mk b/tmk_core/protocol/vusb.mk index 1de600308..e4d013b38 100644 --- a/tmk_core/protocol/vusb.mk +++ b/tmk_core/protocol/vusb.mk | |||
@@ -5,6 +5,7 @@ VUSB_PATH = $(LIB_PATH)/vusb | |||
5 | 5 | ||
6 | SRC += $(VUSB_DIR)/main.c \ | 6 | SRC += $(VUSB_DIR)/main.c \ |
7 | $(VUSB_DIR)/vusb.c \ | 7 | $(VUSB_DIR)/vusb.c \ |
8 | $(VUSB_DIR)/usb_util.c \ | ||
8 | $(VUSB_PATH)/usbdrv/usbdrv.c \ | 9 | $(VUSB_PATH)/usbdrv/usbdrv.c \ |
9 | $(VUSB_PATH)/usbdrv/usbdrvasm.S \ | 10 | $(VUSB_PATH)/usbdrv/usbdrvasm.S \ |
10 | $(VUSB_PATH)/usbdrv/oddebug.c | 11 | $(VUSB_PATH)/usbdrv/oddebug.c |
diff --git a/tmk_core/protocol/vusb/usb_util.c b/tmk_core/protocol/vusb/usb_util.c new file mode 100644 index 000000000..602854dbe --- /dev/null +++ b/tmk_core/protocol/vusb/usb_util.c | |||
@@ -0,0 +1,24 @@ | |||
1 | /* Copyright 2021 QMK | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 3 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #include <usbdrv/usbdrv.h> | ||
17 | #include "usb_util.h" | ||
18 | |||
19 | void usb_disable(void) { usbDeviceDisconnect(); } | ||
20 | |||
21 | bool usb_connected_state(void) { | ||
22 | usbPoll(); | ||
23 | return usbConfiguration; | ||
24 | } | ||