diff options
120 files changed, 4417 insertions, 2529 deletions
diff --git a/common_features.mk b/common_features.mk index a431923bcf..93c34c7d54 100644 --- a/common_features.mk +++ b/common_features.mk @@ -175,7 +175,9 @@ ifneq ($(strip $(LED_MATRIX_ENABLE)), no) ifeq ($(filter $(LED_MATRIX_ENABLE),$(VALID_MATRIX_TYPES)),) $(error LED_MATRIX_ENABLE="$(LED_MATRIX_ENABLE)" is not a valid matrix type) else - OPT_DEFS += -DLED_MATRIX_ENABLE -DBACKLIGHT_ENABLE -DBACKLIGHT_CUSTOM_DRIVER + BACKLIGHT_ENABLE = yes + BACKLIGHT_DRIVER = custom + OPT_DEFS += -DLED_MATRIX_ENABLE SRC += $(QUANTUM_DIR)/led_matrix.c SRC += $(QUANTUM_DIR)/led_matrix_drivers.c endif @@ -300,10 +302,6 @@ ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) $(error BACKLIGHT_DRIVER="$(BACKLIGHT_DRIVER)" is not a valid backlight type) endif - ifeq ($(strip $(VISUALIZER_ENABLE)), yes) - CIE1931_CURVE := yes - endif - COMMON_VPATH += $(QUANTUM_DIR)/backlight SRC += $(QUANTUM_DIR)/backlight/backlight.c OPT_DEFS += -DBACKLIGHT_ENABLE @@ -343,6 +341,10 @@ ifeq ($(strip $(WS2812_DRIVER_REQUIRED)), yes) endif endif +ifeq ($(strip $(VISUALIZER_ENABLE)), yes) + CIE1931_CURVE := yes +endif + ifeq ($(strip $(CIE1931_CURVE)), yes) OPT_DEFS += -DUSE_CIE1931_CURVE LED_TABLES := yes diff --git a/docs/_summary.md b/docs/_summary.md index 08ccdca220..a429138b8f 100644 --- a/docs/_summary.md +++ b/docs/_summary.md @@ -18,6 +18,7 @@ * [Getting Help](getting_started_getting_help.md) * [Breaking Changes](breaking_changes.md) + * [My Pull Request Was Flagged](breaking_changes_instructions.md) * [2019 Aug 30](ChangeLog/20190830.md) * [FAQ](faq.md) diff --git a/docs/breaking_changes_instructions.md b/docs/breaking_changes_instructions.md new file mode 100644 index 0000000000..3f2f93834f --- /dev/null +++ b/docs/breaking_changes_instructions.md @@ -0,0 +1,42 @@ +# Breaking Changes: My Pull Request Was Flagged + +A QMK member may have replied to your pull request stating that your submission is a breaking change. In their judgment, the changes you have proposed have greater implications for either QMK, or its users. + +Some things that may cause a pull request to be flagged are: + +- **Edits to User Keymaps** + A user may submit their keymap to QMK, then some time later open a pull request with further updates, only to find it can't be merged because it was edited in the `qmk/qmk_firmware` repository. As not all users are proficient at using Git or GitHub, the user may find themself unable to fix the issue on their own. +- **Changes to Expected Behavior** + Changes to QMK behavior may cause users to believe their hardware or QMK is broken if they flash new firmware that incorporates changes to existing QMK features, and find themselves without a means to restore the desired behavior. +- **Changes Requiring User Action** + Changes may also require action to be taken by users, such as updating a toolchain or taking some action in Git. +- **Changes Necessitating Increased Scrutiny** + On occasion, a submission may have implications for QMK as a project. This could be copyright/licensing issues, coding conventions, large feature overhauls, "high-risk" changes that need wider testing by our community, or something else entirely. +- **Changes Requiring Communication to End Users** + This includes warnings about future deprecations, outdated practices, and anything else that needs to be communicated but doesn't fit into one of the above categories. + +## What Do I Do? + +If it is determined that your submission is a breaking change, there are a few things you can do to smooth the process: + +### Consider Splitting Up Your PR + +If you are contributing core code, and the only reason it needs to go through breaking changes is that you are updating keymaps to match your change, consider whether you can submit your feature in a way that the old keymaps continue to work. Then submit a separate PR that goes through the breaking changes process to remove the old code. + +### Contribute a ChangeLog Entry + +We require submissions that go through the Breaking Change process to include a changelog entry. The entry should be a short summary of the changes your pull request makes – [each section here started as a changelog](ChangeLog/20190830.md "n.b. This should link to the 2019 Aug 30 Breaking Changes doc - @noroadsleft"). + +Your changelog should be located at `docs/ChangeLog/YYYYMMDD/PR####.md`, where `YYYYMMDD` is the date on which QMK's breaking change branch – usually named `future` – will be merged into the `master` branch, and `####` is the number of your pull request. + +If your submission requires action on the part of users, your changelog should instruct users what action(s) must be taken, or link to a location that does so. + +### Document Your Changes + +Understanding the purpose for your submission, and possible implications or actions it will require can make the review process more straightforward. A changelog may suffice for this purpose, but more extensive changes may require a level of detail that is ill-suited for a changelog. + +Commenting on your pull request and being responsive to questions, comments, and change requests is much appreciated. + +### Ask for Help + +Having your submission flagged may have caught you off guard. If you find yourself intimidated or overwhelmed, let us know. Comment on your pull request, or [reach out to the QMK team on Discord](https://discord.gg/Uq7gcHh). diff --git a/docs/cli.md b/docs/cli.md index 1c09527221..4f328a75a2 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -141,14 +141,28 @@ qmk docs [-p PORT] ## `qmk doctor` -This command examines your environment and alerts you to potential build or flash problems. +This command examines your environment and alerts you to potential build or flash problems. It can fix many of them if you want it to. **Usage**: ``` -qmk doctor +qmk doctor [-y] [-n] ``` +**Examples**: + +Check your environment for problems and prompt to fix them: + + qmk doctor + +Check your environment and automatically fix any problems found: + + qmk doctor -y + +Check your environment and report problems only: + + qmk doctor -n + ## `qmk json-keymap` Creates a keymap.c from a QMK Configurator export. diff --git a/keyboards/handwired/onekey/teensy_32/ld/MK20DX256.ld b/drivers/boards/ld/MK20DX256.ld index 66bc6b81e2..66bc6b81e2 100644 --- a/keyboards/handwired/onekey/teensy_32/ld/MK20DX256.ld +++ b/drivers/boards/ld/MK20DX256.ld diff --git a/keyboards/cannonkeys/ortho48/ld/MKL26Z64.ld b/drivers/boards/ld/MKL26Z64.ld index c4ca8b874c..c4ca8b874c 100644 --- a/keyboards/cannonkeys/ortho48/ld/MKL26Z64.ld +++ b/drivers/boards/ld/MKL26Z64.ld diff --git a/keyboards/cannonkeys/ortho48/ld/STM32F103x8_stm32duino_bootloader.ld b/drivers/boards/ld/STM32F103x8_stm32duino_bootloader.ld index d0688ef601..d0688ef601 100644 --- a/keyboards/cannonkeys/ortho48/ld/STM32F103x8_stm32duino_bootloader.ld +++ b/drivers/boards/ld/STM32F103x8_stm32duino_bootloader.ld diff --git a/keyboards/40percentclub/mf68/keymaps/emdarcher/keymap.c b/keyboards/40percentclub/mf68/keymaps/emdarcher/keymap.c index 546f862a6e..eb281f5f18 100644 --- a/keyboards/40percentclub/mf68/keymaps/emdarcher/keymap.c +++ b/keyboards/40percentclub/mf68/keymaps/emdarcher/keymap.c @@ -48,8 +48,6 @@ void led_set_user(uint8_t usb_led){ } else { //set to Hi-Z setPinInput(B0); - writePinLow(B0); setPinInput(D5); - writePinLow(D5); } } diff --git a/keyboards/atreus62/keymaps/xyverz/keymap.c b/keyboards/atreus62/keymaps/xyverz/keymap.c index 4babed4c11..b852d5d7b9 100644 --- a/keyboards/atreus62/keymaps/xyverz/keymap.c +++ b/keyboards/atreus62/keymaps/xyverz/keymap.c @@ -30,6 +30,7 @@ CHANGELOG: 0.6 - Swapped ESC and GRV in all layers. 0.7 - Brought code up to current standards. 0.8 - Added MACLOCK macro. + 0.9 - Updated code to correspond to new setPinInput behaviour TODO: @@ -124,9 +125,7 @@ void matrix_init_user(void) { #ifdef BOOTLOADER_CATERINA // This will disable the red LEDs on the ProMicros setPinInput(D5); - writePinLow(D5); setPinInput(B0); - writePinLow(B0); #endif }; diff --git a/keyboards/atreus62/keymaps/xyverz/readme.md b/keyboards/atreus62/keymaps/xyverz/readme.md index f91a87da4f..531e3b28d9 100644 --- a/keyboards/atreus62/keymaps/xyverz/readme.md +++ b/keyboards/atreus62/keymaps/xyverz/readme.md @@ -30,6 +30,10 @@ The bottom row is fairly Kinesis-ish since the Contour and Advantage keyboards h ### 0.7 * Brought code up to new standards (as of 27 June 2019). * Updated this readme file. +### 0.8 + * Added MACLOCK macro. +### 0.9 + * Updated code to correspond to new setPinInput behaviour. ### TODO: diff --git a/keyboards/cannonkeys/ortho48/rules.mk b/keyboards/cannonkeys/ortho48/rules.mk index d042d8a82c..b060afd156 100644 --- a/keyboards/cannonkeys/ortho48/rules.mk +++ b/keyboards/cannonkeys/ortho48/rules.mk @@ -22,6 +22,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = yes +BACKLIGHT_DRIVER = custom RGBLIGHT_ENABLE = yes LAYOUTS = ortho_4x12 diff --git a/keyboards/cannonkeys/ortho60/ld/MKL26Z64.ld b/keyboards/cannonkeys/ortho60/ld/MKL26Z64.ld deleted file mode 100644 index c4ca8b874c..0000000000 --- a/keyboards/cannonkeys/ortho60/ld/MKL26Z64.ld +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2013-2016 Fabio Utzig, http://fabioutzig.com - * (C) 2016 flabbergast <s3+flabbergast@sdfeu.org> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* - * KL26Z64 memory setup. - */ -MEMORY -{ - flash0 : org = 0x00000000, len = 0x100 - flash1 : org = 0x00000400, len = 0x10 - flash2 : org = 0x00000410, len = 62k - 0x410 - flash3 : org = 0x0000F800, len = 2k - flash4 : org = 0x00000000, len = 0 - flash5 : org = 0x00000000, len = 0 - flash6 : org = 0x00000000, len = 0 - flash7 : org = 0x00000000, len = 0 - ram0 : org = 0x1FFFF800, len = 8k - ram1 : org = 0x00000000, len = 0 - ram2 : org = 0x00000000, len = 0 - ram3 : org = 0x00000000, len = 0 - ram4 : org = 0x00000000, len = 0 - ram5 : org = 0x00000000, len = 0 - ram6 : org = 0x00000000, len = 0 - ram7 : org = 0x00000000, len = 0 -} - -/* Flash region for the configuration bytes.*/ -SECTIONS -{ - .cfmprotect : ALIGN(4) SUBALIGN(4) - { - KEEP(*(.cfmconfig)) - } > flash1 -} - -/* For each data/text section two region are defined, a virtual region - and a load region (_LMA suffix).*/ - -/* Flash region to be used for exception vectors.*/ -REGION_ALIAS("VECTORS_FLASH", flash0); -REGION_ALIAS("VECTORS_FLASH_LMA", flash0); - -/* Flash region to be used for constructors and destructors.*/ -REGION_ALIAS("XTORS_FLASH", flash2); -REGION_ALIAS("XTORS_FLASH_LMA", flash2); - -/* Flash region to be used for code text.*/ -REGION_ALIAS("TEXT_FLASH", flash2); -REGION_ALIAS("TEXT_FLASH_LMA", flash2); - -/* Flash region to be used for read only data.*/ -REGION_ALIAS("RODATA_FLASH", flash2); -REGION_ALIAS("RODATA_FLASH_LMA", flash2); - -/* Flash region to be used for various.*/ -REGION_ALIAS("VARIOUS_FLASH", flash2); -REGION_ALIAS("VARIOUS_FLASH_LMA", flash2); - -/* Flash region to be used for RAM(n) initialization data.*/ -REGION_ALIAS("RAM_INIT_FLASH_LMA", flash2); - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); -REGION_ALIAS("DATA_RAM_LMA", flash2); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram0); - -__eeprom_workarea_start__ = ORIGIN(flash3); -__eeprom_workarea_size__ = LENGTH(flash3); -__eeprom_workarea_end__ = __eeprom_workarea_start__ + __eeprom_workarea_size__; - -/* Generic rules inclusion.*/ -INCLUDE rules.ld diff --git a/keyboards/cannonkeys/ortho60/ld/STM32F103x8_stm32duino_bootloader.ld b/keyboards/cannonkeys/ortho60/ld/STM32F103x8_stm32duino_bootloader.ld deleted file mode 100644 index d0688ef601..0000000000 --- a/keyboards/cannonkeys/ortho60/ld/STM32F103x8_stm32duino_bootloader.ld +++ /dev/null @@ -1,88 +0,0 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -/* - * ST32F103xB memory setup for use with the maplemini bootloader. - * You will have to - * #define CORTEX_VTOR_INIT 0x5000 - * in your projects chconf.h - */ -MEMORY -{ - flash0 : org = 0x08002000, len = 64k - 0x2000 - flash1 : org = 0x00000000, len = 0 - flash2 : org = 0x00000000, len = 0 - flash3 : org = 0x00000000, len = 0 - flash4 : org = 0x00000000, len = 0 - flash5 : org = 0x00000000, len = 0 - flash6 : org = 0x00000000, len = 0 - flash7 : org = 0x00000000, len = 0 - ram0 : org = 0x20000000, len = 20k - ram1 : org = 0x00000000, len = 0 - ram2 : org = 0x00000000, len = 0 - ram3 : org = 0x00000000, len = 0 - ram4 : org = 0x00000000, len = 0 - ram5 : org = 0x00000000, len = 0 - ram6 : org = 0x00000000, len = 0 - ram7 : org = 0x00000000, len = 0 -} - -/* For each data/text section two region are defined, a virtual region - and a load region (_LMA suffix).*/ - -/* Flash region to be used for exception vectors.*/ -REGION_ALIAS("VECTORS_FLASH", flash0); -REGION_ALIAS("VECTORS_FLASH_LMA", flash0); - -/* Flash region to be used for constructors and destructors.*/ -REGION_ALIAS("XTORS_FLASH", flash0); -REGION_ALIAS("XTORS_FLASH_LMA", flash0); - -/* Flash region to be used for code text.*/ -REGION_ALIAS("TEXT_FLASH", flash0); -REGION_ALIAS("TEXT_FLASH_LMA", flash0); - -/* Flash region to be used for read only data.*/ -REGION_ALIAS("RODATA_FLASH", flash0); -REGION_ALIAS("RODATA_FLASH_LMA", flash0); - -/* Flash region to be used for various.*/ -REGION_ALIAS("VARIOUS_FLASH", flash0); -REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); - -/* Flash region to be used for RAM(n) initialization data.*/ -REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); -REGION_ALIAS("DATA_RAM_LMA", flash0); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram0); - -/* Generic rules inclusion.*/ -INCLUDE rules.ld diff --git a/keyboards/cannonkeys/ortho60/rules.mk b/keyboards/cannonkeys/ortho60/rules.mk index 997b6af6ed..1d3f1afa9c 100644 --- a/keyboards/cannonkeys/ortho60/rules.mk +++ b/keyboards/cannonkeys/ortho60/rules.mk @@ -22,6 +22,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = yes +BACKLIGHT_DRIVER = custom RGBLIGHT_ENABLE = yes LAYOUTS = ortho_5x12 diff --git a/keyboards/cannonkeys/ortho75/ld/STM32F103x8_stm32duino_bootloader.ld b/keyboards/cannonkeys/ortho75/ld/STM32F103x8_stm32duino_bootloader.ld deleted file mode 100644 index d0688ef601..0000000000 --- a/keyboards/cannonkeys/ortho75/ld/STM32F103x8_stm32duino_bootloader.ld +++ /dev/null @@ -1,88 +0,0 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -/* - * ST32F103xB memory setup for use with the maplemini bootloader. - * You will have to - * #define CORTEX_VTOR_INIT 0x5000 - * in your projects chconf.h - */ -MEMORY -{ - flash0 : org = 0x08002000, len = 64k - 0x2000 - flash1 : org = 0x00000000, len = 0 - flash2 : org = 0x00000000, len = 0 - flash3 : org = 0x00000000, len = 0 - flash4 : org = 0x00000000, len = 0 - flash5 : org = 0x00000000, len = 0 - flash6 : org = 0x00000000, len = 0 - flash7 : org = 0x00000000, len = 0 - ram0 : org = 0x20000000, len = 20k - ram1 : org = 0x00000000, len = 0 - ram2 : org = 0x00000000, len = 0 - ram3 : org = 0x00000000, len = 0 - ram4 : org = 0x00000000, len = 0 - ram5 : org = 0x00000000, len = 0 - ram6 : org = 0x00000000, len = 0 - ram7 : org = 0x00000000, len = 0 -} - -/* For each data/text section two region are defined, a virtual region - and a load region (_LMA suffix).*/ - -/* Flash region to be used for exception vectors.*/ -REGION_ALIAS("VECTORS_FLASH", flash0); -REGION_ALIAS("VECTORS_FLASH_LMA", flash0); - -/* Flash region to be used for constructors and destructors.*/ -REGION_ALIAS("XTORS_FLASH", flash0); -REGION_ALIAS("XTORS_FLASH_LMA", flash0); - -/* Flash region to be used for code text.*/ -REGION_ALIAS("TEXT_FLASH", flash0); -REGION_ALIAS("TEXT_FLASH_LMA", flash0); - -/* Flash region to be used for read only data.*/ -REGION_ALIAS("RODATA_FLASH", flash0); -REGION_ALIAS("RODATA_FLASH_LMA", flash0); - -/* Flash region to be used for various.*/ -REGION_ALIAS("VARIOUS_FLASH", flash0); -REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); - -/* Flash region to be used for RAM(n) initialization data.*/ -REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); -REGION_ALIAS("DATA_RAM_LMA", flash0); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram0); - -/* Generic rules inclusion.*/ -INCLUDE rules.ld diff --git a/keyboards/cannonkeys/ortho75/rules.mk b/keyboards/cannonkeys/ortho75/rules.mk index d0512a49b7..538ab6aec5 100644 --- a/keyboards/cannonkeys/ortho75/rules.mk +++ b/keyboards/cannonkeys/ortho75/rules.mk @@ -22,6 +22,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = yes +BACKLIGHT_DRIVER = custom RGBLIGHT_ENABLE = yes ENCODER_ENABLE = yes diff --git a/keyboards/cannonkeys/practice60/ld/MKL26Z64.ld b/keyboards/cannonkeys/practice60/ld/MKL26Z64.ld deleted file mode 100644 index c4ca8b874c..0000000000 --- a/keyboards/cannonkeys/practice60/ld/MKL26Z64.ld +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2013-2016 Fabio Utzig, http://fabioutzig.com - * (C) 2016 flabbergast <s3+flabbergast@sdfeu.org> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* - * KL26Z64 memory setup. - */ -MEMORY -{ - flash0 : org = 0x00000000, len = 0x100 - flash1 : org = 0x00000400, len = 0x10 - flash2 : org = 0x00000410, len = 62k - 0x410 - flash3 : org = 0x0000F800, len = 2k - flash4 : org = 0x00000000, len = 0 - flash5 : org = 0x00000000, len = 0 - flash6 : org = 0x00000000, len = 0 - flash7 : org = 0x00000000, len = 0 - ram0 : org = 0x1FFFF800, len = 8k - ram1 : org = 0x00000000, len = 0 - ram2 : org = 0x00000000, len = 0 - ram3 : org = 0x00000000, len = 0 - ram4 : org = 0x00000000, len = 0 - ram5 : org = 0x00000000, len = 0 - ram6 : org = 0x00000000, len = 0 - ram7 : org = 0x00000000, len = 0 -} - -/* Flash region for the configuration bytes.*/ -SECTIONS -{ - .cfmprotect : ALIGN(4) SUBALIGN(4) - { - KEEP(*(.cfmconfig)) - } > flash1 -} - -/* For each data/text section two region are defined, a virtual region - and a load region (_LMA suffix).*/ - -/* Flash region to be used for exception vectors.*/ -REGION_ALIAS("VECTORS_FLASH", flash0); -REGION_ALIAS("VECTORS_FLASH_LMA", flash0); - -/* Flash region to be used for constructors and destructors.*/ -REGION_ALIAS("XTORS_FLASH", flash2); -REGION_ALIAS("XTORS_FLASH_LMA", flash2); - -/* Flash region to be used for code text.*/ -REGION_ALIAS("TEXT_FLASH", flash2); -REGION_ALIAS("TEXT_FLASH_LMA", flash2); - -/* Flash region to be used for read only data.*/ -REGION_ALIAS("RODATA_FLASH", flash2); -REGION_ALIAS("RODATA_FLASH_LMA", flash2); - -/* Flash region to be used for various.*/ -REGION_ALIAS("VARIOUS_FLASH", flash2); -REGION_ALIAS("VARIOUS_FLASH_LMA", flash2); - -/* Flash region to be used for RAM(n) initialization data.*/ -REGION_ALIAS("RAM_INIT_FLASH_LMA", flash2); - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); -REGION_ALIAS("DATA_RAM_LMA", flash2); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram0); - -__eeprom_workarea_start__ = ORIGIN(flash3); -__eeprom_workarea_size__ = LENGTH(flash3); -__eeprom_workarea_end__ = __eeprom_workarea_start__ + __eeprom_workarea_size__; - -/* Generic rules inclusion.*/ -INCLUDE rules.ld diff --git a/keyboards/cannonkeys/practice60/ld/STM32F103x8_stm32duino_bootloader.ld b/keyboards/cannonkeys/practice60/ld/STM32F103x8_stm32duino_bootloader.ld deleted file mode 100644 index d0688ef601..0000000000 --- a/keyboards/cannonkeys/practice60/ld/STM32F103x8_stm32duino_bootloader.ld +++ /dev/null @@ -1,88 +0,0 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -/* - * ST32F103xB memory setup for use with the maplemini bootloader. - * You will have to - * #define CORTEX_VTOR_INIT 0x5000 - * in your projects chconf.h - */ -MEMORY -{ - flash0 : org = 0x08002000, len = 64k - 0x2000 - flash1 : org = 0x00000000, len = 0 - flash2 : org = 0x00000000, len = 0 - flash3 : org = 0x00000000, len = 0 - flash4 : org = 0x00000000, len = 0 - flash5 : org = 0x00000000, len = 0 - flash6 : org = 0x00000000, len = 0 - flash7 : org = 0x00000000, len = 0 - ram0 : org = 0x20000000, len = 20k - ram1 : org = 0x00000000, len = 0 - ram2 : org = 0x00000000, len = 0 - ram3 : org = 0x00000000, len = 0 - ram4 : org = 0x00000000, len = 0 - ram5 : org = 0x00000000, len = 0 - ram6 : org = 0x00000000, len = 0 - ram7 : org = 0x00000000, len = 0 -} - -/* For each data/text section two region are defined, a virtual region - and a load region (_LMA suffix).*/ - -/* Flash region to be used for exception vectors.*/ -REGION_ALIAS("VECTORS_FLASH", flash0); -REGION_ALIAS("VECTORS_FLASH_LMA", flash0); - -/* Flash region to be used for constructors and destructors.*/ -REGION_ALIAS("XTORS_FLASH", flash0); -REGION_ALIAS("XTORS_FLASH_LMA", flash0); - -/* Flash region to be used for code text.*/ -REGION_ALIAS("TEXT_FLASH", flash0); -REGION_ALIAS("TEXT_FLASH_LMA", flash0); - -/* Flash region to be used for read only data.*/ -REGION_ALIAS("RODATA_FLASH", flash0); -REGION_ALIAS("RODATA_FLASH_LMA", flash0); - -/* Flash region to be used for various.*/ -REGION_ALIAS("VARIOUS_FLASH", flash0); -REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); - -/* Flash region to be used for RAM(n) initialization data.*/ -REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); -REGION_ALIAS("DATA_RAM_LMA", flash0); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram0); - -/* Generic rules inclusion.*/ -INCLUDE rules.ld diff --git a/keyboards/cannonkeys/practice60/rules.mk b/keyboards/cannonkeys/practice60/rules.mk index 81dc1e9dd8..a1c34a3ade 100644 --- a/keyboards/cannonkeys/practice60/rules.mk +++ b/keyboards/cannonkeys/practice60/rules.mk @@ -22,6 +22,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = yes +BACKLIGHT_DRIVER = custom RGBLIGHT_ENABLE = yes LAYOUTS = 60_ansi diff --git a/keyboards/cannonkeys/practice65/ld/MKL26Z64.ld b/keyboards/cannonkeys/practice65/ld/MKL26Z64.ld deleted file mode 100644 index c4ca8b874c..0000000000 --- a/keyboards/cannonkeys/practice65/ld/MKL26Z64.ld +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2013-2016 Fabio Utzig, http://fabioutzig.com - * (C) 2016 flabbergast <s3+flabbergast@sdfeu.org> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* - * KL26Z64 memory setup. - */ -MEMORY -{ - flash0 : org = 0x00000000, len = 0x100 - flash1 : org = 0x00000400, len = 0x10 - flash2 : org = 0x00000410, len = 62k - 0x410 - flash3 : org = 0x0000F800, len = 2k - flash4 : org = 0x00000000, len = 0 - flash5 : org = 0x00000000, len = 0 - flash6 : org = 0x00000000, len = 0 - flash7 : org = 0x00000000, len = 0 - ram0 : org = 0x1FFFF800, len = 8k - ram1 : org = 0x00000000, len = 0 - ram2 : org = 0x00000000, len = 0 - ram3 : org = 0x00000000, len = 0 - ram4 : org = 0x00000000, len = 0 - ram5 : org = 0x00000000, len = 0 - ram6 : org = 0x00000000, len = 0 - ram7 : org = 0x00000000, len = 0 -} - -/* Flash region for the configuration bytes.*/ -SECTIONS -{ - .cfmprotect : ALIGN(4) SUBALIGN(4) - { - KEEP(*(.cfmconfig)) - } > flash1 -} - -/* For each data/text section two region are defined, a virtual region - and a load region (_LMA suffix).*/ - -/* Flash region to be used for exception vectors.*/ -REGION_ALIAS("VECTORS_FLASH", flash0); -REGION_ALIAS("VECTORS_FLASH_LMA", flash0); - -/* Flash region to be used for constructors and destructors.*/ -REGION_ALIAS("XTORS_FLASH", flash2); -REGION_ALIAS("XTORS_FLASH_LMA", flash2); - -/* Flash region to be used for code text.*/ -REGION_ALIAS("TEXT_FLASH", flash2); -REGION_ALIAS("TEXT_FLASH_LMA", flash2); - -/* Flash region to be used for read only data.*/ -REGION_ALIAS("RODATA_FLASH", flash2); -REGION_ALIAS("RODATA_FLASH_LMA", flash2); - -/* Flash region to be used for various.*/ -REGION_ALIAS("VARIOUS_FLASH", flash2); -REGION_ALIAS("VARIOUS_FLASH_LMA", flash2); - -/* Flash region to be used for RAM(n) initialization data.*/ -REGION_ALIAS("RAM_INIT_FLASH_LMA", flash2); - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); -REGION_ALIAS("DATA_RAM_LMA", flash2); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram0); - -__eeprom_workarea_start__ = ORIGIN(flash3); -__eeprom_workarea_size__ = LENGTH(flash3); -__eeprom_workarea_end__ = __eeprom_workarea_start__ + __eeprom_workarea_size__; - -/* Generic rules inclusion.*/ -INCLUDE rules.ld diff --git a/keyboards/cannonkeys/practice65/ld/STM32F103x8_stm32duino_bootloader.ld b/keyboards/cannonkeys/practice65/ld/STM32F103x8_stm32duino_bootloader.ld deleted file mode 100644 index d0688ef601..0000000000 --- a/keyboards/cannonkeys/practice65/ld/STM32F103x8_stm32duino_bootloader.ld +++ /dev/null @@ -1,88 +0,0 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -/* - * ST32F103xB memory setup for use with the maplemini bootloader. - * You will have to - * #define CORTEX_VTOR_INIT 0x5000 - * in your projects chconf.h - */ -MEMORY -{ - flash0 : org = 0x08002000, len = 64k - 0x2000 - flash1 : org = 0x00000000, len = 0 - flash2 : org = 0x00000000, len = 0 - flash3 : org = 0x00000000, len = 0 - flash4 : org = 0x00000000, len = 0 - flash5 : org = 0x00000000, len = 0 - flash6 : org = 0x00000000, len = 0 - flash7 : org = 0x00000000, len = 0 - ram0 : org = 0x20000000, len = 20k - ram1 : org = 0x00000000, len = 0 - ram2 : org = 0x00000000, len = 0 - ram3 : org = 0x00000000, len = 0 - ram4 : org = 0x00000000, len = 0 - ram5 : org = 0x00000000, len = 0 - ram6 : org = 0x00000000, len = 0 - ram7 : org = 0x00000000, len = 0 -} - -/* For each data/text section two region are defined, a virtual region - and a load region (_LMA suffix).*/ - -/* Flash region to be used for exception vectors.*/ -REGION_ALIAS("VECTORS_FLASH", flash0); -REGION_ALIAS("VECTORS_FLASH_LMA", flash0); - -/* Flash region to be used for constructors and destructors.*/ -REGION_ALIAS("XTORS_FLASH", flash0); -REGION_ALIAS("XTORS_FLASH_LMA", flash0); - -/* Flash region to be used for code text.*/ -REGION_ALIAS("TEXT_FLASH", flash0); -REGION_ALIAS("TEXT_FLASH_LMA", flash0); - -/* Flash region to be used for read only data.*/ -REGION_ALIAS("RODATA_FLASH", flash0); -REGION_ALIAS("RODATA_FLASH_LMA", flash0); - -/* Flash region to be used for various.*/ -REGION_ALIAS("VARIOUS_FLASH", flash0); -REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); - -/* Flash region to be used for RAM(n) initialization data.*/ -REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); -REGION_ALIAS("DATA_RAM_LMA", flash0); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram0); - -/* Generic rules inclusion.*/ -INCLUDE rules.ld diff --git a/keyboards/cannonkeys/practice65/rules.mk b/keyboards/cannonkeys/practice65/rules.mk index c927a486b7..1e8d56bca5 100644 --- a/keyboards/cannonkeys/practice65/rules.mk +++ b/keyboards/cannonkeys/practice65/rules.mk @@ -22,4 +22,5 @@ COMMAND_ENABLE = yes # Commands for debug and configuration SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover BACKLIGHT_ENABLE = yes +BACKLIGHT_DRIVER = custom RGBLIGHT_ENABLE = yes diff --git a/keyboards/clueboard/66/rev4/config.h b/keyboards/clueboard/66/rev4/config.h index f81ae61cf8..8ed1404783 100644 --- a/keyboards/clueboard/66/rev4/config.h +++ b/keyboards/clueboard/66/rev4/config.h @@ -54,3 +54,25 @@ //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION + + /* Backlight configuration + */ +#define BACKLIGHT_LEVELS 1 + +/* Underlight configuration + */ +#define RGB_DI_PIN D7 +#define RGBLED_NUM 18 // Number of LEDs +#define RGBLIGHT_HUE_STEP 32 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 + +#define RGBLIGHT_ANIMATIONS +#define RGBLIGHT_EFFECT_BREATHE_CENTER 1 +#define RGBLIGHT_EFFECT_BREATHE_MAX 200 +#define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 666*2 +#define RGBLIGHT_EFFECT_CHRISTMAS_STEP 1 +#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3 // How many LEDs wide to light up +#define RGBLIGHT_EFFECT_KNIGHT_OFFSET 2 // The led to start at +#define RGBLIGHT_EFFECT_KNIGHT_LED_NUM 5 // How many LEDs to travel +#define RGBLIGHT_EFFECT_SNAKE_LENGTH 4 // How many LEDs wide to light up diff --git a/keyboards/clueboard/66/rev4/rev4.c b/keyboards/clueboard/66/rev4/rev4.c index 99a7cb9452..041c31cd32 100644 --- a/keyboards/clueboard/66/rev4/rev4.c +++ b/keyboards/clueboard/66/rev4/rev4.c @@ -1,4 +1,5 @@ #include "rev4.h" +//#include "backlight.h" void matrix_init_kb(void) { // put your keyboard start-up code here @@ -7,19 +8,49 @@ void matrix_init_kb(void) { led_init_ports(); } -void led_init_ports() { +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +void backlight_init_ports(void) { + print("init_backlight_pin()\n"); // Set our LED pins as output - setPinOutput(B13); // LED1 - writePinLow(B13); + //DDRD |= (1<<6); // Esc + //DDRB |= (1<<7); // Page Up + //DDRD |= (1<<4); // Arrows - setPinOutput(B14); // LED2 - writePinLow(B14); + // Set our LED pins low + //PORTD &= ~(1<<6); // Esc + //PORTB &= ~(1<<7); // Page Up + //PORTD &= ~(1<<4); // Arrows +} - setPinOutput(B8); // LED3 - writePinLow(B8); +void backlight_set(uint8_t level) { +/* + if ( level == 0 ) { + // Turn off light + PORTD |= (1<<6); // Esc + PORTB |= (1<<7); // Page Up + PORTD |= (1<<4); // Arrows + } else { + // Turn on light + PORTD &= ~(1<<6); // Esc + PORTB &= ~(1<<7); // Page Up + PORTD &= ~(1<<4); // Arrows + } +*/ +} - setPinOutput(B0); // Capslock LED - writePinLow(B0); +void led_init_ports() { + // Set our LED pins as output + palSetPadMode(GPIOB, 13, PAL_MODE_OUTPUT_PUSHPULL); // LED1 + palClearPad(GPIOB, 13); + palSetPadMode(GPIOB, 14, PAL_MODE_OUTPUT_PUSHPULL); // LED2 + palClearPad(GPIOB, 14); + palSetPadMode(GPIOA, 8, PAL_MODE_OUTPUT_PUSHPULL); // LED3 + palClearPad(GPIOA, 8); + palSetPadMode(GPIOA, 0, PAL_MODE_OUTPUT_PUSHPULL); // Capslock LED + palClearPad(GPIOA, 0); } void led_set_kb(uint8_t usb_led) { diff --git a/keyboards/clueboard/66/rev4/rules.mk b/keyboards/clueboard/66/rev4/rules.mk index 70a63941b0..ef7989aa0b 100644 --- a/keyboards/clueboard/66/rev4/rules.mk +++ b/keyboards/clueboard/66/rev4/rules.mk @@ -4,17 +4,18 @@ MCU = STM32F303 # Build Options # comment out to disable the options. # -BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = yes # Console for debug -COMMAND_ENABLE = yes # Commands for debug and configuration +BACKLIGHT_ENABLE = yes +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work -AUDIO_ENABLE = yes +AUDIO_ENABLE = no RGBLIGHT_ENABLE = no # Enable keyboard underlight functionality -BACKLIGHT_ENABLE = no MIDI_ENABLE = no # MIDI controls UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = yes LAYOUTS = 66_ansi 66_iso diff --git a/keyboards/clueboard/66_hotswap/gen1/led.c b/keyboards/clueboard/66_hotswap/gen1/led.c index efbf532022..f67259d2e4 100644 --- a/keyboards/clueboard/66_hotswap/gen1/led.c +++ b/keyboards/clueboard/66_hotswap/gen1/led.c @@ -16,6 +16,5 @@ */ #include "hal.h" -#include "backlight.h" #include "led.h" #include "printf.h" diff --git a/keyboards/clueboard/66_hotswap/gen1/matrix.c b/keyboards/clueboard/66_hotswap/gen1/matrix.c index c3e59b5646..05386215ed 100644 --- a/keyboards/clueboard/66_hotswap/gen1/matrix.c +++ b/keyboards/clueboard/66_hotswap/gen1/matrix.c @@ -5,7 +5,6 @@ #include "timer.h" #include "wait.h" #include "printf.h" -#include "backlight.h" #include "matrix.h" #include "action.h" #include "keycode.h" diff --git a/keyboards/clueboard/66_hotswap/gen1/rules.mk b/keyboards/clueboard/66_hotswap/gen1/rules.mk index 50f140defa..1de003ce5a 100644 --- a/keyboards/clueboard/66_hotswap/gen1/rules.mk +++ b/keyboards/clueboard/66_hotswap/gen1/rules.mk @@ -7,7 +7,6 @@ LED_MATRIX_ENABLE = IS31FL3731 # Build Options # comment out to disable the options. # -BACKLIGHT_ENABLE = yes BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration ## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) MOUSEKEY_ENABLE = yes # Mouse keys diff --git a/keyboards/converter/siemens_tastatur/ld/MKL26Z64.ld b/keyboards/converter/siemens_tastatur/ld/MKL26Z64.ld deleted file mode 100644 index c4ca8b874c..0000000000 --- a/keyboards/converter/siemens_tastatur/ld/MKL26Z64.ld +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2013-2016 Fabio Utzig, http://fabioutzig.com - * (C) 2016 flabbergast <s3+flabbergast@sdfeu.org> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* - * KL26Z64 memory setup. - */ -MEMORY -{ - flash0 : org = 0x00000000, len = 0x100 - flash1 : org = 0x00000400, len = 0x10 - flash2 : org = 0x00000410, len = 62k - 0x410 - flash3 : org = 0x0000F800, len = 2k - flash4 : org = 0x00000000, len = 0 - flash5 : org = 0x00000000, len = 0 - flash6 : org = 0x00000000, len = 0 - flash7 : org = 0x00000000, len = 0 - ram0 : org = 0x1FFFF800, len = 8k - ram1 : org = 0x00000000, len = 0 - ram2 : org = 0x00000000, len = 0 - ram3 : org = 0x00000000, len = 0 - ram4 : org = 0x00000000, len = 0 - ram5 : org = 0x00000000, len = 0 - ram6 : org = 0x00000000, len = 0 - ram7 : org = 0x00000000, len = 0 -} - -/* Flash region for the configuration bytes.*/ -SECTIONS -{ - .cfmprotect : ALIGN(4) SUBALIGN(4) - { - KEEP(*(.cfmconfig)) - } > flash1 -} - -/* For each data/text section two region are defined, a virtual region - and a load region (_LMA suffix).*/ - -/* Flash region to be used for exception vectors.*/ -REGION_ALIAS("VECTORS_FLASH", flash0); -REGION_ALIAS("VECTORS_FLASH_LMA", flash0); - -/* Flash region to be used for constructors and destructors.*/ -REGION_ALIAS("XTORS_FLASH", flash2); -REGION_ALIAS("XTORS_FLASH_LMA", flash2); - -/* Flash region to be used for code text.*/ -REGION_ALIAS("TEXT_FLASH", flash2); -REGION_ALIAS("TEXT_FLASH_LMA", flash2); - -/* Flash region to be used for read only data.*/ -REGION_ALIAS("RODATA_FLASH", flash2); -REGION_ALIAS("RODATA_FLASH_LMA", flash2); - -/* Flash region to be used for various.*/ -REGION_ALIAS("VARIOUS_FLASH", flash2); -REGION_ALIAS("VARIOUS_FLASH_LMA", flash2); - -/* Flash region to be used for RAM(n) initialization data.*/ -REGION_ALIAS("RAM_INIT_FLASH_LMA", flash2); - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); -REGION_ALIAS("DATA_RAM_LMA", flash2); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram0); - -__eeprom_workarea_start__ = ORIGIN(flash3); -__eeprom_workarea_size__ = LENGTH(flash3); -__eeprom_workarea_end__ = __eeprom_workarea_start__ + __eeprom_workarea_size__; - -/* Generic rules inclusion.*/ -INCLUDE rules.ld diff --git a/keyboards/converter/siemens_tastatur/ld/STM32F103x8_stm32duino_bootloader.ld b/keyboards/converter/siemens_tastatur/ld/STM32F103x8_stm32duino_bootloader.ld deleted file mode 100644 index d0688ef601..0000000000 --- a/keyboards/converter/siemens_tastatur/ld/STM32F103x8_stm32duino_bootloader.ld +++ /dev/null @@ -1,88 +0,0 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -/* - * ST32F103xB memory setup for use with the maplemini bootloader. - * You will have to - * #define CORTEX_VTOR_INIT 0x5000 - * in your projects chconf.h - */ -MEMORY -{ - flash0 : org = 0x08002000, len = 64k - 0x2000 - flash1 : org = 0x00000000, len = 0 - flash2 : org = 0x00000000, len = 0 - flash3 : org = 0x00000000, len = 0 - flash4 : org = 0x00000000, len = 0 - flash5 : org = 0x00000000, len = 0 - flash6 : org = 0x00000000, len = 0 - flash7 : org = 0x00000000, len = 0 - ram0 : org = 0x20000000, len = 20k - ram1 : org = 0x00000000, len = 0 - ram2 : org = 0x00000000, len = 0 - ram3 : org = 0x00000000, len = 0 - ram4 : org = 0x00000000, len = 0 - ram5 : org = 0x00000000, len = 0 - ram6 : org = 0x00000000, len = 0 - ram7 : org = 0x00000000, len = 0 -} - -/* For each data/text section two region are defined, a virtual region - and a load region (_LMA suffix).*/ - -/* Flash region to be used for exception vectors.*/ -REGION_ALIAS("VECTORS_FLASH", flash0); -REGION_ALIAS("VECTORS_FLASH_LMA", flash0); - -/* Flash region to be used for constructors and destructors.*/ -REGION_ALIAS("XTORS_FLASH", flash0); -REGION_ALIAS("XTORS_FLASH_LMA", flash0); - -/* Flash region to be used for code text.*/ -REGION_ALIAS("TEXT_FLASH", flash0); -REGION_ALIAS("TEXT_FLASH_LMA", flash0); - -/* Flash region to be used for read only data.*/ -REGION_ALIAS("RODATA_FLASH", flash0); -REGION_ALIAS("RODATA_FLASH_LMA", flash0); - -/* Flash region to be used for various.*/ -REGION_ALIAS("VARIOUS_FLASH", flash0); -REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); - -/* Flash region to be used for RAM(n) initialization data.*/ -REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); -REGION_ALIAS("DATA_RAM_LMA", flash0); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram0); - -/* Generic rules inclusion.*/ -INCLUDE rules.ld diff --git a/keyboards/crkbd/keymaps/kidbrazil/config.h b/keyboards/crkbd/keymaps/kidbrazil/config.h index dd3f1a0307..6dc468c590 100644 --- a/keyboards/crkbd/keymaps/kidbrazil/config.h +++ b/keyboards/crkbd/keymaps/kidbrazil/config.h @@ -52,49 +52,64 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #endif #ifdef RGB_MATRIX_ENABLE -//# define RGB_MATRIX_KEYPRESSES // reacts to keypresses -// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses) -// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects -# define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended -# define RGB_MATRIX_FRAMEBUFFER_EFFECTS -// # define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness) -// # define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness) -# define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 // limits maximum brightness of LEDs to 150 out of 255. Higher may cause the controller to crash. -# define RGB_MATRIX_HUE_STEP 8 -# define RGB_MATRIX_SAT_STEP 8 -# define RGB_MATRIX_VAL_STEP 8 -# define RGB_MATRIX_SPD_STEP 10 + //# define RGB_MATRIX_KEYPRESSES // reacts to keypresses + // # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses) + // # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects + #define RGB_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended + #define RGB_MATRIX_FRAMEBUFFER_EFFECTS + // # define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness) + // # define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness) + #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 // limits maximum brightness of LEDs to 150 out of 255. Higher may cause the controller to crash. + #define RGB_MATRIX_HUE_STEP 4 + #define RGB_MATRIX_SAT_STEP 4 + #define RGB_MATRIX_VAL_STEP 4 + #define RGB_MATRIX_SPD_STEP 10 -/* Disable the animations you don't want/need. You will need to disable a good number of these * - * because they take up a lot of space. Disable until you can successfully compile your firmware. */ -# define DISABLE_RGB_MATRIX_ALPHAS_MODS -# define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN -// # define DISABLE_RGB_MATRIX_BREATHING -# define DISABLE_RGB_MATRIX_CYCLE_ALL -# define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -# define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN -# define DISABLE_RGB_MATRIX_CYCLE_OUT_IN -# define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL -# define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON -# define DISABLE_RGB_MATRIX_DUAL_BEACON -# define DISABLE_RGB_MATRIX_RAINBOW_BEACON -# define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS -# define DISABLE_RGB_MATRIX_RAINDROPS -# define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -# define DISABLE_RGB_MATRIX_TYPING_HEATMAP -# define DISABLE_RGB_MATRIX_DIGITAL_RAIN -# define DISABLE_RGB_MATRIX_SOLID_REACTIVE -# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE -# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE -# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -# define DISABLE_RGB_MATRIX_SPLASH -# define DISABLE_RGB_MATRIX_MULTISPLASH -# define DISABLE_RGB_MATRIX_SOLID_SPLASH -# define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH + /* Disable the animations you don't want/need. You will need to disable a good number of these * + * because they take up a lot of space. Disable until you can successfully compile your firmware. */ + #define DISABLE_RGB_MATRIX_ALPHAS_MODS + #define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN + #define DISABLE_RGB_MATRIX_BREATHING + #define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT + #define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL + #define DISABLE_RGB_MATRIX_BAND_SAT + #define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT + #define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL + #define DISABLE_RGB_MATRIX_BAND_VAL + #define DISABLE_RGB_MATRIX_CYCLE_ALL + #define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT + #define DISABLE_RGB_MATRIX_CYCLE_OUT_IN + #define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL + #define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL + #define DISABLE_RGB_MATRIX_CYCLE_SPIRAL + #define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN + #define DISABLE_RGB_MATRIX_DUAL_BEACON + #define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS + #define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON + #define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS + #define DISABLE_RGB_MATRIX_SOLID_REACTIVE + #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS + #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS + #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS + #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS + #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS + #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS + #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS + #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS + #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE + #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE + #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE + #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE + #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE + #define DISABLE_RGB_MATRIX_SOLID_SPLASH + #define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH + #define DISABLE_RGB_MATRIX_SOLID_SPLASH + #define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH + #define DISABLE_RGB_MATRIX_SPLASH + #define DISABLE_RGB_MATRIX_MULTISPLASH + #define DISABLE_RGB_MATRIX_SPLASH + #define DISABLE_RGB_MATRIX_MULTISPLASH #endif +// Custom Font path #define OLED_FONT_H "keyboards/crkbd/keymaps/kidbrazil/glcdfont.c" #define OLED_DISABLE_TIMEOUT diff --git a/keyboards/crkbd/keymaps/kidbrazil/enums.h b/keyboards/crkbd/keymaps/kidbrazil/enums.h new file mode 100644 index 0000000000..ec1a67925f --- /dev/null +++ b/keyboards/crkbd/keymaps/kidbrazil/enums.h @@ -0,0 +1,10 @@ +// [CRKBD layers Init] -------------------------------------------------------// +typedef enum { + _QWERTY, + _NUM, + _SYM, + _GAME, + _WEAPON +}CRKBD_LAYERS; + +extern enum CRKBD_LAYERS crkbd_layers; diff --git a/keyboards/crkbd/keymaps/kidbrazil/keymap.c b/keyboards/crkbd/keymaps/kidbrazil/keymap.c index 44142d4f2f..9c950e5373 100644 --- a/keyboards/crkbd/keymaps/kidbrazil/keymap.c +++ b/keyboards/crkbd/keymaps/kidbrazil/keymap.c @@ -1,4 +1,6 @@ #include QMK_KEYBOARD_H +#include "enums.h" +#include "layer.h" // [Init Variables] ----------------------------------------------------------// extern uint8_t is_master; @@ -9,15 +11,6 @@ bool user_led_enabled = true; // Boolean to store the master LED clear so it only runs once. bool master_oled_cleared = false; -// [CRKBD layers Init] -------------------------------------------------------// -enum crkbd_layers { - _QWERTY, - _NUM, - _SYM, - _GAME, - _WEAPON -}; - // [Keymaps] -----------------------------------------------------------------// const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_QWERTY] = LAYOUT( @@ -36,8 +29,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_SYM] = LAYOUT( KC_ESC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, - LSFT_T(KC_TAB), RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV, - KC_LCTL, RGB_VAD, RGB_RMOD, RGB_HUD, RGB_SAD, TG(_GAME), KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS, KC_TILD, + LSFT_T(KC_TAB), RGB_TOG, KC_MPLY, KC_MUTE, KC_VOLU, KC_VOLD, KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV, + KC_LCTL, KC_CALC, KC_MYCM, KC_MPRV, KC_MNXT, TG(_GAME), KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS, KC_TILD, LGUI_T(KC_PGUP), KC_TRNS, KC_SPC, KC_ENT, KC_TRNS, LALT_T(KC_PGDN) ), @@ -51,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_WEAPON] = LAYOUT( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_6, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_7, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_7, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, EEP_RST, KC_TRNS, KC_TAB, KC_TRNS, KC_SPC, KC_TRNS, KC_TRNS, KC_TRNS ) }; @@ -61,23 +54,24 @@ void keyboard_post_init_user(void) { // Set RGB to known state rgb_matrix_enable_noeeprom(); rgb_matrix_set_color_all(RGB_GREEN); + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); user_led_enabled = true; - } // [Process User Input] ------------------------------------------------------// bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { + // Handle RGB Changes sans eeprom - necessary due to the layer dependent RGB color + // changes in marrix_scan_user case RGB_TOG: - if (record->event.pressed) { - // Toggle matrix on key press - user_led_enabled ? rgb_matrix_disable_noeeprom() : rgb_matrix_enable_noeeprom(); - } else { - // Flip User_led_enabled variable on key release - user_led_enabled = !user_led_enabled; - } - return false; // Skip all further processing of this key + if (record->event.pressed) { + // Toggle matrix on key press + user_led_enabled ? rgb_matrix_disable_noeeprom() : rgb_matrix_enable_noeeprom(); + // Toggle boolean flag + user_led_enabled = !user_led_enabled; + } + return false; default: - // Use process_record_keymap to reset timer on all other keypresses + // Use process_record_keymap to reset timer on all other keypresses to awaken from idle. if (record->event.pressed) { #ifdef OLED_DRIVER_ENABLE oled_timer = timer_read32(); @@ -91,9 +85,47 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } +// [Matrix Scan] ------------------------------------------------------------// +void matrix_scan_user(void) { + // Iddle timer to return to default layer if left on game layer + if (timer_elapsed32(oled_timer) > 380000 && timer_elapsed32(oled_timer) < 479999) { + // Reset layer in case it got left on _GAME + // This prevents the issue where the master side sometimes wont switch off as expected + // in the next step. + if (get_highest_layer(layer_state) == _GAME) { + layer_off(_GAME); + layer_on(_QWERTY); + } + return; + } + // Timeout to turn off LEDs + else if (timer_elapsed32(oled_timer) > 480000) { + rgb_matrix_disable_noeeprom(); + return; + } + // Set RGB Matrix color based on layers + if (user_led_enabled) { + switch (get_highest_layer(layer_state)){ + case _GAME: + rgb_matrix_set_color_all(RGB_PURPLE); + break; + case _NUM: + case _SYM: + case _QWERTY: + rgb_matrix_set_color_all(RGB_GREEN); + break; + default: + rgb_matrix_set_color_all(RGB_GREEN); + break; + + } + } else { + rgb_matrix_disable_noeeprom(); + return; + } +} // [OLED Configuration] ------------------------------------------------------// #ifdef OLED_DRIVER_ENABLE - // Init Oled and Rotate.... oled_rotation_t oled_init_user(oled_rotation_t rotation) { if (!has_usb()) @@ -105,74 +137,6 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) { const char *read_logo(void); // {OLED helpers} -----------------------------------------------// - -// Render Blank Space -void render_space(void) { - oled_write_ln_P(PSTR(" "), false); -} - -// Render separator lines for oled display -void render_separator(void) { - switch (get_highest_layer(layer_state)){ - case _GAME: - case _WEAPON: - oled_write_ln_P(PSTR("===================="), false); - break; - default: - oled_write_ln_P(PSTR("++++++++++++++++++++"), false); - } -} - -// Render current layer state -void render_layer_state(void){ - // If you want to change the display of OLED, you need to change here - switch (get_highest_layer(layer_state)){ - case _QWERTY: - oled_write_ln_P(PSTR("| MODE | QWRTY ]"), false); - break; - case _NUM: - oled_write_ln_P(PSTR("| MODE | NUMBERS ]"), false); - break; - case _SYM: - oled_write_ln_P(PSTR("| MODE | SYMBOLS ]"), false); - break; - case _GAME: - oled_write_ln_P(PSTR("| G A M E ]"), false); - break; - case _WEAPON: - oled_write_ln_P(PSTR("| W E A P O N ]"), false); - break; - default: - oled_write_ln_P(PSTR("| MODE | UNDEF ]"), false); - } -} - -// Render USB State -void render_usb_state(void) { - switch (USB_DeviceState) { - case DEVICE_STATE_Unattached: - oled_write_ln_P(PSTR("| USB | FREE ]"), false); - break; - case DEVICE_STATE_Suspended: - oled_write_ln_P(PSTR("| USB | SLEEP ]"), false); - break; - case DEVICE_STATE_Configured: - oled_write_ln_P(PSTR("| USB | READY ]"), false); - break; - case DEVICE_STATE_Powered: - oled_write_ln_P(PSTR("| USB | PWRD ]"), false); - break; - case DEVICE_STATE_Default: - oled_write_ln_P(PSTR("| USB | DFLT ]"), false); - break; - case DEVICE_STATE_Addressed: - oled_write_ln_P(PSTR("| USB | ADDRS ]"), false); - break; - default: - oled_write_ln_P(PSTR("| USB | INVALID ]"), false); - } -} - // Render Logo void render_logo(void) { oled_write(read_logo(), false); @@ -209,7 +173,8 @@ void render_slave_oled(void) { // {OLED Task} -----------------------------------------------// void oled_task_user(void) { - if (timer_elapsed32(oled_timer) > 80000 && timer_elapsed32(oled_timer) < 479999) { + // First time out switches to logo as first indication of iddle. + if (timer_elapsed32(oled_timer) > 100000 && timer_elapsed32(oled_timer) < 479999) { // Render logo on both halves before full timeout if (is_master && !master_oled_cleared) { // Clear master OLED once so the logo renders properly diff --git a/keyboards/crkbd/keymaps/kidbrazil/layer.c b/keyboards/crkbd/keymaps/kidbrazil/layer.c new file mode 100644 index 0000000000..bd04f3b883 --- /dev/null +++ b/keyboards/crkbd/keymaps/kidbrazil/layer.c @@ -0,0 +1,69 @@ +#include QMK_KEYBOARD_H +#include "enums.h" + +// Render Blank Space +void render_space(void) { + oled_write_ln_P(PSTR(" "), false); +} + +// Render separator lines for oled display +void render_separator(void) { + switch (get_highest_layer(layer_state)){ + case _GAME: + case _WEAPON: + oled_write_ln_P(PSTR("===================="), false); + break; + default: + oled_write_ln_P(PSTR("++++++++++++++++++++"), false); + } +} + +// Render current layer state +void render_layer_state(void){ + // If you want to change the display of OLED, you need to change here + switch (get_highest_layer(layer_state)){ + case _QWERTY: + oled_write_ln_P(PSTR("| MODE | QWRTY ]"), false); + break; + case _NUM: + oled_write_ln_P(PSTR("| MODE | NUMBERS ]"), false); + break; + case _SYM: + oled_write_ln_P(PSTR("| MODE | SYMBOLS ]"), false); + break; + case _GAME: + oled_write_ln_P(PSTR("| G A M E ]"), false); + break; + case _WEAPON: + oled_write_ln_P(PSTR("| W E A P O N ]"), false); + break; + default: + oled_write_ln_P(PSTR("| MODE | UNDEF ]"), false); + } +} + +// Render USB State +void render_usb_state(void) { + switch (USB_DeviceState) { + case DEVICE_STATE_Unattached: + oled_write_ln_P(PSTR("| USB | FREE ]"), false); + break; + case DEVICE_STATE_Suspended: + oled_write_ln_P(PSTR("| USB | SLEEP ]"), false); + break; + case DEVICE_STATE_Configured: + oled_write_ln_P(PSTR("| USB | READY ]"), false); + break; + case DEVICE_STATE_Powered: + oled_write_ln_P(PSTR("| USB | PWRD ]"), false); + break; + case DEVICE_STATE_Default: + oled_write_ln_P(PSTR("| USB | DFLT ]"), false); + break; + case DEVICE_STATE_Addressed: + oled_write_ln_P(PSTR("| USB | ADDRS ]"), false); + break; + default: + oled_write_ln_P(PSTR("| USB | INVALID ]"), false); + } +} diff --git a/keyboards/crkbd/keymaps/kidbrazil/layer.h b/keyboards/crkbd/keymaps/kidbrazil/layer.h new file mode 100644 index 0000000000..2134e6ddab --- /dev/null +++ b/keyboards/crkbd/keymaps/kidbrazil/layer.h @@ -0,0 +1,9 @@ +// [OLED Helpers] ----------------------------------------------------// +// Render empty space on OLED +void render_space(void); +// Render separator characters for rows +void render_separator(void); +// Render layer state +void render_layer_state(void); +// Render USB State +void render_usb_state(void); diff --git a/keyboards/crkbd/keymaps/kidbrazil/rules.mk b/keyboards/crkbd/keymaps/kidbrazil/rules.mk index ad03b86bfc..244712cd03 100644 --- a/keyboards/crkbd/keymaps/kidbrazil/rules.mk +++ b/keyboards/crkbd/keymaps/kidbrazil/rules.mk @@ -8,10 +8,5 @@ RGB_MATRIX_ENABLE = WS2812 OLED_DRIVER_ENABLE = yes # If you want to change the display of OLED, you need to change here -SRC += ./keyboards/crkbd/keymaps/kidbrazil/logo_reader.c \ - #./lib/rgb_state_reader.c \ - #./lib/logo_reader.c \ - #./lib/keylogger.c \ - # ./lib/mode_icon_reader.c \ - # ./lib/host_led_state_reader.c \ - # ./lib/timelogger.c \ +SRC += logo_reader.c \ + layer.c diff --git a/keyboards/daisy/config.h b/keyboards/daisy/config.h index 567a215a6c..4ee4d242fc 100644 --- a/keyboards/daisy/config.h +++ b/keyboards/daisy/config.h @@ -1,13 +1,29 @@ -#ifndef CONFIG_H -#define CONFIG_H +/* +Copyright 2020 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once #include "config_common.h" /* USB Device descriptor parameter */ -#define VENDOR_ID 0x1209 -#define PRODUCT_ID 0x2328 -#define DEVICE_VER 0x501 -#define MANUFACTURER K.T.E.C. +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x7169 +#define DEVICE_VER 0x0501 +#define MANUFACTURER KTEC #define PRODUCT Daisy #define DESCRIPTION qmk port for Daisy @@ -32,22 +48,59 @@ /* COL2ROW, ROW2COL*/ #define DIODE_DIRECTION COL2ROW +/* + * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. + */ +//#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6 + #define BACKLIGHT_PIN D0 +// #define BACKLIGHT_BREATHING #define BACKLIGHT_LEVELS 6 +#define RGB_DI_PIN C7 +#ifdef RGB_DI_PIN +# define RGBLED_NUM 8 +# define RGBLIGHT_HUE_STEP 12 +# define RGBLIGHT_SAT_STEP 25 +# define RGBLIGHT_VAL_STEP 12 +// #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ +// #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ +// /*== all animations enable ==*/ +# define RGBLIGHT_ANIMATIONS +// /*== or choose animations ==*/ +// #define RGBLIGHT_EFFECT_BREATHING +// #define RGBLIGHT_EFFECT_RAINBOW_MOOD +// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL +// #define RGBLIGHT_EFFECT_SNAKE +// #define RGBLIGHT_EFFECT_KNIGHT +// #define RGBLIGHT_EFFECT_CHRISTMAS +// #define RGBLIGHT_EFFECT_STATIC_GRADIENT +// #define RGBLIGHT_EFFECT_RGB_TEST +// #define RGBLIGHT_EFFECT_ALTERNATING +// /*== customize breathing effect ==*/ +// /*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/ +// #define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64 +// /*==== use exp() and sin() ====*/ +// #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7 +// #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255 +#endif + /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 5 /* define if matrix has ghost (lacks anti-ghosting diodes) */ //#define MATRIX_HAS_GHOST -/* number of backlight levels */ - /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE /* Locking resynchronize hack */ #define LOCKING_RESYNC_ENABLE +/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. + * This is userful for the Windows task manager shortcut (ctrl+shift+esc). + */ +// #define GRAVE_ESC_CTRL_OVERRIDE + /* * Force NKRO * @@ -81,6 +134,10 @@ * */ +/* key combination for magic key command */ +/* defined by default; to change, uncomment and set to the combination you want */ +// #define IS_COMMAND() (get_mods() == MOD_MASK_SHIFT) + /* control how magic key switches layers */ //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true @@ -90,8 +147,8 @@ //#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS //#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS //#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM -//#define MAGIC_KEY_HELP1 H -//#define MAGIC_KEY_HELP2 SLASH +//#define MAGIC_KEY_HELP H +//#define MAGIC_KEY_HELP_ALT SLASH //#define MAGIC_KEY_DEBUG D //#define MAGIC_KEY_DEBUG_MATRIX X //#define MAGIC_KEY_DEBUG_KBD K @@ -99,9 +156,8 @@ //#define MAGIC_KEY_VERSION V //#define MAGIC_KEY_STATUS S //#define MAGIC_KEY_CONSOLE C -//#define MAGIC_KEY_LAYER0_ALT1 ESC -//#define MAGIC_KEY_LAYER0_ALT2 GRAVE //#define MAGIC_KEY_LAYER0 0 +//#define MAGIC_KEY_LAYER0_ALT GRAVE //#define MAGIC_KEY_LAYER1 1 //#define MAGIC_KEY_LAYER2 2 //#define MAGIC_KEY_LAYER3 3 @@ -111,9 +167,11 @@ //#define MAGIC_KEY_LAYER7 7 //#define MAGIC_KEY_LAYER8 8 //#define MAGIC_KEY_LAYER9 9 -//#define MAGIC_KEY_BOOTLOADER PAUSE +//#define MAGIC_KEY_BOOTLOADER B +//#define MAGIC_KEY_BOOTLOADER_ALT ESC //#define MAGIC_KEY_LOCK CAPS //#define MAGIC_KEY_EEPROM E +//#define MAGIC_KEY_EEPROM_CLEAR BSPACE //#define MAGIC_KEY_NKRO N //#define MAGIC_KEY_SLEEP_LED Z @@ -132,17 +190,12 @@ //#define NO_ACTION_LAYER //#define NO_ACTION_TAPPING //#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION - -// ws2812 options -#define RGB_DI_PIN C7 // pin the DI on the ws2812 is hooked-up to -#define RGBLIGHT_ANIMATIONS // run RGB animations -#define RGBLED_NUM 8 // number of LEDs -#define RGBLIGHT_HUE_STEP 12 // units to step when in/decreasing hue -#define RGBLIGHT_SAT_STEP 25 // units to step when in/decresing saturation -#define RGBLIGHT_VAL_STEP 12 // units to step when in/decreasing value (brightness) +/* disable these deprecated features by default */ +#ifndef LINK_TIME_OPTIMIZATION_ENABLE + #define NO_ACTION_MACRO + #define NO_ACTION_FUNCTION +#endif /* * MIDI options */ @@ -166,4 +219,34 @@ /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ //#define MIDI_TONE_KEYCODE_OCTAVES 1 +/* + * HD44780 LCD Display Configuration + */ +/* +#define LCD_LINES 2 //< number of visible lines of the display +#define LCD_DISP_LENGTH 16 //< visibles characters per line of the display + +#define LCD_IO_MODE 1 //< 0: memory mapped mode, 1: IO port mode + +#if LCD_IO_MODE +#define LCD_PORT PORTB //< port for the LCD lines +#define LCD_DATA0_PORT LCD_PORT //< port for 4bit data bit 0 +#define LCD_DATA1_PORT LCD_PORT //< port for 4bit data bit 1 +#define LCD_DATA2_PORT LCD_PORT //< port for 4bit data bit 2 +#define LCD_DATA3_PORT LCD_PORT //< port for 4bit data bit 3 +#define LCD_DATA0_PIN 4 //< pin for 4bit data bit 0 +#define LCD_DATA1_PIN 5 //< pin for 4bit data bit 1 +#define LCD_DATA2_PIN 6 //< pin for 4bit data bit 2 +#define LCD_DATA3_PIN 7 //< pin for 4bit data bit 3 +#define LCD_RS_PORT LCD_PORT //< port for RS line +#define LCD_RS_PIN 3 //< pin for RS line +#define LCD_RW_PORT LCD_PORT //< port for RW line +#define LCD_RW_PIN 2 //< pin for RW line +#define LCD_E_PORT LCD_PORT //< port for Enable line +#define LCD_E_PIN 1 //< pin for Enable line #endif +*/ + +/* Bootmagic Lite key configuration */ +// #define BOOTMAGIC_LITE_ROW 0 +// #define BOOTMAGIC_LITE_COLUMN 0 diff --git a/keyboards/daisy/daisy.c b/keyboards/daisy/daisy.c index f8ca24ff0b..4e365ed462 100644 --- a/keyboards/daisy/daisy.c +++ b/keyboards/daisy/daisy.c @@ -1,15 +1,35 @@ +/* Copyright 2020 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + #include "daisy.h" -void led_set_kb(uint8_t usb_led) { - // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here - if (usb_led & (1<<USB_LED_CAPS_LOCK)) { - // output low - DDRC |= (1<<PC6); - PORTC &= ~(1<<PC6); - } else { - // Hi-Z - DDRC &= ~(1<<PC6); - PORTC &= ~(1<<PC6); - } - led_set_user(usb_led); -}
\ No newline at end of file +void keyboard_pre_init_kb(void) { + led_init_ports(); + keyboard_pre_init_user(); +} + +void led_init_ports(void) { + setPinOutput(C6); + writePinHigh(C6); +} + +bool led_update_kb(led_t led_state) { + if (led_update_user(led_state)) { + writePin(C6, !led_state.caps_lock); + } + + return true; +} diff --git a/keyboards/daisy/daisy.h b/keyboards/daisy/daisy.h index 15483e3a3a..b78c604649 100644 --- a/keyboards/daisy/daisy.h +++ b/keyboards/daisy/daisy.h @@ -1,19 +1,51 @@ -#ifndef DAISY_H -#define DAISY_H +/* Copyright 2020 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once #include "quantum.h" +/* This is a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ #define LAYOUT( \ - K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K3A, \ - K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \ - K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, \ - K30, K31, K32, K34, K35, K37, K38, K39 \ -) \ -{ \ - { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A }, \ - { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A }, \ - { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A }, \ - { K30, K31, K32, KC_NO, K34, K35, KC_NO, K37, K38, K39, K3A } \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K3A, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, \ + K30, K31, K32, K34, K35, K37, K38, K39 \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A }, \ + { K30, K31, K32, KC_NO, K34, K35, KC_NO, K37, K38, K39, K3A } \ } -#endif +#define LAYOUT_625_space( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K3A, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, \ + K30, K31, K32, K35, K38, K39 \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A }, \ + { K30, K31, K32, KC_NO, KC_NO, K35, KC_NO, KC_NO, K38, K39, K3A } \ +} diff --git a/keyboards/daisy/info.json b/keyboards/daisy/info.json index 4005757932..fcc7cd9faf 100644 --- a/keyboards/daisy/info.json +++ b/keyboards/daisy/info.json @@ -1,18 +1,107 @@ { - "keyboard_name": "Daisy", - "url": "", - "maintainer": "qmk", - "width": 12, - "height": 4, - "layouts": { - "LAYOUT": { - "key_count": 42, - "layout": [{"label": "K00", "x": 0, "y": 0}, {"label": "K01", "x": 1, "y": 0}, {"label": "K02", "x": 2, "y": 0}, {"label": "K03", "x": 3, "y": 0}, {"label": "K04", "x": 4, "y": 0}, {"label": "K05", "x": 5, "y": 0}, {"label": "K06", "x": 6, "y": 0}, {"label": "K07", "x": 7, "y": 0}, {"label": "K08", "x": 8, "y": 0}, {"label": "K09", "x": 9, "y": 0}, {"label": "K0A", "x": 10, "y": 0}, {"label": "K3A", "x": 11, "y": 0}, {"label": "K10", "x": 0, "y": 1, "w": 1.25}, {"label": "K11", "x": 1.25, "y": 1}, {"label": "K12", "x": 2.25, "y": 1}, {"label": "K13", "x": 3.25, "y": 1}, {"label": "K14", "x": 4.25, "y": 1}, {"label": "K15", "x": 5.25, "y": 1}, {"label": "K16", "x": 6.25, "y": 1}, {"label": "K17", "x": 7.25, "y": 1}, {"label": "K18", "x": 8.25, "y": 1}, {"label": "K19", "x": 9.25, "y": 1}, {"label": "K1A", "x": 10.25, "y": 1, "w": 1.75}, {"label": "K20", "x": 0, "y": 2, "w": 1.75}, {"label": "K21", "x": 1.75, "y": 2}, {"label": "K22", "x": 2.75, "y": 2}, {"label": "K23", "x": 3.75, "y": 2}, {"label": "K24", "x": 4.75, "y": 2}, {"label": "K25", "x": 5.75, "y": 2}, {"label": "K26", "x": 6.75, "y": 2}, {"label": "K27", "x": 7.75, "y": 2}, {"label": "K28", "x": 8.75, "y": 2}, {"label": "K29", "x": 9.75, "y": 2}, {"label": "K2A", "x": 10.75, "y": 2, "w": 1.25}, {"label": "K30", "x": 0, "y": 3, "w": 1.25}, {"label": "K31", "x": 1.25, "y": 3}, {"label": "K32", "x": 2.25, "y": 3, "w": 1.25}, {"label": "K34", "x": 3.5, "y": 3, "w": 2.25}, {"label": "K35", "x": 5.75, "y": 3, "w": 2.75}, {"label": "K37", "x": 8.5, "y": 3, "w": 1.25}, {"label": "K38", "x": 9.75, "y": 3}, {"label": "K39", "x": 10.75, "y": 3, "w": 1.25}] - }, + "keyboard_name": "Daisy", + "url": "", + "maintainer": "qmk", + "width": 12, + "height": 4, + "layouts": { + "LAYOUT": { + "key_count": 42, + "layout": [ + {"x": 0, "y": 0}, + {"x": 1, "y": 0}, + {"x": 2, "y": 0}, + {"x": 3, "y": 0}, + {"x": 4, "y": 0}, + {"x": 5, "y": 0}, + {"x": 6, "y": 0}, + {"x": 7, "y": 0}, + {"x": 8, "y": 0}, + {"x": 9, "y": 0}, + {"x": 10, "y": 0}, + {"x": 11, "y": 0}, - "LAYOUT_625_space": { - "key_count": 40, - "layout": [{"label": "K00", "x": 0, "y": 0}, {"label": "K01", "x": 1, "y": 0}, {"label": "K02", "x": 2, "y": 0}, {"label": "K03", "x": 3, "y": 0}, {"label": "K04", "x": 4, "y": 0}, {"label": "K05", "x": 5, "y": 0}, {"label": "K06", "x": 6, "y": 0}, {"label": "K07", "x": 7, "y": 0}, {"label": "K08", "x": 8, "y": 0}, {"label": "K09", "x": 9, "y": 0}, {"label": "K0A", "x": 10, "y": 0}, {"label": "K3A", "x": 11, "y": 0}, {"label": "K10", "x": 0, "y": 1, "w": 1.25}, {"label": "K11", "x": 1.25, "y": 1}, {"label": "K12", "x": 2.25, "y": 1}, {"label": "K13", "x": 3.25, "y": 1}, {"label": "K14", "x": 4.25, "y": 1}, {"label": "K15", "x": 5.25, "y": 1}, {"label": "K16", "x": 6.25, "y": 1}, {"label": "K17", "x": 7.25, "y": 1}, {"label": "K18", "x": 8.25, "y": 1}, {"label": "K19", "x": 9.25, "y": 1}, {"label": "K1A", "x": 10.25, "y": 1, "w": 1.75}, {"label": "K20", "x": 0, "y": 2, "w": 1.75}, {"label": "K21", "x": 1.75, "y": 2}, {"label": "K22", "x": 2.75, "y": 2}, {"label": "K23", "x": 3.75, "y": 2}, {"label": "K24", "x": 4.75, "y": 2}, {"label": "K25", "x": 5.75, "y": 2}, {"label": "K26", "x": 6.75, "y": 2}, {"label": "K27", "x": 7.75, "y": 2}, {"label": "K28", "x": 8.75, "y": 2}, {"label": "K29", "x": 9.75, "y": 2}, {"label": "K2A", "x": 10.75, "y": 2, "w": 1.25}, {"label": "K30", "x": 0, "y": 3, "w": 1.25}, {"label": "K31", "x": 1.25, "y": 3}, {"label": "K32", "x": 2.25, "y": 3}, {"x": 3.25, "y": 3, "w": 6.25}, {"label": "K38", "x": 9.5, "y": 3, "w": 1.25}, {"label": "K39", "x": 10.75, "y": 3, "w": 1.25}] + {"x": 0, "y": 1, "w": 1.25}, + {"x": 1.25, "y": 1}, + {"x": 2.25, "y": 1}, + {"x": 3.25, "y": 1}, + {"x": 4.25, "y": 1}, + {"x": 5.25, "y": 1}, + {"x": 6.25, "y": 1}, + {"x": 7.25, "y": 1}, + {"x": 8.25, "y": 1}, + {"x": 9.25, "y": 1}, + {"x": 10.25, "y": 1, "w": 1.75}, + + {"x": 0, "y": 2, "w": 1.75}, + {"x": 1.75, "y": 2}, + {"x": 2.75, "y": 2}, + {"x": 3.75, "y": 2}, + {"x": 4.75, "y": 2}, + {"x": 5.75, "y": 2}, + {"x": 6.75, "y": 2}, + {"x": 7.75, "y": 2}, + {"x": 8.75, "y": 2}, + {"x": 9.75, "y": 2}, + {"x": 10.75, "y": 2, "w": 1.25}, + + {"x": 0, "y": 3, "w": 1.25}, + {"x": 1.25, "y": 3}, + {"x": 2.25, "y": 3, "w": 1.25}, + {"x": 3.5, "y": 3, "w": 2.25}, + {"x": 5.75, "y": 3, "w": 2.75}, + {"x": 8.5, "y": 3, "w": 1.25}, + {"x": 9.75, "y": 3}, + {"x": 10.75, "y": 3, "w": 1.25} + ] + }, + "LAYOUT_625_space": { + "key_count": 40, + "layout": [ + {"x": 0, "y": 0}, + {"x": 1, "y": 0}, + {"x": 2, "y": 0}, + {"x": 3, "y": 0}, + {"x": 4, "y": 0}, + {"x": 5, "y": 0}, + {"x": 6, "y": 0}, + {"x": 7, "y": 0}, + {"x": 8, "y": 0}, + {"x": 9, "y": 0}, + {"x": 10, "y": 0}, + {"x": 11, "y": 0}, + + {"x": 0, "y": 1, "w": 1.25}, + {"x": 1.25, "y": 1}, + {"x": 2.25, "y": 1}, + {"x": 3.25, "y": 1}, + {"x": 4.25, "y": 1}, + {"x": 5.25, "y": 1}, + {"x": 6.25, "y": 1}, + {"x": 7.25, "y": 1}, + {"x": 8.25, "y": 1}, + {"x": 9.25, "y": 1}, + {"x": 10.25, "y": 1, "w": 1.75}, + + {"x": 0, "y": 2, "w": 1.75}, + {"x": 1.75, "y": 2}, + {"x": 2.75, "y": 2}, + {"x": 3.75, "y": 2}, + {"x": 4.75, "y": 2}, + {"x": 5.75, "y": 2}, + {"x": 6.75, "y": 2}, + {"x": 7.75, "y": 2}, + {"x": 8.75, "y": 2}, + {"x": 9.75, "y": 2}, + {"x": 10.75, "y": 2, "w": 1.25}, + + {"x": 0, "y": 3, "w": 1.25}, + {"x": 1.25, "y": 3}, + {"x": 2.25, "y": 3}, + {"x": 3.25, "y": 3, "w": 6.25}, + {"x": 9.5, "y": 3, "w": 1.25}, + {"x": 10.75, "y": 3, "w": 1.25} + ] + } } - } } diff --git a/keyboards/daisy/keymaps/default/keymap.c b/keyboards/daisy/keymaps/default/keymap.c index adc3298d06..f076803766 100644 --- a/keyboards/daisy/keymaps/default/keymap.c +++ b/keyboards/daisy/keymaps/default/keymap.c @@ -1,92 +1,83 @@ -#include QMK_KEYBOARD_H - +/* Copyright 2020 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ -// Layer shorthand -#define _BL 0 -#define _LW 1 -#define _RS 2 +#include QMK_KEYBOARD_H -enum layer_keycodes { - QWERTY = SAFE_RANGE, LOWER, RAISE +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _BL, + _LW, + _RS }; -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - - /* Base Layer - * .-----------------------------------------------------------------------. - * | ESC | Q | W | E | R | T | Y | U | I | O | P | \| | - * |-----------------------------------------------------------------------| - * | TAB | A | S | D | F | G | H | J | K | L | ENTER | - * |-----------------------------------------------------------------------| - * | LSHIFT | Z | X | C | V | B | N | M | ,< | .> | /? | - * |-----------------------------------------------------------------------| - * | LCTRL | LGUI | LALT | SPACE | BACKSPACE | LW | RS | RALT | - * '-----------------------------------------------------------------------' - */ - [_BL] = LAYOUT( - GRAVE_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, - KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_BSPC, LOWER, RAISE, KC_RALT - ), +#define LOWER MO(_LW) +#define RAISE MO(_RS) - /* Function Layer - * .-----------------------------------------------------------------------. - * | GRV | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | -_ | - * |-----------------------------------------------------------------------| - * | | =+ | UP | | | | [{ | ]} | ;: | '" | | - * |-----------------------------------------------------------------------| - * | | LEFT| DOWN |RIGHT| | | | | | | | - * |-----------------------------------------------------------------------| - * | | | | | DELETE | | | | - * '-----------------------------------------------------------------------' - */ - - [_LW] = LAYOUT( - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, - KC_TRNS, KC_EQL, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_LBRC, KC_RBRC, KC_SCLN, KC_QUOT, KC_TRNS, - KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_LCTL, KC_LGUI, KC_LALT, KC_TRNS, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS - ), - - /* Second Function Layer - * .-----------------------------------------------------------------------. - * | RST | F1 | F2 | F3 | F4 | F5 | F6 | | HOME| PGUP| | | - * |-----------------------------------------------------------------------| - * | | F7 | F8 | F9 | F10 | F11 | F12 | | END | PGDN| | - * |-----------------------------------------------------------------------| - * | |RGBtog|RGBmod|RGBhud|RGBhui|RGBvad|RGBvai|RGBsad|RGBsai|BL| | - * |-----------------------------------------------------------------------| - * | | | | | | | | | - * '-----------------------------------------------------------------------' - */ - [_RS] = LAYOUT( - RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_TRNS, KC_HOME, KC_PGUP, KC_TRNS, KC_TRNS, - KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_END, KC_PGDN, KC_TRNS, - KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_VAD, RGB_VAI, RGB_SAD, RGB_SAI, BL_STEP, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS - ), +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base Layer + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ + * │Esc│ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ \ │ + * ├───┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴───┤ + * │Tab │ A │ S │ D │ F │ G │ H │ J │ K │ L │ Enter│ + * ├────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬────┤ + * │Shift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ + * ├────┬─┴─┬─┴──┬┴───┴───┼───┴───┴──┬┴───┼───┼────┤ + * │Ctrl│GUI│Alt │ │ Backspace│Lowr│Rse│ Alt│ + * └────┴───┴────┴────────┴──────────┴────┴───┴────┘ + */ + [_BL] = LAYOUT( + KC_GESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_BSPC, LOWER, RAISE, KC_RALT + ), -}; + /* Function Layer 1 (Lower) + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ + * └───┴┬──┴┬──┴┬──┴───┴───┴┬──┴┬──┴┬──┴┬──┴┬──┴───┘ + * │ │ = │ ▴ │ │ │ │ [ │ ] │ ; │ ' │ │ + * ├────└─┬─┴─┬─┴─┬───┐─┴─┬─└───┴───┴───┴───┘─┬────┤ + * │ │ ◂ │ ▾ │ ▸ │ │ │ │ │ │ │ │ + * ├────┬─└───┴───┴───┘───┌──────────┐┴───┼───┼────┤ + * │ │ │ │ │ Delete │ │ │ │ + * └────┴───┴────┴────────└──────────┘────┴───┴────┘ + */ + [_LW] = LAYOUT( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + _______, KC_EQL, KC_UP, _______, _______, _______, KC_LBRC, KC_RBRC, KC_SCLN, KC_QUOT, _______, + _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, KC_DEL, _______, _______, _______ + ), -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case LOWER: - if(record->event.pressed){ - layer_on(_LW); - } else { - layer_off(_LW); - } - return false; - break; - case RAISE: - if(record->event.pressed){ - layer_on(_RS); - } else { - layer_off(_RS); - } - return false; - break; - } - return true; + /* Function Layer 2 (Raise) + * ┌───┬───┬───┬───┬───┬───┬───┐───┌───┬───┐───┬───┐ + * │Rst│F1 │F2 │F3 │F4 │F5 │F6 │ │Hom│PgU│ │ │ + * └───┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┐──└┬──┴┬──┴┐──┴───┤ + * │ │F7 │F8 │F9 │F10│F11│F12│ │ ; │ ' │ │ + * ├────└─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┴───┴───┴───┴─┐────┤ + * │ │RGB│Mod│HuD│HuI│VaD│VaI│SaD│SaI│BLS│ │ + * ├────┬─└───┴───┴───┴───┴───┴───┴───┴───┴───┘────┤ + * │ │ │ │ │ │ │ │ │ + * └────┴───┴────┴────────┴──────────┴────┴───┴────┘ + */ + [_RS] = LAYOUT( + RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, KC_HOME, KC_PGUP, _______, _______, + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_END, KC_PGDN, _______, + _______, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_VAD, RGB_VAI, RGB_SAD, RGB_SAI, BL_STEP, _______, + _______, _______, _______, _______, _______, _______, _______, _______ + ) }; diff --git a/keyboards/daisy/keymaps/default/readme.md b/keyboards/daisy/keymaps/default/readme.md index dff0dcbdee..b8c7d17f28 100644 --- a/keyboards/daisy/keymaps/default/readme.md +++ b/keyboards/daisy/keymaps/default/readme.md @@ -1,5 +1 @@ -![Daisy Layout Image](https://imgur.com/9mSF0yf) - -# Default Daisy Layout - -This is the default layout as offered by KPRepublic's TMK firmware for the Daisy with a few minor tweaks for usability made by me. +# The default keymap for Daisy diff --git a/keyboards/daisy/readme.md b/keyboards/daisy/readme.md index c8175c2830..a8a93bf791 100644 --- a/keyboards/daisy/readme.md +++ b/keyboards/daisy/readme.md @@ -1,29 +1,15 @@ # Daisy -A 40% keyboard kit sold by KPRepublic. +![Daisy PCB](https://cdn.shopify.com/s/files/1/2711/4238/products/HTB1Pj1UggMPMeJjy1Xcq6xpppXa7_1024x1024.jpg) -Keyboard Maintainer: westfoxtrot (https://github.com/westfoxtrot) -Hardware Supported: Daisy PCB Rev.1, Daisy PCB Rev.2 -Hardware Availability: http://tinyurl.com/yc26lq22 +A 40% keyboard kit sold by KPrepublic. + +* Keyboard Maintainer: [westfoxtrot](https://github.com/westfoxtrot) +* Hardware Supported: Daisy PCB Rev.1, Daisy PCB Rev.2 +* Hardware Availability: [KPrepublic](https://kprepublic.com/products/daisy-40-custom-keyboard-pcb) Make example for this keyboard (after setting up your build environment): make daisy:default -See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. - - -# Other Keymaps - -The "default" keymap included is the layout I personally use on the Daisy and the one I have found the most comfortable. - -A printable picture showing this layout is available here: https://imgur.com/9mSF0yf - - -``` -$ make daisy:[default|<name>] -``` - -# Bootloader - -I personally had issues with the bootloader on my Daisy PCB and was unable to flash a firmware to the board after the first time. I replaced the bootloader with the one available in the repository at ../../util/bootloader_atmega32u4_1_0_0.hex +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/daisy/rules.mk b/keyboards/daisy/rules.mk index d2b0d7d167..c82fa9bc67 100644 --- a/keyboards/daisy/rules.mk +++ b/keyboards/daisy/rules.mk @@ -11,20 +11,22 @@ MCU = atmega32u4 # ATmega328P USBasp BOOTLOADER = atmel-dfu -# QMK Build Options -# change to "no" to disable the options, or define them in the Makefile in -# the appropriate keymap folder that will get included automatically +# Build Options +# change yes to no to disable # -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = no # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = no # Console for debug(+400) +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = no # USB Nkey Rollover BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) -AUDIO_ENABLE = no # Audio output on port C6 -UNICODE_ENABLE = no # Unicode +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +MIDI_ENABLE = no # MIDI support BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID -RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches +HD44780_ENABLE = no # Enable support for HD44780 based LCDs diff --git a/keyboards/eco/keymaps/xyverz/keymap.c b/keyboards/eco/keymaps/xyverz/keymap.c index 5a1974336a..06054e9ac8 100644 --- a/keyboards/eco/keymaps/xyverz/keymap.c +++ b/keyboards/eco/keymaps/xyverz/keymap.c @@ -132,9 +132,7 @@ void matrix_init_user(void) { #ifdef BOOTLOADER_CATERINA // This will disable the red LEDs on the ProMicros setPinInput(D5); - writePinLow(D5); setPinInput(B0); - writePinLow(B0); #endif }; @@ -155,4 +153,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } return true; -}
\ No newline at end of file +} diff --git a/keyboards/ergodox_infinity/rules.mk b/keyboards/ergodox_infinity/rules.mk index b55c9bc8c0..4e39ac8081 100644 --- a/keyboards/ergodox_infinity/rules.mk +++ b/keyboards/ergodox_infinity/rules.mk @@ -79,6 +79,7 @@ SERIAL_LINK_ENABLE = yes VISUALIZER_ENABLE = yes LCD_ENABLE = yes BACKLIGHT_ENABLE = yes +BACKLIGHT_DRIVER = custom LCD_BACKLIGHT_ENABLE = yes MIDI_ENABLE = no RGBLIGHT_ENABLE = no diff --git a/keyboards/gh60/revc/revc.h b/keyboards/gh60/revc/revc.h index dda7a0db6d..e183f776e9 100644 --- a/keyboards/gh60/revc/revc.h +++ b/keyboards/gh60/revc/revc.h @@ -18,11 +18,11 @@ inline void gh60_fn_led_on(void) { setPinOutput(F5); writePinLow(F5); } inline void gh60_esc_led_on(void) { setPinOutput(F6); writePinLow(F6); } inline void gh60_wasd_leds_on(void) { setPinOutput(F7); writePinLow(F7); } -inline void gh60_caps_led_off(void) { setPinInput(B2); writePinLow(B2); } -inline void gh60_poker_leds_off(void) { setPinInput(F4); writePinLow(F4); } -inline void gh60_fn_led_off(void) { setPinInput(F5); writePinLow(F5); } -inline void gh60_esc_led_off(void) { setPinInput(F6); writePinLow(F6); } -inline void gh60_wasd_leds_off(void) { setPinInput(F7); writePinLow(F7); } +inline void gh60_caps_led_off(void) { setPinInput(B2); } +inline void gh60_poker_leds_off(void) { setPinInput(F4); } +inline void gh60_fn_led_off(void) { setPinInput(F5); } +inline void gh60_esc_led_off(void) { setPinInput(F6); } +inline void gh60_wasd_leds_off(void) { setPinInput(F7); } /* GH60 keymap definition macro * K2C, K31 and K3C are extra keys for ISO diff --git a/keyboards/gingham/matrix.c b/keyboards/gingham/matrix.c index 790ba9c287..5ac81e7911 100644 --- a/keyboards/gingham/matrix.c +++ b/keyboards/gingham/matrix.c @@ -150,7 +150,7 @@ static void unselect_row(uint8_t row) static void unselect_rows(void) { for(uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInput(row_pins[x]); + setPinInputHigh(row_pins[x]); } } diff --git a/keyboards/handwired/onekey/bluepill/ld/STM32F103x8_stm32duino_bootloader.ld b/keyboards/handwired/onekey/bluepill/ld/STM32F103x8_stm32duino_bootloader.ld deleted file mode 100644 index d0688ef601..0000000000 --- a/keyboards/handwired/onekey/bluepill/ld/STM32F103x8_stm32duino_bootloader.ld +++ /dev/null @@ -1,88 +0,0 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -/* - * ST32F103xB memory setup for use with the maplemini bootloader. - * You will have to - * #define CORTEX_VTOR_INIT 0x5000 - * in your projects chconf.h - */ -MEMORY -{ - flash0 : org = 0x08002000, len = 64k - 0x2000 - flash1 : org = 0x00000000, len = 0 - flash2 : org = 0x00000000, len = 0 - flash3 : org = 0x00000000, len = 0 - flash4 : org = 0x00000000, len = 0 - flash5 : org = 0x00000000, len = 0 - flash6 : org = 0x00000000, len = 0 - flash7 : org = 0x00000000, len = 0 - ram0 : org = 0x20000000, len = 20k - ram1 : org = 0x00000000, len = 0 - ram2 : org = 0x00000000, len = 0 - ram3 : org = 0x00000000, len = 0 - ram4 : org = 0x00000000, len = 0 - ram5 : org = 0x00000000, len = 0 - ram6 : org = 0x00000000, len = 0 - ram7 : org = 0x00000000, len = 0 -} - -/* For each data/text section two region are defined, a virtual region - and a load region (_LMA suffix).*/ - -/* Flash region to be used for exception vectors.*/ -REGION_ALIAS("VECTORS_FLASH", flash0); -REGION_ALIAS("VECTORS_FLASH_LMA", flash0); - -/* Flash region to be used for constructors and destructors.*/ -REGION_ALIAS("XTORS_FLASH", flash0); -REGION_ALIAS("XTORS_FLASH_LMA", flash0); - -/* Flash region to be used for code text.*/ -REGION_ALIAS("TEXT_FLASH", flash0); -REGION_ALIAS("TEXT_FLASH_LMA", flash0); - -/* Flash region to be used for read only data.*/ -REGION_ALIAS("RODATA_FLASH", flash0); -REGION_ALIAS("RODATA_FLASH_LMA", flash0); - -/* Flash region to be used for various.*/ -REGION_ALIAS("VARIOUS_FLASH", flash0); -REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); - -/* Flash region to be used for RAM(n) initialization data.*/ -REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); -REGION_ALIAS("DATA_RAM_LMA", flash0); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram0); - -/* Generic rules inclusion.*/ -INCLUDE rules.ld diff --git a/keyboards/handwired/onekey/teensy_lc/ld/MKL26Z64.ld b/keyboards/handwired/onekey/teensy_lc/ld/MKL26Z64.ld deleted file mode 100644 index c4ca8b874c..0000000000 --- a/keyboards/handwired/onekey/teensy_lc/ld/MKL26Z64.ld +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2013-2016 Fabio Utzig, http://fabioutzig.com - * (C) 2016 flabbergast <s3+flabbergast@sdfeu.org> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* - * KL26Z64 memory setup. - */ -MEMORY -{ - flash0 : org = 0x00000000, len = 0x100 - flash1 : org = 0x00000400, len = 0x10 - flash2 : org = 0x00000410, len = 62k - 0x410 - flash3 : org = 0x0000F800, len = 2k - flash4 : org = 0x00000000, len = 0 - flash5 : org = 0x00000000, len = 0 - flash6 : org = 0x00000000, len = 0 - flash7 : org = 0x00000000, len = 0 - ram0 : org = 0x1FFFF800, len = 8k - ram1 : org = 0x00000000, len = 0 - ram2 : org = 0x00000000, len = 0 - ram3 : org = 0x00000000, len = 0 - ram4 : org = 0x00000000, len = 0 - ram5 : org = 0x00000000, len = 0 - ram6 : org = 0x00000000, len = 0 - ram7 : org = 0x00000000, len = 0 -} - -/* Flash region for the configuration bytes.*/ -SECTIONS -{ - .cfmprotect : ALIGN(4) SUBALIGN(4) - { - KEEP(*(.cfmconfig)) - } > flash1 -} - -/* For each data/text section two region are defined, a virtual region - and a load region (_LMA suffix).*/ - -/* Flash region to be used for exception vectors.*/ -REGION_ALIAS("VECTORS_FLASH", flash0); -REGION_ALIAS("VECTORS_FLASH_LMA", flash0); - -/* Flash region to be used for constructors and destructors.*/ -REGION_ALIAS("XTORS_FLASH", flash2); -REGION_ALIAS("XTORS_FLASH_LMA", flash2); - -/* Flash region to be used for code text.*/ -REGION_ALIAS("TEXT_FLASH", flash2); -REGION_ALIAS("TEXT_FLASH_LMA", flash2); - -/* Flash region to be used for read only data.*/ -REGION_ALIAS("RODATA_FLASH", flash2); -REGION_ALIAS("RODATA_FLASH_LMA", flash2); - -/* Flash region to be used for various.*/ -REGION_ALIAS("VARIOUS_FLASH", flash2); -REGION_ALIAS("VARIOUS_FLASH_LMA", flash2); - -/* Flash region to be used for RAM(n) initialization data.*/ -REGION_ALIAS("RAM_INIT_FLASH_LMA", flash2); - -/* RAM region to be used for Main stack. This stack accommodates the processing - of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram0); - -/* RAM region to be used for the process stack. This is the stack used by - the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram0); - -/* RAM region to be used for data segment.*/ -REGION_ALIAS("DATA_RAM", ram0); -REGION_ALIAS("DATA_RAM_LMA", flash2); - -/* RAM region to be used for BSS segment.*/ -REGION_ALIAS("BSS_RAM", ram0); - -/* RAM region to be used for the default heap.*/ -REGION_ALIAS("HEAP_RAM", ram0); - -__eeprom_workarea_start__ = ORIGIN(flash3); -__eeprom_workarea_size__ = LENGTH(flash3); -__eeprom_workarea_end__ = __eeprom_workarea_start__ + __eeprom_workarea_size__; - -/* Generic rules inclusion.*/ -INCLUDE rules.ld diff --git a/keyboards/handwired/owlet60/matrix.c b/keyboards/handwired/owlet60/matrix.c index 994f527ec7..dafc19fcc4 100644 --- a/keyboards/handwired/owlet60/matrix.c +++ b/keyboards/handwired/owlet60/matrix.c @@ -215,10 +215,7 @@ void matrix_init(void) { matrix_init_quantum(); setPinInput(D5); - writePinLow(D5); - - setPinInput(B0); - writePinLow(B0); + setPinInput(B0); } // modified for per col read matrix scan diff --git a/keyboards/hineybush/h87a/keymaps/wkl/keymap.c b/keyboards/hineybush/h87a/keymaps/wkl/keymap.c index 72b4d4e44d..e3e4108233 100644 --- a/keyboards/hineybush/h87a/keymaps/wkl/keymap.c +++ b/keyboards/hineybush/h87a/keymaps/wkl/keymap.c @@ -59,7 +59,6 @@ void led_set_user(uint8_t usb_led) { writePinLow(D5); } else { setPinInput(D5); - writePinLow(D5); } if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) { @@ -67,7 +66,6 @@ void led_set_user(uint8_t usb_led) { writePinLow(E6); } else { setPinInput(E6); - writePinLow(E6); } } diff --git a/keyboards/hineybush/h88/h88.c b/keyboards/hineybush/h88/h88.c index 46d6393907..1f702e9e9d 100644 --- a/keyboards/hineybush/h88/h88.c +++ b/keyboards/hineybush/h88/h88.c @@ -54,7 +54,6 @@ void led_set_user(uint8_t usb_led) { writePinLow(D5); } else { setPinInput(D5); - writePinLow(D5); } if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) { @@ -62,7 +61,6 @@ void led_set_user(uint8_t usb_led) { writePinLow(E6); } else { setPinInput(E6); - writePinLow(E6); } } diff --git a/keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c b/keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c index ad3b6f6c5c..1221e753a4 100644 --- a/keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c +++ b/keyboards/kbdfans/kbd75/keymaps/tucznak/keymap.c @@ -85,6 +85,5 @@ void led_set_user(uint8_t usb_led) { writePinLow(B2); } else { setPinInput(B2); - writePinLow(B2); } } diff --git a/keyboards/kmac/matrix.c b/keyboards/kmac/matrix.c index 2212ee076b..9bc59a0784 100644 --- a/keyboards/kmac/matrix.c +++ b/keyboards/kmac/matrix.c @@ -140,7 +140,7 @@ static void select_col(uint8_t col) { static void init_pins(void) { unselect_cols(); for (uint8_t x = 0; x < MATRIX_ROWS; x++) { - setPinInput(row_pins[x]); + setPinInputHigh(row_pins[x]); } setPinInputHigh(E2); diff --git a/keyboards/mc_76k/config.h b/keyboards/mc_76k/config.h new file mode 100644 index 0000000000..cccd6a8e93 --- /dev/null +++ b/keyboards/mc_76k/config.h @@ -0,0 +1,104 @@ +/* +Copyright 2020 Yiancar-Designs + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x8968 +#define PRODUCT_ID 0x4D43 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Yiancar-Designs +#define PRODUCT MC-76K +#define DESCRIPTION O-Ring suspended 60% with F-row keyboard + +/* key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 14 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * + */ +#define MATRIX_ROW_PINS { C7, C6, B6, B0, D1, D0 } +#define MATRIX_COL_PINS { D5, D3, D4, B1, D6, D7, B4, B5, F7, F6, F5, F4, F1, F0 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. + * This is userful for the Windows task manager shortcut (ctrl+shift+esc). + */ +// #define GRAVE_ESC_CTRL_OVERRIDE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Magic Key Options + * + * Magic keys are hotkey commands that allow control over firmware functions of + * the keyboard. They are best used in combination with the HID Listen program, + * found here: https://www.pjrc.com/teensy/hid_listen.html + * + * The options below allow the magic key functionality to be changed. This is + * useful if your keyboard/keypad is missing keys and you want magic key support. + * + */ + +/* disable these deprecated features by default */ +#ifndef LINK_TIME_OPTIMIZATION_ENABLE + #define NO_ACTION_MACRO + #define NO_ACTION_FUNCTION +#endif diff --git a/keyboards/mc_76k/info.json b/keyboards/mc_76k/info.json new file mode 100644 index 0000000000..482caa1c48 --- /dev/null +++ b/keyboards/mc_76k/info.json @@ -0,0 +1,12 @@ +{ + "keyboard_name": "mc_76k", + "url": "www.yiancar-designs.com", + "maintainer": "Yiancar", + "width": 15, + "height": 6.5, + "layouts": { + "LAYOUT_all": { + "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":1.25, "y":0}, {"label":"F2", "x":2.25, "y":0}, {"label":"F3", "x":3.25, "y":0}, {"label":"F4", "x":4.25, "y":0}, {"label":"F5", "x":5.5, "y":0}, {"label":"F6", "x":6.5, "y":0}, {"label":"F7", "x":7.5, "y":0}, {"label":"F8", "x":8.5, "y":0}, {"label":"F9", "x":9.75, "y":0}, {"label":"F10", "x":10.75, "y":0}, {"label":"F11", "x":11.75, "y":0}, {"label":"F12", "x":12.75, "y":0}, {"label":"F13", "x":14, "y":0}, {"label":"~", "x":0, "y":1.5}, {"label":"!", "x":1, "y":1.5}, {"label":"@", "x":2, "y":1.5}, {"label":"#", "x":3, "y":1.5}, {"label":"$", "x":4, "y":1.5}, {"label":"%", "x":5, "y":1.5}, {"label":"^", "x":6, "y":1.5}, {"label":"&", "x":7, "y":1.5}, {"label":"*", "x":8, "y":1.5}, {"label":"(", "x":9, "y":1.5}, {"label":")", "x":10, "y":1.5}, {"label":"_", "x":11, "y":1.5}, {"label":"+", "x":12, "y":1.5}, {"label":"|", "x":13, "y":1.5}, {"label":"Delete", "x":14, "y":1.5}, {"label":"Tab", "x":0, "y":2.5, "w":1.5}, {"label":"Q", "x":1.5, "y":2.5}, {"label":"W", "x":2.5, "y":2.5}, {"label":"E", "x":3.5, "y":2.5}, {"label":"R", "x":4.5, "y":2.5}, {"label":"T", "x":5.5, "y":2.5}, {"label":"Y", "x":6.5, "y":2.5}, {"label":"U", "x":7.5, "y":2.5}, {"label":"I", "x":8.5, "y":2.5}, {"label":"O", "x":9.5, "y":2.5}, {"label":"P", "x":10.5, "y":2.5}, {"label":"{", "x":11.5, "y":2.5}, {"label":"}", "x":12.5, "y":2.5}, {"label":"Backspace", "x":13.5, "y":2.5, "w":1.5}, {"label":"Ctrl", "x":0, "y":3.5, "w":1.75}, {"label":"A", "x":1.75, "y":3.5}, {"label":"S", "x":2.75, "y":3.5}, {"label":"D", "x":3.75, "y":3.5}, {"label":"F", "x":4.75, "y":3.5}, {"label":"G", "x":5.75, "y":3.5}, {"label":"H", "x":6.75, "y":3.5}, {"label":"J", "x":7.75, "y":3.5}, {"label":"K", "x":8.75, "y":3.5}, {"label":"L", "x":9.75, "y":3.5}, {"label":":", "x":10.75, "y":3.5}, {"label":"\"", "x":11.75, "y":3.5}, {"label":"Enter", "x":12.75, "y":3.5, "w":2.25}, {"label":"Shift", "x":0, "y":4.5, "w":2.25}, {"label":"Z", "x":2.25, "y":4.5}, {"label":"X", "x":3.25, "y":4.5}, {"label":"C", "x":4.25, "y":4.5}, {"label":"V", "x":5.25, "y":4.5}, {"label":"B", "x":6.25, "y":4.5}, {"label":"N", "x":7.25, "y":4.5}, {"label":"M", "x":8.25, "y":4.5}, {"label":"<", "x":9.25, "y":4.5}, {"label":">", "x":10.25, "y":4.5}, {"label":"?", "x":11.25, "y":4.5}, {"label":"Shift", "x":12.25, "y":4.5, "w":1.75}, {"label":"Fn", "x":14, "y":4.5}, {"label":"Caps Lock", "x":0, "y":5.5, "w":1.5}, {"label":"Win", "x":1.5, "y":5.5}, {"label":"Alt", "x":2.5, "y":5.5, "w":1.5}, {"x":4, "y":5.5, "w":7}, {"label":"Alt", "x":11, "y":5.5, "w":1.5}, {"label":"Win", "x":12.5, "y":5.5}, {"label":"Ctrl", "x":13.5, "y":5.5, "w":1.5}] + } + } +}
\ No newline at end of file diff --git a/keyboards/mc_76k/keymaps/default/keymap.c b/keyboards/mc_76k/keymaps/default/keymap.c new file mode 100644 index 0000000000..bf572d3c6e --- /dev/null +++ b/keyboards/mc_76k/keymaps/default/keymap.c @@ -0,0 +1,50 @@ +/* Copyright 2020 Yiancar-Designs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_all( /* Base */ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_F13, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_DEL, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1), + KC_CAPS, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL), + + [1] = LAYOUT_all( /* FN1 */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_UP, KC_END, KC_TRNS, + KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, + KC_LCTL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + + [2] = LAYOUT_all( /* Empty for dynamic keymaps */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + + [3] = LAYOUT_all( /* Empty for dynamic keymaps */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), +}; diff --git a/keyboards/mc_76k/keymaps/default/readme.md b/keyboards/mc_76k/keymaps/default/readme.md new file mode 100644 index 0000000000..cfca7e7ec6 --- /dev/null +++ b/keyboards/mc_76k/keymaps/default/readme.md @@ -0,0 +1,5 @@ +# The default keymap for MC-76K + +![DEFAULT](https://i.imgur.com/GzUITtG.png) + +![FN1](https://i.imgur.com/ytnKmxg.png)
\ No newline at end of file diff --git a/keyboards/mc_76k/keymaps/via/keymap.c b/keyboards/mc_76k/keymaps/via/keymap.c new file mode 100644 index 0000000000..bf572d3c6e --- /dev/null +++ b/keyboards/mc_76k/keymaps/via/keymap.c @@ -0,0 +1,50 @@ +/* Copyright 2020 Yiancar-Designs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_all( /* Base */ + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_F13, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_DEL, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1), + KC_CAPS, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_RCTL), + + [1] = LAYOUT_all( /* FN1 */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_UP, KC_END, KC_TRNS, + KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, + KC_LCTL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + + [2] = LAYOUT_all( /* Empty for dynamic keymaps */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + + [3] = LAYOUT_all( /* Empty for dynamic keymaps */ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), +}; diff --git a/keyboards/mc_76k/keymaps/via/readme.md b/keyboards/mc_76k/keymaps/via/readme.md new file mode 100644 index 0000000000..b82bc8e79f --- /dev/null +++ b/keyboards/mc_76k/keymaps/via/readme.md @@ -0,0 +1 @@ +# Compile with this keymap to use VIA diff --git a/keyboards/mc_76k/keymaps/via/rules.mk b/keyboards/mc_76k/keymaps/via/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/mc_76k/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/mc_76k/mc_76k.c b/keyboards/mc_76k/mc_76k.c new file mode 100644 index 0000000000..0ca4c80ba4 --- /dev/null +++ b/keyboards/mc_76k/mc_76k.c @@ -0,0 +1,34 @@ +/* Copyright 2020 Yiancar-Designs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "mc_76k.h" + +void keyboard_pre_init_kb (void) { + setPinOutput(D2); +} + +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if(res) { + // writePin sets the pin high for 1 and low for 0. + // In this example the pins are inverted, setting + // it low/0 turns it on, and high/1 turns the LED off. + // This behavior depends on whether the LED is between the pin + // and VCC or the pin and GND. + writePin(D2, !led_state.caps_lock); + } + return res; +} diff --git a/keyboards/mc_76k/mc_76k.h b/keyboards/mc_76k/mc_76k.h new file mode 100644 index 0000000000..6b9a5e9617 --- /dev/null +++ b/keyboards/mc_76k/mc_76k.h @@ -0,0 +1,46 @@ +/* Copyright 2020 Yiancar-Designs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +#define XXX KC_NO + +#include "quantum.h" + +/* This is a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ +#define LAYOUT_all( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K3C, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, \ + K40, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, \ + K50, K52, K53, K57, K5B, K5C, K5D \ +) \ +{ \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D }, \ + { K40, XXX, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D }, \ + { K50, XXX, K52, K53, XXX, XXX, XXX, K57, XXX, XXX, XXX, K5B, K5C, K5D } \ +} diff --git a/keyboards/mc_76k/readme.md b/keyboards/mc_76k/readme.md new file mode 100644 index 0000000000..be9b5c5ec6 --- /dev/null +++ b/keyboards/mc_76k/readme.md @@ -0,0 +1,15 @@ +# MC-76K + +![mc_76k](https://geekhack.org/index.php?action=dlattach;topic=101040.0;attach=220476;image) + +O-Ring suspended 60% with F-row keyboard + +* Keyboard Maintainer: [Yiancar](http://yiancar-designs.com/) and on [github](https://github.com/yiancar) +* Hardware Supported: ATmega32U4 +* Hardware Availability: GB run by [mustcode](https://www.reddit.com/user/mustcode). More info on [geekhack](https://geekhack.org/index.php?topic=101040.50) + +Make example for this keyboard (after setting up your build environment): + + make mc_76k:default + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/mc_76k/rules.mk b/keyboards/mc_76k/rules.mk new file mode 100644 index 0000000000..5f109c654b --- /dev/null +++ b/keyboards/mc_76k/rules.mk @@ -0,0 +1,32 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = no # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +MIDI_ENABLE = no # MIDI support +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches +HD44780_ENABLE = no # Enable support for HD44780 based LCDs diff --git a/keyboards/minidox/keymaps/xyverz/keymap.c b/keyboards/minidox/keymaps/xyverz/keymap.c index 994ee4e1b4..4c7a05227f 100644 --- a/keyboards/minidox/keymaps/xyverz/keymap.c +++ b/keyboards/minidox/keymaps/xyverz/keymap.c @@ -169,9 +169,7 @@ void matrix_init_user(void) { #ifdef BOOTLOADER_CATERINA // This will disable the red LEDs on the ProMicros setPinInput(D5); - writePinLow(D5); setPinInput(B0); - writePinLow(B0); #endif }; @@ -192,4 +190,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } return true; -}
\ No newline at end of file +} diff --git a/keyboards/mxss/config.h b/keyboards/mxss/config.h index 812f301d6f..264caec970 100644 --- a/keyboards/mxss/config.h +++ b/keyboards/mxss/config.h @@ -21,12 +21,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "config_common.h" /* USB Device descriptor parameter */ -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x6060 +#define VENDOR_ID 0x4D78 // "Mx" -> MxBlue +#define PRODUCT_ID 0x5353 // "SS" -> MxSS #define DEVICE_VER 0x0001 #define MANUFACTURER MxBlue #define PRODUCT MxSS -#define DESCRIPTION Custom Polycarb Keyboard +#define DESCRIPTION MxSS Polycarb Keyboard /* key matrix size */ #define MATRIX_ROWS 5 @@ -56,6 +56,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* Locking resynchronize hack */ #define LOCKING_RESYNC_ENABLE +// Just for posterity, define bootlite matrix pos +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 + +// FLED config takes up 1 byte, stored color count takes 1, stored colors take up to 8 +#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 10 + /* If defined, GRAVE_ESC will always act as ESC when CTRL is held. * This is userful for the Windows task manager shortcut (ctrl+shift+esc). */ diff --git a/keyboards/mxss/keymaps/default/keymap.c b/keyboards/mxss/keymaps/default/keymap.c index 17cebe0c8f..b69d91df9d 100644 --- a/keyboards/mxss/keymaps/default/keymap.c +++ b/keyboards/mxss/keymaps/default/keymap.c @@ -15,31 +15,32 @@ */ #include QMK_KEYBOARD_H +hs_set caps_color = { .hue = 0, .sat = 255 }; + // Colors for layers // Format: {hue, saturation} // {0, 0} to turn off the LED // Add additional rows to handle more layers -const hs_set layer_colors[] = { - [0] = {0, 0}, // Color for Layer 0 - [1] = {86, 255}, // Color for Layer 1 - [2] = {36, 255}, // Color for Layer 2 - [3] = {185, 255}, // Color for Layer 3 +hs_set layer_colors[4] = { + [0] = {.hue = 0, .sat = 0}, // Color for Layer 0 + [1] = {.hue = 86, .sat = 255}, // Color for Layer 1 + [2] = {.hue = 36, .sat = 255}, // Color for Layer 2 + [3] = {.hue = 185, .sat = 255}, // Color for Layer 3 }; -const size_t lc_size = sizeof(layer_colors) / sizeof(uint16_t); +size_t lc_size = sizeof(layer_colors) / sizeof(uint16_t); // Use NEW_SAFE_RANGE to define new custom keycodes in order to not overwrite the ones used for front LED control enum custom_keycodes { - MY_KEYCODE = NEW_SAFE_RANGE, + MY_KEYCODE = NEW_SAFE_RANGE, }; - const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LAYOUT( /* Base */ KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_CAPSLOCK, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT + KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT ), LAYOUT( /* L1 */ diff --git a/keyboards/mxss/keymaps/via/config.h b/keyboards/mxss/keymaps/via/config.h new file mode 100644 index 0000000000..7451a7be4f --- /dev/null +++ b/keyboards/mxss/keymaps/via/config.h @@ -0,0 +1,19 @@ +/* Copyright 2018 Jumail Mundekkat / MxBlue + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +#define LAYER_STATE_8BIT diff --git a/keyboards/mxss/keymaps/via/keymap.c b/keyboards/mxss/keymaps/via/keymap.c new file mode 100644 index 0000000000..34e40592a6 --- /dev/null +++ b/keyboards/mxss/keymaps/via/keymap.c @@ -0,0 +1,33 @@ +/* Copyright 2018 Jumail Mundekkat / MxBlue + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + LAYOUT_all( /* L0 */ + KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_NO, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, + KC_CAPSLOCK, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NO, KC_ENT, KC_PGUP, + KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_SPACE, KC_SPACE, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT + ), + LAYOUT_all( /* L1 */ + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS, + KC_TRNS, KC_MPLY, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PSCR, FLED_VAD, FLED_VAI, FLED_MOD, RGB_VAI, + RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_VAD, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, RGB_MOD, RGB_SAI, RGB_TOG, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RGB_HUD, RGB_SAD, RGB_HUI + ) +}; diff --git a/keyboards/mxss/keymaps/via/rules.mk b/keyboards/mxss/keymaps/via/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/mxss/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/mxss/mxss.c b/keyboards/mxss/mxss.c index 42ecdbc469..48ea466419 100644 --- a/keyboards/mxss/mxss.c +++ b/keyboards/mxss/mxss.c @@ -1,4 +1,4 @@ -/* Copyright 2018 Jumail Mundekkat / MxBlue +/* Copyright 2020 Jumail Mundekkat / MxBlue * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -12,63 +12,29 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * EEPROM management code from ../cannonkeys/stm32f072/keyboard.c */ - + #include QMK_KEYBOARD_H #include "tmk_core/common/eeprom.h" #include "tmk_core/common/action_layer.h" #include "rgblight.h" +#include "via.h" +#include "version.h" // for QMK_BUILDDATE used in EEPROM magic -// Variables for controlling front LED application -uint8_t fled_mode; // Mode for front LEDs -uint8_t fled_val; // Brightness for front leds (0 - 255) -LED_TYPE fleds[2]; // Front LED rgb values for indicator mode use - -// Predefined colors for layers -// Format: {hue, saturation} -// {0, 0} to turn off the LED -// Add additional rows to handle more layers -__attribute__ ((weak)) -const hs_set layer_colors[] = { - [0] = {0, 0}, // Color for Layer 0 - [1] = {86, 255}, // Color for Layer 1 - [2] = {36, 255}, // Color for Layer 2 - [3] = {185, 255}, // Color for Layer 3 -}; - -__attribute__ ((weak)) -const size_t lc_size = sizeof(layer_colors) / sizeof(uint16_t); +void via_init_kb(void) { + fled_init(); +} void matrix_init_kb(void) { - // If EEPROM config exists, load it - if (eeprom_is_valid()) { - fled_config fled_conf; - fled_conf.raw = eeprom_read_byte(EEPROM_FRONTLED_ADDR); - fled_mode = fled_conf.mode; - fled_val = fled_conf.val * FLED_VAL_STEP; - // Else, default config - } else { - fled_mode = FLED_RGB; - fled_val = 10 * FLED_VAL_STEP; - eeprom_update_conf(); // Store default config to EEPROM - } - - // Set default values for leds - setrgb(0, 0, 0, &fleds[0]); - setrgb(0, 0, 0, &fleds[1]); - - // Handle lighting for indicator mode - if (fled_mode == FLED_INDI) { - // Enable capslock led if enabled on host - if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) - sethsv(FLED_CAPS_H, FLED_CAPS_S, fled_val, &fleds[0]); - - // Determine and set colour of layer LED according to current layer - // if hue = sat = 0, leave LED off - uint8_t layer = biton32(layer_state); - if (layer < lc_size && !(layer_colors[layer].hue == 0 && layer_colors[layer].hue == 0)) - sethsv(layer_colors[layer].hue, layer_colors[layer].sat, fled_val, &fleds[1]); - } + // If VIA is disabled, we still need to load settings + // Call via_init_kb() the same way as via_init(), with setting + // EEPROM valid afterwards. +#ifndef VIA_ENABLE + fled_init(); + via_eeprom_set_valid(true); +#endif // VIA_ENABLE matrix_init_user(); } @@ -82,132 +48,35 @@ void matrix_scan_kb(void) { bool process_record_kb(uint16_t keycode, keyrecord_t *record) { // Handle custom keycodes for front LED operation - switch (keycode) { - case FLED_MOD: // Change between front LED operation modes (off, indicator, RGB) - if (record->event.pressed) - fled_mode_cycle(); - break; - - case FLED_VAI: // Increase the brightness of the front LEDs by FLED_VAL_STEP - if (record->event.pressed) - fled_val_increase(); - break; - - case FLED_VAD: // Decrease the brightness of the front LEDs by FLED_VAL_STEP - if (record->event.pressed) - fled_val_decrease(); - break; - - default: - break; // Process all other keycodes normally - } - + process_record_fled(keycode, record); return process_record_user(keycode, record); } -void led_set_kb(uint8_t usb_led) { - // Set indicator LED appropriately, whether it is used or not - if (usb_led & (1 << USB_LED_CAPS_LOCK)) { - sethsv(FLED_CAPS_H, FLED_CAPS_S, fled_val, &fleds[0]); - } else { - setrgb(0, 0, 0, &fleds[0]); - } - - rgblight_set(); - led_set_user(usb_led); -} - -uint32_t layer_state_set_kb(uint32_t state) { - // Determine and set colour of layer LED according to current layer - // if hue = sat = 0, leave LED off - uint8_t layer = biton32(state); - - if (layer < lc_size && !(layer_colors[layer].hue == 0 && layer_colors[layer].hue == 0)) - sethsv(layer_colors[layer].hue, layer_colors[layer].sat, fled_val, &fleds[1]); - else - setrgb(0, 0, 0, &fleds[1]); - - return state; -} - -// EEPROM Management - -// Test if magic value is present at expected location -bool eeprom_is_valid(void) -{ - return (eeprom_read_word(EEPROM_MAGIC_ADDR) == EEPROM_MAGIC); -} - -// Set magic value at expected location -void eeprom_set_valid(bool valid) -{ - eeprom_update_word(EEPROM_MAGIC_ADDR, valid ? EEPROM_MAGIC : 0xFFFF); +bool led_update_kb(led_t led_state) { + fled_lock_update(led_state); + return led_update_user(led_state); } -// Store current front led config in EEPROM -void eeprom_update_conf(void) -{ - // Create storage struct and set values - fled_config conf; - conf.mode = fled_mode; - - // Small hack to ensure max value is stored correctly - if (fled_val == 255) - conf.val = 256 / FLED_VAL_STEP; - else - conf.val = fled_val / FLED_VAL_STEP; - - // Set magic value and store config - eeprom_set_valid(true); - eeprom_update_byte(EEPROM_FRONTLED_ADDR, conf.raw); +layer_state_t layer_state_set_kb(layer_state_t state) { + fled_layer_update(state); + return layer_state_set_user(state); } -// Custom keycode functions +// Fallback eeprom functions if VIA is not enabled +#ifndef VIA_ENABLE -void fled_mode_cycle(void) +// Sets VIA/keyboard level usage of EEPROM to valid/invalid +// Keyboard level code (eg. via_init_kb()) should not call this +void via_eeprom_set_valid(bool valid) { - // FLED -> FLED_RGB -> FLED_INDI - switch (fled_mode) { - case FLED_OFF: - fled_mode = FLED_RGB; - break; - - case FLED_RGB: - fled_mode = FLED_INDI; - break; - - case FLED_INDI: - fled_mode = FLED_OFF; - break; - } - - // Update stored config - eeprom_update_conf(); - rgblight_set(); + char *p = QMK_BUILDDATE; // e.g. "2019-11-05-11:29:54" + uint8_t magic0 = ( ( p[2] & 0x0F ) << 4 ) | ( p[3] & 0x0F ); + uint8_t magic1 = ( ( p[5] & 0x0F ) << 4 ) | ( p[6] & 0x0F ); + uint8_t magic2 = ( ( p[8] & 0x0F ) << 4 ) | ( p[9] & 0x0F ); + + eeprom_update_byte( (void*)VIA_EEPROM_MAGIC_ADDR+0, valid ? magic0 : 0xFF); + eeprom_update_byte( (void*)VIA_EEPROM_MAGIC_ADDR+1, valid ? magic1 : 0xFF); + eeprom_update_byte( (void*)VIA_EEPROM_MAGIC_ADDR+2, valid ? magic2 : 0xFF); } -void fled_val_increase(void) -{ - // Increase val by FLED_VAL_STEP, handling the upper edge case - if (fled_val + FLED_VAL_STEP > 255) - fled_val = 255; - else - fled_val += FLED_VAL_STEP; - - // Update stored config - eeprom_update_conf(); - rgblight_set(); -} - -void fled_val_decrease(void) -{ - // Decrease val by FLED_VAL_STEP, handling the lower edge case - if (fled_val - FLED_VAL_STEP > 255) - fled_val = 255; - else - fled_val -= FLED_VAL_STEP; - - // Update stored config - eeprom_update_conf(); - rgblight_set(); -} +#endif diff --git a/keyboards/mxss/mxss.h b/keyboards/mxss/mxss.h index 3572a19cdb..4074d411cc 100644 --- a/keyboards/mxss/mxss.h +++ b/keyboards/mxss/mxss.h @@ -13,8 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef MXSS_H -#define MXSS_H +#pragma once #include "quantum.h" #include "mxss_frontled.h" @@ -204,4 +203,18 @@ { k40, k41, k42, k43, KC_NO, KC_NO, k46, KC_NO, k48, KC_NO, k4A, k4B, k4C, k4D, k4E }, \ } -#endif +// All the gubs +#define LAYOUT_all( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E, \ + k40, k41, k42, k43, k46, k48, k4A, k4B, k4C, k4D, k4E \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, k0E }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, k1E }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B, k2C, k2D, k2E }, \ + { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, k3E }, \ + { k40, k41, k42, k43, KC_NO, KC_NO, k46, KC_NO, k48, KC_NO, k4A, k4B, k4C, k4D, k4E }, \ +} diff --git a/keyboards/mxss/mxss_frontled.c b/keyboards/mxss/mxss_frontled.c new file mode 100644 index 0000000000..3f19747d28 --- /dev/null +++ b/keyboards/mxss/mxss_frontled.c @@ -0,0 +1,264 @@ +/* Copyright 2020 Jumail Mundekkat / MxBlue + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Extended from the work done by fcoury: https://github.com/qmk/qmk_firmware/pull/4915 + */ + +#include "mxss_frontled.h" +#include "tmk_core/common/eeprom.h" +#include "rgblight.h" +#include "via.h" +#include "version.h" // for QMK_BUILDDATE used in EEPROM magic + +// Variables for controlling front LED application +uint8_t fled_mode; // Mode for front LEDs +uint8_t fled_val; // Brightness for front leds (0 - 255) +LED_TYPE fleds[2]; // Front LED rgb values for indicator mode use + +// Layer indicator colors +__attribute__ ((weak)) +hs_set layer_colors[FRONTLED_COLOR_MAXCNT]; + +// Caps lock indicator color +__attribute__ ((weak)) +hs_set caps_color; + +__attribute__ ((weak)) +size_t lc_size = sizeof(layer_colors) / sizeof(hs_set); + +void fled_init(void) { + // If EEPROM config exists, load it + // If VIA EEPROM exists, FLED config should too + if (via_eeprom_is_valid()) { + fled_load_conf(); + // Else, default config + } else { + // Default mode/brightness + fled_mode = FLED_RGB; + fled_val = 10 * FLED_VAL_STEP; + + // Default colors + caps_color.hue = 0; + caps_color.sat = 255; + layer_colors[0].hue = 0; + layer_colors[0].sat = 0; + layer_colors[1].hue = 86; + layer_colors[1].sat = 255; + layer_colors[2].hue = 36; + layer_colors[2].sat = 255; + layer_colors[3].hue = 185; + layer_colors[3].sat = 255; + + fled_update_conf(); // Store default config to EEPROM + } + + // Set default values for leds + setrgb(0, 0, 0, &fleds[0]); + setrgb(0, 0, 0, &fleds[1]); + + // Handle lighting for indicator mode + if (fled_mode == FLED_INDI) { + fled_lock_update(host_keyboard_led_state()); + fled_layer_update(layer_state); + } +} + +void process_record_fled(uint16_t keycode, keyrecord_t *record) { + // Handle custom keycodes for front LED operation + switch (keycode) { + case FLED_MOD: // Change between front LED operation modes (off, indicator, RGB) + if (record->event.pressed) + fled_mode_cycle(); + break; + + case FLED_VAI: // Increase the brightness of the front LEDs by FLED_VAL_STEP + if (record->event.pressed) + fled_val_increase(); + break; + + case FLED_VAD: // Decrease the brightness of the front LEDs by FLED_VAL_STEP + if (record->event.pressed) + fled_val_decrease(); + break; + + default: + break; // Process all other keycodes normally + } + + return; +} + +void fled_load_conf(void) { + // Load config + fled_config fled_conf; + fled_conf.raw = eeprom_read_byte(FRONTLED_CONF_ADDR); + fled_mode = fled_conf.mode; + fled_val = fled_conf.val * FLED_VAL_STEP; + + // Load color data + uint8_t stored_cnt = eeprom_read_byte(FRONTLED_COLOR_CNT_ADDR); + uint16_t *color_ptr = FRONTLED_COLOR_ADDR; + caps_color.raw = eeprom_read_word(color_ptr); // Should always store at least 1 color + for (uint8_t i = 1; i < stored_cnt; i++) { + if (i == lc_size) // Can't load more layers than we have available + break; + layer_colors[i].raw = eeprom_read_word(&color_ptr[i]); + } + layer_colors[0].raw = 0; // hue = sat = 0 for layer 0 +} + +// Store current front led config in EEPROM +void fled_update_conf(void) +{ + // Create storage struct and set values + fled_config conf; + conf.mode = fled_mode; + + // Small hack to ensure max value is stored correctly + if (fled_val == 255) + conf.val = 256 / FLED_VAL_STEP; + else + conf.val = fled_val / FLED_VAL_STEP; + + // Store config + eeprom_update_byte(FRONTLED_CONF_ADDR, conf.raw); + + // Store color data + uint16_t *color_ptr = FRONTLED_COLOR_ADDR; + eeprom_update_word(color_ptr, caps_color.raw); + // Start from 1, layer 0 is not modifiable and therefore not persisted + uint8_t i = 1; + for (; i < lc_size; i++) { + if (i == FRONTLED_COLOR_MAXCNT) // Can't store more than the EEPROM we have available + break; + eeprom_update_word(&color_ptr[i], layer_colors[i].raw); + } + eeprom_update_byte(FRONTLED_COLOR_CNT_ADDR, i); // For safety, store the count of colors stored +} + +// Custom keycode functions + +void fled_mode_cycle(void) +{ + // FLED -> FLED_RGB -> FLED_INDI + switch (fled_mode) { + case FLED_OFF: + fled_mode = FLED_RGB; + rgblight_timer_enable(); + break; + + case FLED_RGB: + fled_mode = FLED_INDI; + break; + + case FLED_INDI: + fled_mode = FLED_OFF; + break; + } + + // Update stored config + fled_update_conf(); + rgblight_set(); +} + +void fled_val_increase(void) +{ + // Increase val by FLED_VAL_STEP, handling the upper edge case + if (fled_val + FLED_VAL_STEP > 255) + fled_val = 255; + else + fled_val += FLED_VAL_STEP; + + // Update stored config + fled_update_conf(); + rgblight_set(); +} + +void fled_val_decrease(void) +{ + // Decrease val by FLED_VAL_STEP, handling the lower edge case + if (fled_val - FLED_VAL_STEP > 255) + fled_val = 255; + else + fled_val -= FLED_VAL_STEP; + + // Update stored config + fled_update_conf(); + rgblight_set(); +} + +void fled_layer_update(layer_state_t state) { + // Determine and set colour of layer LED according to current layer + // if hue = sat = 0, leave LED off + uint8_t layer = get_highest_layer(state); + + if (layer < lc_size && !(layer_colors[layer].hue == 0 && layer_colors[layer].sat == 0)) { + sethsv(layer_colors[layer].hue, layer_colors[layer].sat, fled_val, &fleds[1]); + } else { + setrgb(0, 0, 0, &fleds[1]); + } +} + +void fled_lock_update(led_t led_state) { + // Set indicator LED appropriately, whether it is used or not + if (led_state.caps_lock) { + sethsv(caps_color.hue, caps_color.sat, fled_val, &fleds[0]); + } else { + setrgb(0, 0, 0, &fleds[0]); + } + + rgblight_set(); +} + +void set_fled_layer_color(uint8_t layer, hs_set hs) { + // Update layer colors and refresh LEDs + layer_colors[layer] = hs; + fled_layer_update(layer_state); + fled_update_conf(); +} + +hs_set get_fled_layer_color(uint8_t layer) { + return layer_colors[layer]; +} + +void set_fled_caps_color(hs_set hs) { + // Update caplock color and refresh LEDs + caps_color = hs; + fled_lock_update(host_keyboard_led_state()); + fled_update_conf(); +} + +hs_set get_fled_caps_color(void) { + return caps_color; +} + +// Fallback eeprom functions if VIA is not enabled +#ifndef VIA_ENABLE + +// Can be called in an overriding via_init_kb() to test if keyboard level code usage of +// EEPROM is invalid and use/save defaults. +bool via_eeprom_is_valid(void) +{ + char *p = QMK_BUILDDATE; // e.g. "2019-11-05-11:29:54" + uint8_t magic0 = ( ( p[2] & 0x0F ) << 4 ) | ( p[3] & 0x0F ); + uint8_t magic1 = ( ( p[5] & 0x0F ) << 4 ) | ( p[6] & 0x0F ); + uint8_t magic2 = ( ( p[8] & 0x0F ) << 4 ) | ( p[9] & 0x0F ); + + return (eeprom_read_byte( (void*)VIA_EEPROM_MAGIC_ADDR+0 ) == magic0 && + eeprom_read_byte( (void*)VIA_EEPROM_MAGIC_ADDR+1 ) == magic1 && + eeprom_read_byte( (void*)VIA_EEPROM_MAGIC_ADDR+2 ) == magic2 ); +} + +#endif diff --git a/keyboards/mxss/mxss_frontled.h b/keyboards/mxss/mxss_frontled.h index 1350266ba9..3660668655 100644 --- a/keyboards/mxss/mxss_frontled.h +++ b/keyboards/mxss/mxss_frontled.h @@ -1,4 +1,4 @@ -/* Copyright 2018 Jumail Mundekkat / MxBlue +/* Copyright 2020 Jumail Mundekkat / MxBlue * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,11 +16,12 @@ // EEPROM management code taken from Wilba6582 // https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/zeal_eeprom.h - -#ifndef MXSS_FRONTLED_H -#define MXSS_FRONTLED_H +#pragma once + +#include "quantum.h" #include "quantum_keycodes.h" +#include "via.h" // RGBLED index for front LEDs #define RGBLIGHT_FLED1 14 @@ -29,13 +30,13 @@ // Brightness increase step for front LEDs #define FLED_VAL_STEP 8 -// QMK never uses more then 32bytes of EEPROM, so our region starts there -// Magic value to verify the state of the EEPROM -#define EEPROM_MAGIC 0xC3E7 -#define EEPROM_MAGIC_ADDR ((void*)32) - // Front LED settings -#define EEPROM_FRONTLED_ADDR ((void*)34) +#define FRONTLED_CONF_ADDR ((uint8_t*) VIA_EEPROM_CUSTOM_CONFIG_ADDR) +#define FRONTLED_COLOR_CNT_ADDR (FRONTLED_CONF_ADDR + 1) +#define FRONTLED_COLOR_ADDR ((uint16_t*)(FRONTLED_COLOR_CNT_ADDR + 1)) + +// No point persisting more 4, VIA only allows editing of 3 + 1 for caps +#define FRONTLED_COLOR_MAXCNT 4 // Modes for front LEDs #define FLED_OFF 0b00 @@ -43,10 +44,6 @@ #define FLED_RGB 0b10 #define FLED_UNDEF 0b11 -// Hard-coded color for capslock indicator in FLED_INDI mode, H:0% S:100% = Red -#define FLED_CAPS_H 0 -#define FLED_CAPS_S 255 - // Config storage format for EEPROM typedef union { uint8_t raw; @@ -57,25 +54,35 @@ typedef union { } fled_config; // Structure to store hue and saturation values -typedef struct _hs_set { - uint16_t hue; - uint8_t sat; +typedef union { + uint16_t raw; + struct { + uint8_t hue; + uint8_t sat; + }; } hs_set; // Custom keycodes for front LED control enum fled_keycodes { - FLED_MOD = SAFE_RANGE, - FLED_VAI, - FLED_VAD, - NEW_SAFE_RANGE // define a new safe range + FLED_MOD = USER00, // USER00 = VIA custom keycode start + FLED_VAI, + FLED_VAD, + NEW_SAFE_RANGE // define a new safe range }; -bool eeprom_is_valid(void); // Check if EEPROM has been set up -void eeprom_set_valid(bool valid); // Change validity state of EEPROM -void eeprom_update_conf(void); // Store current front LED config to EEPROM +void fled_init(void); // Run init functions for front LEDs +void process_record_fled(uint16_t keycode, keyrecord_t* record); // Process keycodes for front LEDs +void fled_load_conf(void); // Load front LED config from EEPROM +void fled_update_conf(void); // Store current front LED config to EEPROM void fled_mode_cycle(void); // Cycle between the 3 modes for the front LEDs void fled_val_increase(void); // Increase the brightness of the front LEDs void fled_val_decrease(void); // Decrease the brightness of the front LEDs -#endif //MXSS_FRONTLED_H
\ No newline at end of file +void fled_layer_update(layer_state_t state); // Process layer update for front LEDs +void fled_lock_update(led_t led_state); // Process lock update for front LEDs + +void set_fled_layer_color(uint8_t layer, hs_set hs); // Set color for a given layer +void set_fled_caps_color(hs_set hs); // Set color for the capslock indicator +hs_set get_fled_caps_color(void); // Get color for the capslock indicator +hs_set get_fled_layer_color(uint8_t layer); // Get color for a given layer diff --git a/keyboards/mxss/readme.md b/keyboards/mxss/readme.md index 181b6366a0..f35709adee 100644 --- a/keyboards/mxss/readme.md +++ b/keyboards/mxss/readme.md @@ -2,6 +2,11 @@ ![MxSS - Polycarb 65% Kit for MX/SMK](https://i.imgur.com/WDTWcmU.jpg) +### Important Note: +**This PCB supports the VIA configurator, and this is the recommended way to configure the keymap on this keyboard. Building the firmware should only be necessary if you would like to change the colours of the front LEDs in indicator mode.** + +**For more information about the VIA configurator, [see here](https://caniusevia.com/).** + ### Information: - Case: Frosted Polycarbonate, CNC milled @@ -51,4 +56,4 @@ Colors for FLED_INDI mode are hardcoded as hue/saturation values, the caps lock # Further Notes - As SAFE_RANGE is used for defining the custom keycodes seen above, please use NEW_SAFE_RANGE as the starting value for any custom keycodes in keymap.c, as per the example.
\ No newline at end of file + As SAFE_RANGE is used for defining the custom keycodes seen above, please use NEW_SAFE_RANGE as the starting value for any custom keycodes in keymap.c, as per the example. diff --git a/keyboards/mxss/rgblight.c b/keyboards/mxss/rgblight.c index 73f94f3ab0..9e17510b59 100644 --- a/keyboards/mxss/rgblight.c +++ b/keyboards/mxss/rgblight.c @@ -14,814 +14,1166 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <math.h> -#include <avr/eeprom.h> -#include <avr/interrupt.h> -#include <util/delay.h> +#include <string.h> +#ifdef __AVR__ +# include <avr/eeprom.h> +# include <avr/interrupt.h> +#endif +#ifdef STM32_EEPROM_ENABLE +# include "hal.h" +# include "eeprom.h" +# include "eeprom_stm32.h" +#endif +#include "wait.h" #include "progmem.h" #include "timer.h" #include "rgblight.h" +#include "color.h" #include "debug.h" #include "led_tables.h" +#include "lib/lib8tion/lib8tion.h" +#ifdef VELOCIKEY_ENABLE +# include "velocikey.h" +#endif +// MxSS custom #include "mxss_frontled.h" -#ifndef RGBLIGHT_LIMIT_VAL -#define RGBLIGHT_LIMIT_VAL 255 +#ifdef RGBLIGHT_SPLIT +/* for split keyboard */ +# define RGBLIGHT_SPLIT_SET_CHANGE_MODE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_MODE +# define RGBLIGHT_SPLIT_SET_CHANGE_HSVS rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_HSVS +# define RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS rgblight_status.change_flags |= (RGBLIGHT_STATUS_CHANGE_MODE | RGBLIGHT_STATUS_CHANGE_HSVS) +# define RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_TIMER +# define RGBLIGHT_SPLIT_ANIMATION_TICK rgblight_status.change_flags |= RGBLIGHT_STATUS_ANIMATION_TICK +#else +# define RGBLIGHT_SPLIT_SET_CHANGE_MODE +# define RGBLIGHT_SPLIT_SET_CHANGE_HSVS +# define RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS +# define RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE +# define RGBLIGHT_SPLIT_ANIMATION_TICK #endif -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) - -#define LED_PTRTOIND(ptr) ((uint32_t) (ptr - led)/sizeof(LED_TYPE)) - -void copyrgb(LED_TYPE *src, LED_TYPE *dst); +#define _RGBM_SINGLE_STATIC(sym) RGBLIGHT_MODE_##sym, +#define _RGBM_SINGLE_DYNAMIC(sym) +#define _RGBM_MULTI_STATIC(sym) RGBLIGHT_MODE_##sym, +#define _RGBM_MULTI_DYNAMIC(sym) +#define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_##sym, +#define _RGBM_TMP_DYNAMIC(sym, msym) +static uint8_t static_effect_table[] = { +#include "rgblight_modes.h" +}; + +#define _RGBM_SINGLE_STATIC(sym) RGBLIGHT_MODE_##sym, +#define _RGBM_SINGLE_DYNAMIC(sym) RGBLIGHT_MODE_##sym, +#define _RGBM_MULTI_STATIC(sym) RGBLIGHT_MODE_##sym, +#define _RGBM_MULTI_DYNAMIC(sym) RGBLIGHT_MODE_##sym, +#define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_##msym, +#define _RGBM_TMP_DYNAMIC(sym, msym) RGBLIGHT_MODE_##msym, +static uint8_t mode_base_table[] = { + 0, // RGBLIGHT_MODE_zero +#include "rgblight_modes.h" +}; + +static inline int is_static_effect(uint8_t mode) { return memchr(static_effect_table, mode, sizeof(static_effect_table)) != NULL; } + +#ifdef RGBLIGHT_LED_MAP +const uint8_t led_map[] PROGMEM = RGBLIGHT_LED_MAP; +#endif -__attribute__ ((weak)) -const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5}; -__attribute__ ((weak)) -const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {120, 60, 30}; -__attribute__ ((weak)) -const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20}; -__attribute__ ((weak)) -const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 50, 20}; -__attribute__ ((weak)) -const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63, 31}; -__attribute__ ((weak)) -const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90}; -__attribute__ ((weak)) -const uint16_t RGBLED_RGBTEST_INTERVALS[] PROGMEM = {1024}; +#ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT +__attribute__((weak)) const uint8_t RGBLED_GRADIENT_RANGES[] PROGMEM = {255, 170, 127, 85, 64}; +#endif rgblight_config_t rgblight_config; +rgblight_status_t rgblight_status = {.timer_enabled = false}; +bool is_rgblight_initialized = false; + +#ifdef RGBLIGHT_USE_TIMER +animation_status_t animation_status = {}; +#endif +#ifndef LED_ARRAY LED_TYPE led[RGBLED_NUM]; +# define LED_ARRAY led +#endif -bool rgblight_timer_enabled = false; +static uint8_t clipping_start_pos = 0; +static uint8_t clipping_num_leds = RGBLED_NUM; +static uint8_t effect_start_pos = 0; +static uint8_t effect_end_pos = RGBLED_NUM; +static uint8_t effect_num_leds = RGBLED_NUM; +// MxSS custom extern uint8_t fled_mode; extern uint8_t fled_val; extern LED_TYPE fleds[2]; hs_set fled_hs[2]; -void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) { - uint8_t r = 0, g = 0, b = 0, base, color; - - // if led is front leds, cache the hue and sat values - if (led1 == &led[RGBLIGHT_FLED1]) { - fled_hs[0].hue = hue; - fled_hs[0].sat = sat; - } else if (led1 == &led[RGBLIGHT_FLED2]) { - fled_hs[1].hue = hue; - fled_hs[1].sat = sat; - } +void copyrgb(LED_TYPE *src, LED_TYPE *dst) { + (*dst).r = (*src).r; + (*dst).g = (*src).g; + (*dst).b = (*src).b; +} - if (val > RGBLIGHT_LIMIT_VAL) { - val=RGBLIGHT_LIMIT_VAL; // limit the val - } +void rgblight_set_clipping_range(uint8_t start_pos, uint8_t num_leds) { + clipping_start_pos = start_pos; + clipping_num_leds = num_leds; +} - if (sat == 0) { // Acromatic color (gray). Hue doesn't mind. - r = val; - g = val; - b = val; - } else { - base = ((255 - sat) * val) >> 8; - color = (val - base) * (hue % 60) / 60; - - switch (hue / 60) { - case 0: - r = val; - g = base + color; - b = base; - break; - case 1: - r = val - color; - g = val; - b = base; - break; - case 2: - r = base; - g = val; - b = base + color; - break; - case 3: - r = base; - g = val - color; - b = val; - break; - case 4: - r = base + color; - g = base; - b = val; - break; - case 5: - r = val; - g = base; - b = val - color; - break; - } - } - r = pgm_read_byte(&CIE1931_CURVE[r]); - g = pgm_read_byte(&CIE1931_CURVE[g]); - b = pgm_read_byte(&CIE1931_CURVE[b]); +void rgblight_set_effect_range(uint8_t start_pos, uint8_t num_leds) { + if (start_pos >= RGBLED_NUM) return; + if (start_pos + num_leds > RGBLED_NUM) return; + effect_start_pos = start_pos; + effect_end_pos = start_pos + num_leds; + effect_num_leds = num_leds; +} - setrgb(r, g, b, led1); +void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) { + HSV hsv = {hue, sat, val}; + // MxSS custom + // if led is front leds, cache the hue and sat values + if (led1 == &led[RGBLIGHT_FLED1]) { + fled_hs[0].hue = hue; + fled_hs[0].sat = sat; + } else if (led1 == &led[RGBLIGHT_FLED2]) { + fled_hs[1].hue = hue; + fled_hs[1].sat = sat; + } RGB rgb = hsv_to_rgb(hsv); + setrgb(rgb.r, rgb.g, rgb.b, led1); } +void sethsv(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) { sethsv_raw(hue, sat, val > RGBLIGHT_LIMIT_VAL ? RGBLIGHT_LIMIT_VAL : val, led1); } + void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1) { - (*led1).r = r; - (*led1).g = g; - (*led1).b = b; + (*led1).r = r; + (*led1).g = g; + (*led1).b = b; +#ifdef RGBW + (*led1).w = 0; +#endif } -void copyrgb(LED_TYPE *src, LED_TYPE *dst) { - (*dst).r = (*src).r; - (*dst).g = (*src).g; - (*dst).b = (*src).b; +void rgblight_check_config(void) { + /* Add some out of bound checks for RGB light config */ + + if (rgblight_config.mode < RGBLIGHT_MODE_STATIC_LIGHT) { + rgblight_config.mode = RGBLIGHT_MODE_STATIC_LIGHT; + } else if (rgblight_config.mode > RGBLIGHT_MODES) { + rgblight_config.mode = RGBLIGHT_MODES; + } + + if (rgblight_config.val > RGBLIGHT_LIMIT_VAL) { + rgblight_config.val = RGBLIGHT_LIMIT_VAL; + } } uint32_t eeconfig_read_rgblight(void) { - return eeprom_read_dword(EECONFIG_RGBLIGHT); +#if defined(__AVR__) || defined(STM32_EEPROM_ENABLE) || defined(PROTOCOL_ARM_ATSAM) || defined(EEPROM_SIZE) + return eeprom_read_dword(EECONFIG_RGBLIGHT); +#else + return 0; +#endif } + void eeconfig_update_rgblight(uint32_t val) { - eeprom_update_dword(EECONFIG_RGBLIGHT, val); +#if defined(__AVR__) || defined(STM32_EEPROM_ENABLE) || defined(PROTOCOL_ARM_ATSAM) || defined(EEPROM_SIZE) + rgblight_check_config(); + eeprom_update_dword(EECONFIG_RGBLIGHT, val); +#endif } + void eeconfig_update_rgblight_default(void) { - dprintf("eeconfig_update_rgblight_default\n"); - rgblight_config.enable = 1; - rgblight_config.mode = 1; - rgblight_config.hue = 0; - rgblight_config.sat = 255; - rgblight_config.val = RGBLIGHT_LIMIT_VAL; - rgblight_config.speed = 0; - eeconfig_update_rgblight(rgblight_config.raw); + rgblight_config.enable = 1; + rgblight_config.mode = RGBLIGHT_MODE_STATIC_LIGHT; + rgblight_config.hue = 0; + rgblight_config.sat = UINT8_MAX; + rgblight_config.val = RGBLIGHT_LIMIT_VAL; + rgblight_config.speed = 0; + RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; + eeconfig_update_rgblight(rgblight_config.raw); } + void eeconfig_debug_rgblight(void) { - dprintf("rgblight_config eprom\n"); - dprintf("rgblight_config.enable = %d\n", rgblight_config.enable); - dprintf("rghlight_config.mode = %d\n", rgblight_config.mode); - dprintf("rgblight_config.hue = %d\n", rgblight_config.hue); - dprintf("rgblight_config.sat = %d\n", rgblight_config.sat); - dprintf("rgblight_config.val = %d\n", rgblight_config.val); - dprintf("rgblight_config.speed = %d\n", rgblight_config.speed); + dprintf("rgblight_config EEPROM:\n"); + dprintf("rgblight_config.enable = %d\n", rgblight_config.enable); + dprintf("rghlight_config.mode = %d\n", rgblight_config.mode); + dprintf("rgblight_config.hue = %d\n", rgblight_config.hue); + dprintf("rgblight_config.sat = %d\n", rgblight_config.sat); + dprintf("rgblight_config.val = %d\n", rgblight_config.val); + dprintf("rgblight_config.speed = %d\n", rgblight_config.speed); } void rgblight_init(void) { - debug_enable = 1; // Debug ON! - dprintf("rgblight_init called.\n"); - dprintf("rgblight_init start!\n"); - if (!eeconfig_is_enabled()) { - dprintf("rgblight_init eeconfig is not enabled.\n"); - eeconfig_init(); - eeconfig_update_rgblight_default(); - } - rgblight_config.raw = eeconfig_read_rgblight(); - if (!rgblight_config.mode) { - dprintf("rgblight_init rgblight_config.mode = 0. Write default values to EEPROM.\n"); - eeconfig_update_rgblight_default(); + /* if already initialized, don't do it again. + If you must do it again, extern this and set to false, first. + This is a dirty, dirty hack until proper hooks can be added for keyboard startup. */ + if (is_rgblight_initialized) { + return; + } + + dprintf("rgblight_init called.\n"); + dprintf("rgblight_init start!\n"); + if (!eeconfig_is_enabled()) { + dprintf("rgblight_init eeconfig is not enabled.\n"); + eeconfig_init(); + eeconfig_update_rgblight_default(); + } rgblight_config.raw = eeconfig_read_rgblight(); - } - eeconfig_debug_rgblight(); // display current eeprom values + RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; + if (!rgblight_config.mode) { + dprintf("rgblight_init rgblight_config.mode = 0. Write default values to EEPROM.\n"); + eeconfig_update_rgblight_default(); + rgblight_config.raw = eeconfig_read_rgblight(); + } + rgblight_check_config(); - #ifdef RGBLIGHT_ANIMATIONS - rgblight_timer_init(); // setup the timer - #endif + eeconfig_debug_rgblight(); // display current eeprom values - if (rgblight_config.enable) { - rgblight_mode_noeeprom(rgblight_config.mode); - } +#ifdef RGBLIGHT_USE_TIMER + rgblight_timer_init(); // setup the timer +#endif + + if (rgblight_config.enable) { + rgblight_mode_noeeprom(rgblight_config.mode); + } + + is_rgblight_initialized = true; } +uint32_t rgblight_read_dword(void) { return rgblight_config.raw; } + void rgblight_update_dword(uint32_t dword) { - rgblight_config.raw = dword; - eeconfig_update_rgblight(rgblight_config.raw); - if (rgblight_config.enable) - rgblight_mode(rgblight_config.mode); - else { - #ifdef RGBLIGHT_ANIMATIONS - rgblight_timer_disable(); - #endif - rgblight_set(); - } + RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS; + rgblight_config.raw = dword; + if (rgblight_config.enable) + rgblight_mode_noeeprom(rgblight_config.mode); + else { +#ifdef RGBLIGHT_USE_TIMER + rgblight_timer_disable(); +#endif + rgblight_set(); + } } void rgblight_increase(void) { - uint8_t mode = 0; - if (rgblight_config.mode < RGBLIGHT_MODES) { - mode = rgblight_config.mode + 1; - } - rgblight_mode(mode); + uint8_t mode = 0; + if (rgblight_config.mode < RGBLIGHT_MODES) { + mode = rgblight_config.mode + 1; + } + rgblight_mode(mode); } void rgblight_decrease(void) { - uint8_t mode = 0; - // Mode will never be < 1. If it ever is, eeprom needs to be initialized. - if (rgblight_config.mode > 1) { - mode = rgblight_config.mode - 1; - } - rgblight_mode(mode); + uint8_t mode = 0; + // Mode will never be < 1. If it ever is, eeprom needs to be initialized. + if (rgblight_config.mode > RGBLIGHT_MODE_STATIC_LIGHT) { + mode = rgblight_config.mode - 1; + } + rgblight_mode(mode); } -void rgblight_step(void) { - uint8_t mode = 0; - mode = rgblight_config.mode + 1; - if (mode > RGBLIGHT_MODES) { - mode = 1; - } - rgblight_mode(mode); +void rgblight_step_helper(bool write_to_eeprom) { + uint8_t mode = 0; + mode = rgblight_config.mode + 1; + if (mode > RGBLIGHT_MODES) { + mode = 1; + } + rgblight_mode_eeprom_helper(mode, write_to_eeprom); } -void rgblight_step_reverse(void) { - uint8_t mode = 0; - mode = rgblight_config.mode - 1; - if (mode < 1) { - mode = RGBLIGHT_MODES; - } - rgblight_mode(mode); +void rgblight_step_noeeprom(void) { rgblight_step_helper(false); } +void rgblight_step(void) { rgblight_step_helper(true); } +void rgblight_step_reverse_helper(bool write_to_eeprom) { + uint8_t mode = 0; + mode = rgblight_config.mode - 1; + if (mode < 1) { + mode = RGBLIGHT_MODES; + } + rgblight_mode_eeprom_helper(mode, write_to_eeprom); } +void rgblight_step_reverse_noeeprom(void) { rgblight_step_reverse_helper(false); } +void rgblight_step_reverse(void) { rgblight_step_reverse_helper(true); } uint8_t rgblight_get_mode(void) { - if (!rgblight_config.enable) { - return false; - } + if (!rgblight_config.enable) { + return false; + } - return rgblight_config.mode; + return rgblight_config.mode; } void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { - if (!rgblight_config.enable) { - return; - } - if (mode < 1) { - rgblight_config.mode = 1; - } else if (mode > RGBLIGHT_MODES) { - rgblight_config.mode = RGBLIGHT_MODES; - } else { - rgblight_config.mode = mode; - } - if (write_to_eeprom) { - eeconfig_update_rgblight(rgblight_config.raw); - xprintf("rgblight mode [EEPROM]: %u\n", rgblight_config.mode); - } else { - xprintf("rgblight mode [NOEEPROM]: %u\n", rgblight_config.mode); - } - if (rgblight_config.mode == 1) { - #ifdef RGBLIGHT_ANIMATIONS - rgblight_timer_disable(); - #endif - } else if ((rgblight_config.mode >= 2 && rgblight_config.mode <= 24) || - rgblight_config.mode == 35 ) { - // MODE 2-5, breathing - // MODE 6-8, rainbow mood - // MODE 9-14, rainbow swirl - // MODE 15-20, snake - // MODE 21-23, knight - // MODE 24, xmas - // MODE 35 RGB test - - #ifdef RGBLIGHT_ANIMATIONS - rgblight_timer_enable(); - #endif - } else if (rgblight_config.mode >= 25 && rgblight_config.mode <= 34) { - // MODE 25-34, static gradient - - #ifdef RGBLIGHT_ANIMATIONS - rgblight_timer_disable(); - #endif - } - rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); -} - -void rgblight_mode(uint8_t mode) { - rgblight_mode_eeprom_helper(mode, true); + if (!rgblight_config.enable) { + return; + } + if (mode < RGBLIGHT_MODE_STATIC_LIGHT) { + rgblight_config.mode = RGBLIGHT_MODE_STATIC_LIGHT; + } else if (mode > RGBLIGHT_MODES) { + rgblight_config.mode = RGBLIGHT_MODES; + } else { + rgblight_config.mode = mode; + } + RGBLIGHT_SPLIT_SET_CHANGE_MODE; + if (write_to_eeprom) { + eeconfig_update_rgblight(rgblight_config.raw); + dprintf("rgblight mode [EEPROM]: %u\n", rgblight_config.mode); + } else { + dprintf("rgblight mode [NOEEPROM]: %u\n", rgblight_config.mode); + } + if (is_static_effect(rgblight_config.mode)) { +#ifdef RGBLIGHT_USE_TIMER + rgblight_timer_disable(); +#endif + } else { +#ifdef RGBLIGHT_USE_TIMER + rgblight_timer_enable(); +#endif + } +#ifdef RGBLIGHT_USE_TIMER + animation_status.restart = true; +#endif + rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); } -void rgblight_mode_noeeprom(uint8_t mode) { - rgblight_mode_eeprom_helper(mode, false); -} +void rgblight_mode(uint8_t mode) { rgblight_mode_eeprom_helper(mode, true); } +void rgblight_mode_noeeprom(uint8_t mode) { rgblight_mode_eeprom_helper(mode, false); } void rgblight_toggle(void) { - xprintf("rgblight toggle [EEPROM]: rgblight_config.enable = %u\n", !rgblight_config.enable); - if (rgblight_config.enable) { - rgblight_disable(); - } - else { - rgblight_enable(); - } + dprintf("rgblight toggle [EEPROM]: rgblight_config.enable = %u\n", !rgblight_config.enable); + if (rgblight_config.enable) { + rgblight_disable(); + } else { + rgblight_enable(); + } } void rgblight_toggle_noeeprom(void) { - xprintf("rgblight toggle [NOEEPROM]: rgblight_config.enable = %u\n", !rgblight_config.enable); - if (rgblight_config.enable) { - rgblight_disable_noeeprom(); - } - else { - rgblight_enable_noeeprom(); - } + dprintf("rgblight toggle [NOEEPROM]: rgblight_config.enable = %u\n", !rgblight_config.enable); + if (rgblight_config.enable) { + rgblight_disable_noeeprom(); + } else { + rgblight_enable_noeeprom(); + } } void rgblight_enable(void) { - rgblight_config.enable = 1; - // No need to update EEPROM here. rgblight_mode() will do that, actually - //eeconfig_update_rgblight(rgblight_config.raw); - xprintf("rgblight enable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); - rgblight_mode(rgblight_config.mode); + rgblight_config.enable = 1; + // No need to update EEPROM here. rgblight_mode() will do that, actually + // eeconfig_update_rgblight(rgblight_config.raw); + dprintf("rgblight enable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); + rgblight_mode(rgblight_config.mode); } void rgblight_enable_noeeprom(void) { - rgblight_config.enable = 1; - xprintf("rgblight enable [NOEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); - rgblight_mode_noeeprom(rgblight_config.mode); + rgblight_config.enable = 1; + dprintf("rgblight enable [NOEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); + rgblight_mode_noeeprom(rgblight_config.mode); } void rgblight_disable(void) { - rgblight_config.enable = 0; - eeconfig_update_rgblight(rgblight_config.raw); - xprintf("rgblight disable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); - #ifdef RGBLIGHT_ANIMATIONS - //rgblight_timer_disable(); - #endif - _delay_ms(50); - rgblight_set(); + rgblight_config.enable = 0; + eeconfig_update_rgblight(rgblight_config.raw); + dprintf("rgblight disable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); +#ifdef RGBLIGHT_USE_TIMER + rgblight_timer_disable(); +#endif + RGBLIGHT_SPLIT_SET_CHANGE_MODE; + wait_ms(50); + rgblight_set(); } void rgblight_disable_noeeprom(void) { - rgblight_config.enable = 0; - xprintf("rgblight disable [noEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); - #ifdef RGBLIGHT_ANIMATIONS + rgblight_config.enable = 0; + dprintf("rgblight disable [NOEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); +#ifdef RGBLIGHT_USE_TIMER rgblight_timer_disable(); - #endif - _delay_ms(50); - rgblight_set(); +#endif + RGBLIGHT_SPLIT_SET_CHANGE_MODE; + wait_ms(50); + rgblight_set(); } - -// Deals with the messy details of incrementing an integer -uint8_t increment( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) { - int16_t new_value = value; - new_value += step; - return MIN( MAX( new_value, min ), max ); +void rgblight_increase_hue_helper(bool write_to_eeprom) { + uint8_t hue = rgblight_config.hue + RGBLIGHT_HUE_STEP; + rgblight_sethsv_eeprom_helper(hue, rgblight_config.sat, rgblight_config.val, write_to_eeprom); } - -uint8_t decrement( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) { - int16_t new_value = value; - new_value -= step; - return MIN( MAX( new_value, min ), max ); +void rgblight_increase_hue_noeeprom(void) { rgblight_increase_hue_helper(false); } +void rgblight_increase_hue(void) { rgblight_increase_hue_helper(true); } +void rgblight_decrease_hue_helper(bool write_to_eeprom) { + uint8_t hue = rgblight_config.hue - RGBLIGHT_HUE_STEP; + rgblight_sethsv_eeprom_helper(hue, rgblight_config.sat, rgblight_config.val, write_to_eeprom); } - -void rgblight_increase_hue(void) { - uint16_t hue; - hue = (rgblight_config.hue+RGBLIGHT_HUE_STEP) % 360; - rgblight_sethsv(hue, rgblight_config.sat, rgblight_config.val); +void rgblight_decrease_hue_noeeprom(void) { rgblight_decrease_hue_helper(false); } +void rgblight_decrease_hue(void) { rgblight_decrease_hue_helper(true); } +void rgblight_increase_sat_helper(bool write_to_eeprom) { + uint8_t sat = qadd8(rgblight_config.sat, RGBLIGHT_SAT_STEP); + rgblight_sethsv_eeprom_helper(rgblight_config.hue, sat, rgblight_config.val, write_to_eeprom); } -void rgblight_decrease_hue(void) { - uint16_t hue; - if (rgblight_config.hue-RGBLIGHT_HUE_STEP < 0) { - hue = (rgblight_config.hue + 360 - RGBLIGHT_HUE_STEP) % 360; - } else { - hue = (rgblight_config.hue - RGBLIGHT_HUE_STEP) % 360; - } - rgblight_sethsv(hue, rgblight_config.sat, rgblight_config.val); -} -void rgblight_increase_sat(void) { - uint8_t sat; - if (rgblight_config.sat + RGBLIGHT_SAT_STEP > 255) { - sat = 255; - } else { - sat = rgblight_config.sat + RGBLIGHT_SAT_STEP; - } - rgblight_sethsv(rgblight_config.hue, sat, rgblight_config.val); -} -void rgblight_decrease_sat(void) { - uint8_t sat; - if (rgblight_config.sat - RGBLIGHT_SAT_STEP < 0) { - sat = 0; - } else { - sat = rgblight_config.sat - RGBLIGHT_SAT_STEP; - } - rgblight_sethsv(rgblight_config.hue, sat, rgblight_config.val); -} -void rgblight_increase_val(void) { - uint8_t val; - if (rgblight_config.val + RGBLIGHT_VAL_STEP > RGBLIGHT_LIMIT_VAL) { - val = RGBLIGHT_LIMIT_VAL; - } else { - val = rgblight_config.val + RGBLIGHT_VAL_STEP; - } - rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, val); -} -void rgblight_decrease_val(void) { - uint8_t val; - if (rgblight_config.val - RGBLIGHT_VAL_STEP < 0) { - val = 0; - } else { - val = rgblight_config.val - RGBLIGHT_VAL_STEP; - } - rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, val); +void rgblight_increase_sat_noeeprom(void) { rgblight_increase_sat_helper(false); } +void rgblight_increase_sat(void) { rgblight_increase_sat_helper(true); } +void rgblight_decrease_sat_helper(bool write_to_eeprom) { + uint8_t sat = qsub8(rgblight_config.sat, RGBLIGHT_SAT_STEP); + rgblight_sethsv_eeprom_helper(rgblight_config.hue, sat, rgblight_config.val, write_to_eeprom); +} +void rgblight_decrease_sat_noeeprom(void) { rgblight_decrease_sat_helper(false); } +void rgblight_decrease_sat(void) { rgblight_decrease_sat_helper(true); } +void rgblight_increase_val_helper(bool write_to_eeprom) { + uint8_t val = qadd8(rgblight_config.val, RGBLIGHT_VAL_STEP); + rgblight_sethsv_eeprom_helper(rgblight_config.hue, rgblight_config.sat, val, write_to_eeprom); +} +void rgblight_increase_val_noeeprom(void) { rgblight_increase_val_helper(false); } +void rgblight_increase_val(void) { rgblight_increase_val_helper(true); } +void rgblight_decrease_val_helper(bool write_to_eeprom) { + uint8_t val = qsub8(rgblight_config.val, RGBLIGHT_VAL_STEP); + rgblight_sethsv_eeprom_helper(rgblight_config.hue, rgblight_config.sat, val, write_to_eeprom); } +void rgblight_decrease_val_noeeprom(void) { rgblight_decrease_val_helper(false); } +void rgblight_decrease_val(void) { rgblight_decrease_val_helper(true); } void rgblight_increase_speed(void) { - rgblight_config.speed = increment( rgblight_config.speed, 1, 0, 3 ); - eeconfig_update_rgblight(rgblight_config.raw);//EECONFIG needs to be increased to support this + if (rgblight_config.speed < 3) rgblight_config.speed++; + // RGBLIGHT_SPLIT_SET_CHANGE_HSVS; // NEED? + eeconfig_update_rgblight(rgblight_config.raw); // EECONFIG needs to be increased to support this } void rgblight_decrease_speed(void) { - rgblight_config.speed = decrement( rgblight_config.speed, 1, 0, 3 ); - eeconfig_update_rgblight(rgblight_config.raw);//EECONFIG needs to be increased to support this + if (rgblight_config.speed > 0) rgblight_config.speed--; + // RGBLIGHT_SPLIT_SET_CHANGE_HSVS; // NEED?? + eeconfig_update_rgblight(rgblight_config.raw); // EECONFIG needs to be increased to support this } -void rgblight_sethsv_noeeprom_old(uint16_t hue, uint8_t sat, uint8_t val) { - if (rgblight_config.enable) { - LED_TYPE tmp_led; - sethsv(hue, sat, val, &tmp_led); - fled_hs[0].hue = fled_hs[1].hue = hue; - fled_hs[0].sat = fled_hs[1].sat = sat; - // dprintf("rgblight set hue [MEMORY]: %u,%u,%u\n", inmem_config.hue, inmem_config.sat, inmem_config.val); - rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b); - } +void rgblight_sethsv_noeeprom_old(uint8_t hue, uint8_t sat, uint8_t val) { + if (rgblight_config.enable) { + // MxSS custom code + fled_hs[0].hue = fled_hs[1].hue = hue; + fled_hs[0].sat = fled_hs[1].sat = sat; + + LED_TYPE tmp_led; + sethsv(hue, sat, val, &tmp_led); + rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b); + } } -void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom) { - if (rgblight_config.enable) { - if (rgblight_config.mode == 1) { - // same static color - LED_TYPE tmp_led; - sethsv(hue, sat, val, &tmp_led); - - fled_hs[0].hue = fled_hs[1].hue = hue; - fled_hs[0].sat = fled_hs[1].sat = sat; - - rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b); - } else { - // all LEDs in same color - if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) { - // breathing mode, ignore the change of val, use in memory value instead - val = rgblight_config.val; - } else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 14) { - // rainbow mood and rainbow swirl, ignore the change of hue - hue = rgblight_config.hue; - } else if (rgblight_config.mode >= 25 && rgblight_config.mode <= 34) { - // static gradient - uint16_t _hue; - int8_t direction = ((rgblight_config.mode - 25) % 2) ? -1 : 1; - uint16_t range = pgm_read_word(&RGBLED_GRADIENT_RANGES[(rgblight_config.mode - 25) / 2]); - for (uint8_t i = 0; i < RGBLED_NUM; i++) { - _hue = (range / RGBLED_NUM * i * direction + hue + 360) % 360; - dprintf("rgblight rainbow set hsv: %u,%u,%d,%u\n", i, _hue, direction, range); - sethsv(_hue, sat, val, (LED_TYPE *)&led[i]); +void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom) { + if (rgblight_config.enable) { + rgblight_status.base_mode = mode_base_table[rgblight_config.mode]; + if (rgblight_config.mode == RGBLIGHT_MODE_STATIC_LIGHT) { + // same static color + LED_TYPE tmp_led; + sethsv(hue, sat, val, &tmp_led); + + // MxSS custom + // Cache hue/sat for rgb + fled_hs[0].hue = fled_hs[1].hue = hue; + fled_hs[0].sat = fled_hs[1].sat = sat; + + rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b); + } else { + // all LEDs in same color + if (1 == 0) { // dummy + } +#ifdef RGBLIGHT_EFFECT_BREATHING + else if (rgblight_status.base_mode == RGBLIGHT_MODE_BREATHING) { + // breathing mode, ignore the change of val, use in memory value instead + val = rgblight_config.val; + } +#endif +#ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD + else if (rgblight_status.base_mode == RGBLIGHT_MODE_RAINBOW_MOOD) { + // rainbow mood, ignore the change of hue + hue = rgblight_config.hue; + } +#endif +#ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL + else if (rgblight_status.base_mode == RGBLIGHT_MODE_RAINBOW_SWIRL) { + // rainbow swirl, ignore the change of hue + hue = rgblight_config.hue; + } +#endif +#ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT + else if (rgblight_status.base_mode == RGBLIGHT_MODE_STATIC_GRADIENT) { + // static gradient + uint8_t delta = rgblight_config.mode - rgblight_status.base_mode; + bool direction = (delta % 2) == 0; +# ifdef __AVR__ + // probably due to how pgm_read_word is defined for ARM, but the ARM compiler really hates this line + uint8_t range = pgm_read_word(&RGBLED_GRADIENT_RANGES[delta / 2]); +# else + uint8_t range = RGBLED_GRADIENT_RANGES[delta / 2]; +# endif + for (uint8_t i = 0; i < effect_num_leds; i++) { + uint8_t _hue = ((uint16_t)i * (uint16_t)range) / effect_num_leds; + if (direction) { + _hue = hue + _hue; + } else { + _hue = hue - _hue; + } + dprintf("rgblight rainbow set hsv: %d,%d,%d,%u\n", i, _hue, direction, range); + sethsv(_hue, sat, val, (LED_TYPE *)&led[i + effect_start_pos]); + } + rgblight_set(); + } +#endif + } +#ifdef RGBLIGHT_SPLIT + if (rgblight_config.hue != hue || rgblight_config.sat != sat || rgblight_config.val != val) { + RGBLIGHT_SPLIT_SET_CHANGE_HSVS; + } +#endif + rgblight_config.hue = hue; + rgblight_config.sat = sat; + rgblight_config.val = val; + if (write_to_eeprom) { + eeconfig_update_rgblight(rgblight_config.raw); + dprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); + } else { + dprintf("rgblight set hsv [NOEEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); } - rgblight_set(); - } - } - rgblight_config.hue = hue; - rgblight_config.sat = sat; - rgblight_config.val = val; - if (write_to_eeprom) { - eeconfig_update_rgblight(rgblight_config.raw); - xprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); - } else { - xprintf("rgblight set hsv [NOEEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val); } - } } -void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val) { - rgblight_sethsv_eeprom_helper(hue, sat, val, true); -} +void rgblight_sethsv(uint8_t hue, uint8_t sat, uint8_t val) { rgblight_sethsv_eeprom_helper(hue, sat, val, true); } -void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) { - rgblight_sethsv_eeprom_helper(hue, sat, val, false); -} +void rgblight_sethsv_noeeprom(uint8_t hue, uint8_t sat, uint8_t val) { rgblight_sethsv_eeprom_helper(hue, sat, val, false); } -uint16_t rgblight_get_hue(void) { - return rgblight_config.hue; +uint8_t rgblight_get_hue(void) { return rgblight_config.hue; } + +uint8_t rgblight_get_sat(void) { return rgblight_config.sat; } + +uint8_t rgblight_get_val(void) { return rgblight_config.val; } + +void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { + if (!rgblight_config.enable) { + return; + } + + for (uint8_t i = effect_start_pos; i < effect_end_pos; i++) { + led[i].r = r; + led[i].g = g; + led[i].b = b; +#ifdef RGBW + led[i].w = 0; +#endif + } + rgblight_set(); } -uint8_t rgblight_get_sat(void) { - return rgblight_config.sat; +void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index) { + if (!rgblight_config.enable || index >= RGBLED_NUM) { + return; + } + + led[index].r = r; + led[index].g = g; + led[index].b = b; +#ifdef RGBW + led[index].w = 0; +#endif + rgblight_set(); } -uint8_t rgblight_get_val(void) { - return rgblight_config.val; +void rgblight_sethsv_at(uint8_t hue, uint8_t sat, uint8_t val, uint8_t index) { + if (!rgblight_config.enable) { + return; + } + + LED_TYPE tmp_led; + sethsv(hue, sat, val, &tmp_led); + rgblight_setrgb_at(tmp_led.r, tmp_led.g, tmp_led.b, index); } -void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { - if (!rgblight_config.enable) { return; } +#if defined(RGBLIGHT_EFFECT_BREATHING) || defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) || defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL) || defined(RGBLIGHT_EFFECT_SNAKE) || defined(RGBLIGHT_EFFECT_KNIGHT) - for (uint8_t i = 0; i < RGBLED_NUM; i++) { - led[i].r = r; - led[i].g = g; - led[i].b = b; - } - rgblight_set(); +static uint8_t get_interval_time(const uint8_t *default_interval_address, uint8_t velocikey_min, uint8_t velocikey_max) { + return +# ifdef VELOCIKEY_ENABLE + velocikey_enabled() ? velocikey_match_speed(velocikey_min, velocikey_max) : +# endif + pgm_read_byte(default_interval_address); } -void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index) { - if (!rgblight_config.enable || index >= RGBLED_NUM) { return; } +#endif + +void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8_t end) { + if (!rgblight_config.enable || start < 0 || start >= end || end > RGBLED_NUM) { + return; + } - led[index].r = r; - led[index].g = g; - led[index].b = b; - rgblight_set(); + for (uint8_t i = start; i < end; i++) { + led[i].r = r; + led[i].g = g; + led[i].b = b; +#ifdef RGBW + led[i].w = 0; +#endif + } + rgblight_set(); + wait_ms(1); } -void rgblight_sethsv_at(uint16_t hue, uint8_t sat, uint8_t val, uint8_t index) { - if (!rgblight_config.enable) { return; } +void rgblight_sethsv_range(uint8_t hue, uint8_t sat, uint8_t val, uint8_t start, uint8_t end) { + if (!rgblight_config.enable) { + return; + } - LED_TYPE tmp_led; - sethsv(hue, sat, val, &tmp_led); - rgblight_setrgb_at(tmp_led.r, tmp_led.g, tmp_led.b, index); + LED_TYPE tmp_led; + sethsv(hue, sat, val, &tmp_led); + rgblight_setrgb_range(tmp_led.r, tmp_led.g, tmp_led.b, start, end); } +#ifndef RGBLIGHT_SPLIT +void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b) { rgblight_setrgb_range(r, g, b, 0, (uint8_t)RGBLED_NUM / 2); } + +void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b) { rgblight_setrgb_range(r, g, b, (uint8_t)RGBLED_NUM / 2, (uint8_t)RGBLED_NUM); } + +void rgblight_sethsv_master(uint8_t hue, uint8_t sat, uint8_t val) { rgblight_sethsv_range(hue, sat, val, 0, (uint8_t)RGBLED_NUM / 2); } + +void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val) { rgblight_sethsv_range(hue, sat, val, (uint8_t)RGBLED_NUM / 2, (uint8_t)RGBLED_NUM); } +#endif // ifndef RGBLIGHT_SPLIT + +#ifndef RGBLIGHT_CUSTOM_DRIVER void rgblight_set(void) { - if (!rgblight_config.enable) { + LED_TYPE *start_led; + uint16_t num_leds = clipping_num_leds; + + if (!rgblight_config.enable) { + for (uint8_t i = effect_start_pos; i < effect_end_pos; i++) { + if (i == RGBLIGHT_FLED1 && i == RGBLIGHT_FLED2) + continue; + + led[i].r = 0; + led[i].g = 0; + led[i].b = 0; +# ifdef RGBW + led[i].w = 0; +# endif + } + } + +# ifdef RGBLIGHT_LED_MAP + LED_TYPE led0[RGBLED_NUM]; for (uint8_t i = 0; i < RGBLED_NUM; i++) { - if (i == RGBLIGHT_FLED1 && i == RGBLIGHT_FLED2) - continue; - - led[i].r = 0; - led[i].g = 0; - led[i].b = 0; + led0[i] = led[pgm_read_byte(&led_map[i])]; } - } - - switch (fled_mode) { + start_led = led0 + clipping_start_pos; +# else + start_led = led + clipping_start_pos; +# endif + +#ifdef RGBW + for (uint8_t i = 0; i < num_leds; i++) { + convert_rgb_to_rgbw(&start_led[i]); + } +#endif + // MxSS custom + switch (fled_mode) { case FLED_OFF: - setrgb(0, 0, 0, &led[RGBLIGHT_FLED1]); - setrgb(0, 0, 0, &led[RGBLIGHT_FLED2]); + setrgb(0, 0, 0, &led[RGBLIGHT_FLED1]); + setrgb(0, 0, 0, &led[RGBLIGHT_FLED2]); break; - + case FLED_INDI: - copyrgb(&fleds[0], &led[RGBLIGHT_FLED1]); - copyrgb(&fleds[1], &led[RGBLIGHT_FLED2]); + copyrgb(&fleds[0], &led[RGBLIGHT_FLED1]); + copyrgb(&fleds[1], &led[RGBLIGHT_FLED2]); break; - + case FLED_RGB: - if (fled_hs[0].hue == 0 && fled_hs[0].hue == 0 && (rgblight_config.mode >= 15 && rgblight_config.mode <= 23)) - setrgb(0, 0, 0, &led[RGBLIGHT_FLED1]); - else - sethsv(fled_hs[0].hue, fled_hs[0].sat, fled_val, &led[RGBLIGHT_FLED1]); - - if (fled_hs[1].hue == 0 && fled_hs[1].hue == 0 && (rgblight_config.mode >= 15 && rgblight_config.mode <= 23)) - setrgb(0, 0, 0, &led[RGBLIGHT_FLED2]); - else - sethsv(fled_hs[1].hue, fled_hs[1].sat, fled_val, &led[RGBLIGHT_FLED2]); + if (fled_hs[0].hue == 0 && fled_hs[0].hue == 0 && + (rgblight_status.base_mode == RGBLIGHT_MODE_SNAKE || + rgblight_status.base_mode == RGBLIGHT_MODE_KNIGHT)) + setrgb(0, 0, 0, &led[RGBLIGHT_FLED1]); + else + sethsv(fled_hs[0].hue, fled_hs[0].sat, fled_val, &led[RGBLIGHT_FLED1]); + + if (fled_hs[1].hue == 0 && fled_hs[1].hue == 0 && + (rgblight_status.base_mode == RGBLIGHT_MODE_SNAKE || + rgblight_status.base_mode == RGBLIGHT_MODE_KNIGHT)) + setrgb(0, 0, 0, &led[RGBLIGHT_FLED2]); + else + sethsv(fled_hs[1].hue, fled_hs[1].sat, fled_val, &led[RGBLIGHT_FLED2]); break; - + default: break; } - ws2812_setleds(led, RGBLED_NUM); + ws2812_setleds(start_led, num_leds); +} +#endif + +#ifdef RGBLIGHT_SPLIT +/* for split keyboard master side */ +uint8_t rgblight_get_change_flags(void) { return rgblight_status.change_flags; } + +void rgblight_clear_change_flags(void) { rgblight_status.change_flags = 0; } + +void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo) { + syncinfo->config = rgblight_config; + syncinfo->status = rgblight_status; +} + +/* for split keyboard slave side */ +void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom) { + if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_MODE) { + if (syncinfo->config.enable) { + rgblight_config.enable = 1; // == rgblight_enable_noeeprom(); + rgblight_mode_eeprom_helper(syncinfo->config.mode, write_to_eeprom); + } else { + rgblight_disable_noeeprom(); + } + } + if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_HSVS) { + rgblight_sethsv_eeprom_helper(syncinfo->config.hue, syncinfo->config.sat, syncinfo->config.val, write_to_eeprom); + // rgblight_config.speed = config->speed; // NEED??? + } +# ifdef RGBLIGHT_USE_TIMER + if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_TIMER) { + if (syncinfo->status.timer_enabled) { + rgblight_timer_enable(); + } else { + rgblight_timer_disable(); + } + } +# ifndef RGBLIGHT_SPLIT_NO_ANIMATION_SYNC + if (syncinfo->status.change_flags & RGBLIGHT_STATUS_ANIMATION_TICK) { + animation_status.restart = true; + } +# endif /* RGBLIGHT_SPLIT_NO_ANIMATION_SYNC */ +# endif /* RGBLIGHT_USE_TIMER */ } +#endif /* RGBLIGHT_SPLIT */ -#ifdef RGBLIGHT_ANIMATIONS +#ifdef RGBLIGHT_USE_TIMER -// Animation timer -- AVR Timer3 +typedef void (*effect_func_t)(animation_status_t *anim); + +// Animation timer -- use system timer (AVR Timer0) void rgblight_timer_init(void) { - // static uint8_t rgblight_timer_is_init = 0; - // if (rgblight_timer_is_init) { - // return; - // } - // rgblight_timer_is_init = 1; - // /* Timer 3 setup */ - // TCCR3B = _BV(WGM32) // CTC mode OCR3A as TOP - // | _BV(CS30); // Clock selelct: clk/1 - // /* Set TOP value */ - // uint8_t sreg = SREG; - // cli(); - // OCR3AH = (RGBLED_TIMER_TOP >> 8) & 0xff; - // OCR3AL = RGBLED_TIMER_TOP & 0xff; - // SREG = sreg; - - rgblight_timer_enabled = true; + // OLD!!!! Animation timer -- AVR Timer3 + // static uint8_t rgblight_timer_is_init = 0; + // if (rgblight_timer_is_init) { + // return; + // } + // rgblight_timer_is_init = 1; + // /* Timer 3 setup */ + // TCCR3B = _BV(WGM32) // CTC mode OCR3A as TOP + // | _BV(CS30); // Clock selelct: clk/1 + // /* Set TOP value */ + // uint8_t sreg = SREG; + // cli(); + // OCR3AH = (RGBLED_TIMER_TOP >> 8) & 0xff; + // OCR3AL = RGBLED_TIMER_TOP & 0xff; + // SREG = sreg; + + rgblight_status.timer_enabled = false; + RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE; } void rgblight_timer_enable(void) { - rgblight_timer_enabled = true; - dprintf("TIMER3 enabled.\n"); + if (!is_static_effect(rgblight_config.mode)) { + rgblight_status.timer_enabled = true; + } + animation_status.last_timer = timer_read(); + RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE; + dprintf("rgblight timer enabled.\n"); } void rgblight_timer_disable(void) { - rgblight_timer_enabled = false; - dprintf("TIMER3 disabled.\n"); + // MxSS custom code + if (fled_mode != FLED_RGB) { + rgblight_status.timer_enabled = false; + RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE; + dprintf("rgblight timer disable.\n"); + } } void rgblight_timer_toggle(void) { - rgblight_timer_enabled ^= rgblight_timer_enabled; - dprintf("TIMER3 toggled.\n"); + dprintf("rgblight timer toggle.\n"); + if (rgblight_status.timer_enabled) { + rgblight_timer_disable(); + } else { + rgblight_timer_enable(); + } } void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b) { - rgblight_enable(); - rgblight_mode(1); - rgblight_setrgb(r, g, b); + rgblight_enable(); + rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT); + rgblight_setrgb(r, g, b); +} + +static void rgblight_effect_dummy(animation_status_t *anim) { + // do nothing + /******** + dprintf("rgblight_task() what happened?\n"); + dprintf("is_static_effect %d\n", is_static_effect(rgblight_config.mode)); + dprintf("mode = %d, base_mode = %d, timer_enabled %d, ", + rgblight_config.mode, rgblight_status.base_mode, + rgblight_status.timer_enabled); + dprintf("last_timer = %d\n",anim->last_timer); + **/ } void rgblight_task(void) { - if (rgblight_timer_enabled) { - // mode = 1, static light, do nothing here - if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) { - // mode = 2 to 5, breathing mode - rgblight_effect_breathing(rgblight_config.mode - 2); - } else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 8) { - // mode = 6 to 8, rainbow mood mod - rgblight_effect_rainbow_mood(rgblight_config.mode - 6); - } else if (rgblight_config.mode >= 9 && rgblight_config.mode <= 14) { - // mode = 9 to 14, rainbow swirl mode - rgblight_effect_rainbow_swirl(rgblight_config.mode - 9); - } else if (rgblight_config.mode >= 15 && rgblight_config.mode <= 20) { - // mode = 15 to 20, snake mode - rgblight_effect_snake(rgblight_config.mode - 15); - } else if (rgblight_config.mode >= 21 && rgblight_config.mode <= 23) { - // mode = 21 to 23, knight mode - rgblight_effect_knight(rgblight_config.mode - 21); - } else if (rgblight_config.mode == 24) { - // mode = 24, christmas mode - rgblight_effect_christmas(); - } else if (rgblight_config.mode == 35) { - // mode = 35, RGB test - rgblight_effect_rgbtest(); + if (rgblight_status.timer_enabled) { + effect_func_t effect_func = rgblight_effect_dummy; + uint16_t interval_time = 2000; // dummy interval + uint8_t delta = rgblight_config.mode - rgblight_status.base_mode; + animation_status.delta = delta; + + // static light mode, do nothing here + if (1 == 0) { // dummy + } +# ifdef RGBLIGHT_EFFECT_BREATHING + else if (rgblight_status.base_mode == RGBLIGHT_MODE_BREATHING) { + // breathing mode + interval_time = get_interval_time(&RGBLED_BREATHING_INTERVALS[delta], 1, 100); + effect_func = rgblight_effect_breathing; + } +# endif +# ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD + else if (rgblight_status.base_mode == RGBLIGHT_MODE_RAINBOW_MOOD) { + // rainbow mood mode + interval_time = get_interval_time(&RGBLED_RAINBOW_MOOD_INTERVALS[delta], 5, 100); + effect_func = rgblight_effect_rainbow_mood; + } +# endif +# ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL + else if (rgblight_status.base_mode == RGBLIGHT_MODE_RAINBOW_SWIRL) { + // rainbow swirl mode + interval_time = get_interval_time(&RGBLED_RAINBOW_SWIRL_INTERVALS[delta / 2], 1, 100); + effect_func = rgblight_effect_rainbow_swirl; + } +# endif +# ifdef RGBLIGHT_EFFECT_SNAKE + else if (rgblight_status.base_mode == RGBLIGHT_MODE_SNAKE) { + // snake mode + interval_time = get_interval_time(&RGBLED_SNAKE_INTERVALS[delta / 2], 1, 200); + effect_func = rgblight_effect_snake; + } +# endif +# ifdef RGBLIGHT_EFFECT_KNIGHT + else if (rgblight_status.base_mode == RGBLIGHT_MODE_KNIGHT) { + // knight mode + interval_time = get_interval_time(&RGBLED_KNIGHT_INTERVALS[delta], 5, 100); + effect_func = rgblight_effect_knight; + } +# endif +# ifdef RGBLIGHT_EFFECT_CHRISTMAS + else if (rgblight_status.base_mode == RGBLIGHT_MODE_CHRISTMAS) { + // christmas mode + interval_time = RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL; + effect_func = (effect_func_t)rgblight_effect_christmas; + } +# endif +# ifdef RGBLIGHT_EFFECT_RGB_TEST + else if (rgblight_status.base_mode == RGBLIGHT_MODE_RGB_TEST) { + // RGB test mode + interval_time = pgm_read_word(&RGBLED_RGBTEST_INTERVALS[0]); + effect_func = (effect_func_t)rgblight_effect_rgbtest; + } +# endif +# ifdef RGBLIGHT_EFFECT_ALTERNATING + else if (rgblight_status.base_mode == RGBLIGHT_MODE_ALTERNATING) { + interval_time = 500; + effect_func = (effect_func_t)rgblight_effect_alternating; + } +# endif + if (animation_status.restart) { + animation_status.restart = false; + animation_status.last_timer = timer_read() - interval_time - 1; + animation_status.pos16 = 0; // restart signal to local each effect + } + if (timer_elapsed(animation_status.last_timer) >= interval_time) { +# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + static uint16_t report_last_timer = 0; + static bool tick_flag = false; + uint16_t oldpos16; + if (tick_flag) { + tick_flag = false; + if (timer_elapsed(report_last_timer) >= 30000) { + report_last_timer = timer_read(); + dprintf("rgblight animation tick report to slave\n"); + RGBLIGHT_SPLIT_ANIMATION_TICK; + } + } + oldpos16 = animation_status.pos16; +# endif + animation_status.last_timer += interval_time; + effect_func(&animation_status); +# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + if (animation_status.pos16 == 0 && oldpos16 != 0) { + tick_flag = true; + } +# endif + } } - } } -// Effects -void rgblight_effect_breathing(uint8_t interval) { - static uint8_t pos = 0; - static uint16_t last_timer = 0; - float val; +#endif /* RGBLIGHT_USE_TIMER */ - if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_BREATHING_INTERVALS[interval])) { - return; - } - last_timer = timer_read(); +// Effects +#ifdef RGBLIGHT_EFFECT_BREATHING + +# ifndef RGBLIGHT_EFFECT_BREATHE_CENTER +# ifndef RGBLIGHT_BREATHE_TABLE_SIZE +# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256 or 128 or 64 +# endif +# include <rgblight_breathe_table.h> +# endif + +__attribute__((weak)) const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5}; + +void rgblight_effect_breathing(animation_status_t *anim) { + float val; + + // http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/ +# ifdef RGBLIGHT_EFFECT_BREATHE_TABLE + val = pgm_read_byte(&rgblight_effect_breathe_table[anim->pos / table_scale]); +# else + val = (exp(sin((anim->pos / 255.0) * M_PI)) - RGBLIGHT_EFFECT_BREATHE_CENTER / M_E) * (RGBLIGHT_EFFECT_BREATHE_MAX / (M_E - 1 / M_E)); +# endif + rgblight_sethsv_noeeprom_old(rgblight_config.hue, rgblight_config.sat, val); + anim->pos = (anim->pos + 1); +} +#endif +#ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD +__attribute__((weak)) const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {120, 60, 30}; - // http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/ - val = (exp(sin((pos/255.0)*M_PI)) - RGBLIGHT_EFFECT_BREATHE_CENTER/M_E)*(RGBLIGHT_EFFECT_BREATHE_MAX/(M_E-1/M_E)); - rgblight_sethsv_noeeprom_old(rgblight_config.hue, rgblight_config.sat, val); - pos = (pos + 1) % 256; +void rgblight_effect_rainbow_mood(animation_status_t *anim) { + rgblight_sethsv_noeeprom_old(anim->current_hue, rgblight_config.sat, rgblight_config.val); + anim->current_hue++; } -void rgblight_effect_rainbow_mood(uint8_t interval) { - static uint16_t current_hue = 0; - static uint16_t last_timer = 0; +#endif - if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_RAINBOW_MOOD_INTERVALS[interval])) { - return; - } - last_timer = timer_read(); - rgblight_sethsv_noeeprom_old(current_hue, rgblight_config.sat, rgblight_config.val); - current_hue = (current_hue + 1) % 360; -} -void rgblight_effect_rainbow_swirl(uint8_t interval) { - static uint16_t current_hue = 0; - static uint16_t last_timer = 0; - uint16_t hue; - uint8_t i; - if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_RAINBOW_SWIRL_INTERVALS[interval / 2])) { - return; - } - last_timer = timer_read(); - for (i = 0; i < RGBLED_NUM; i++) { - hue = (360 / RGBLED_NUM * i + current_hue) % 360; - sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]); - } - rgblight_set(); +#ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL +# ifndef RGBLIGHT_RAINBOW_SWIRL_RANGE +# define RGBLIGHT_RAINBOW_SWIRL_RANGE 255 +# endif + +__attribute__((weak)) const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20}; + +void rgblight_effect_rainbow_swirl(animation_status_t *anim) { + uint8_t hue; + uint8_t i; + + for (i = 0; i < effect_num_leds; i++) { + hue = (RGBLIGHT_RAINBOW_SWIRL_RANGE / effect_num_leds * i + anim->current_hue); + sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i + effect_start_pos]); + } + rgblight_set(); - if (interval % 2) { - current_hue = (current_hue + 1) % 360; - } else { - if (current_hue - 1 < 0) { - current_hue = 359; + if (anim->delta % 2) { + anim->current_hue++; } else { - current_hue = current_hue - 1; + anim->current_hue--; } - } } -void rgblight_effect_snake(uint8_t interval) { - static uint8_t pos = 0; - static uint16_t last_timer = 0; - uint8_t i, j; - int8_t k; - int8_t increment = 1; - if (interval % 2) { - increment = -1; - } - if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_SNAKE_INTERVALS[interval / 2])) { - return; - } - last_timer = timer_read(); - - fled_hs[0].hue = fled_hs[1].hue = 0; - fled_hs[0].sat = fled_hs[1].sat = 0; - - for (i = 0; i < RGBLED_NUM; i++) { - led[i].r = 0; - led[i].g = 0; - led[i].b = 0; - - for (j = 0; j < RGBLIGHT_EFFECT_SNAKE_LENGTH; j++) { - k = pos + j * increment; - if (k < 0) { - k = k + RGBLED_NUM; - } - if (i == k) { - sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val*(RGBLIGHT_EFFECT_SNAKE_LENGTH-j)/RGBLIGHT_EFFECT_SNAKE_LENGTH), (LED_TYPE *)&led[i]); - } +#endif + +#ifdef RGBLIGHT_EFFECT_SNAKE +__attribute__((weak)) const uint8_t RGBLED_SNAKE_INTERVALS[] PROGMEM = {100, 50, 20}; + +void rgblight_effect_snake(animation_status_t *anim) { + static uint8_t pos = 0; + uint8_t i, j; + int8_t k; + int8_t increment = 1; + + if (anim->delta % 2) { + increment = -1; } - } - rgblight_set(); - if (increment == 1) { - if (pos - 1 < 0) { - pos = RGBLED_NUM - 1; + +# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + if (anim->pos == 0) { // restart signal + if (increment == 1) { + pos = effect_num_leds - 1; + } else { + pos = 0; + } + anim->pos = 1; + } +# endif + + // MxSS custom + fled_hs[0].hue = fled_hs[1].hue = 0; + fled_hs[0].sat = fled_hs[1].sat = 0; + + for (i = 0; i < effect_num_leds; i++) { + LED_TYPE *ledp = led + i + effect_start_pos; + ledp->r = 0; + ledp->g = 0; + ledp->b = 0; +# ifdef RGBW + ledp->w = 0; +# endif + for (j = 0; j < RGBLIGHT_EFFECT_SNAKE_LENGTH; j++) { + k = pos + j * increment; + if (k > RGBLED_NUM) { + k = k % RGBLED_NUM; + } + if (k < 0) { + k = k + effect_num_leds; + } + if (i == k) { + sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val * (RGBLIGHT_EFFECT_SNAKE_LENGTH - j) / RGBLIGHT_EFFECT_SNAKE_LENGTH), ledp); + } + } + } + rgblight_set(); + if (increment == 1) { + if (pos - 1 < 0) { + pos = effect_num_leds - 1; +# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + anim->pos = 0; +# endif + } else { + pos -= 1; +# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + anim->pos = 1; +# endif + } } else { - pos -= 1; + pos = (pos + 1) % effect_num_leds; +# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + anim->pos = pos; +# endif } - } else { - pos = (pos + 1) % RGBLED_NUM; - } } -void rgblight_effect_knight(uint8_t interval) { - static uint16_t last_timer = 0; - if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_KNIGHT_INTERVALS[interval])) { - return; - } - last_timer = timer_read(); - - static int8_t low_bound = 0; - static int8_t high_bound = RGBLIGHT_EFFECT_KNIGHT_LENGTH - 1; - static int8_t increment = 1; - uint8_t i, cur; - - // Set all the LEDs to 0 - for (i = 0; i < RGBLED_NUM; i++) { - led[i].r = 0; - led[i].g = 0; - led[i].b = 0; - } - // Determine which LEDs should be lit up - for (i = 0; i < RGBLIGHT_EFFECT_KNIGHT_LED_NUM; i++) { - cur = (i + RGBLIGHT_EFFECT_KNIGHT_OFFSET) % RGBLED_NUM; +#endif - if (i >= low_bound && i <= high_bound) { - sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[cur]); - } else { - if (i == RGBLIGHT_FLED1 || i == RGBLIGHT_FLED2) { - fled_hs[0].hue = fled_hs[1].hue = 0; - fled_hs[0].sat = fled_hs[1].sat = 0; - } - - led[cur].r = 0; - led[cur].g = 0; - led[cur].b = 0; +#ifdef RGBLIGHT_EFFECT_KNIGHT +__attribute__((weak)) const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63, 31}; + +void rgblight_effect_knight(animation_status_t *anim) { + static int8_t low_bound = 0; + static int8_t high_bound = RGBLIGHT_EFFECT_KNIGHT_LENGTH - 1; + static int8_t increment = 1; + uint8_t i, cur; + +# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + if (anim->pos == 0) { // restart signal + anim->pos = 1; + low_bound = 0; + high_bound = RGBLIGHT_EFFECT_KNIGHT_LENGTH - 1; + increment = 1; + } +# endif + // Set all the LEDs to 0 + for (i = effect_start_pos; i < effect_end_pos; i++) { + led[i].r = 0; + led[i].g = 0; + led[i].b = 0; +# ifdef RGBW + led[i].w = 0; +# endif + } + // Determine which LEDs should be lit up + for (i = 0; i < RGBLIGHT_EFFECT_KNIGHT_LED_NUM; i++) { + cur = (i + RGBLIGHT_EFFECT_KNIGHT_OFFSET) % effect_num_leds + effect_start_pos; + + if (i >= low_bound && i <= high_bound) { + sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[cur]); + } else { + // MxSS custom code + if (cur == RGBLIGHT_FLED1) { + fled_hs[0].hue = fled_hs[0].sat = 0; + } else if (cur == RGBLIGHT_FLED2) { + fled_hs[1].hue = fled_hs[1].sat = 0; + } + + led[cur].r = 0; + led[cur].g = 0; + led[cur].b = 0; +# ifdef RGBW + led[cur].w = 0; +# endif + } + } + rgblight_set(); + + // Move from low_bound to high_bound changing the direction we increment each + // time a boundary is hit. + low_bound += increment; + high_bound += increment; + + if (high_bound <= 0 || low_bound >= RGBLIGHT_EFFECT_KNIGHT_LED_NUM - 1) { + increment = -increment; +# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC) + if (increment == 1) { + anim->pos = 0; + } +# endif } - } - rgblight_set(); - - // Move from low_bound to high_bound changing the direction we increment each - // time a boundary is hit. - low_bound += increment; - high_bound += increment; - - if (high_bound <= 0 || low_bound >= RGBLIGHT_EFFECT_KNIGHT_LED_NUM - 1) { - increment = -increment; - } } +#endif +#ifdef RGBLIGHT_EFFECT_CHRISTMAS +void rgblight_effect_christmas(animation_status_t *anim) { + uint8_t hue; + uint8_t i; -void rgblight_effect_christmas(void) { - static uint16_t current_offset = 0; - static uint16_t last_timer = 0; - uint16_t hue; - uint8_t i; - if (timer_elapsed(last_timer) < RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL) { - return; - } - last_timer = timer_read(); - current_offset = (current_offset + 1) % 2; - for (i = 0; i < RGBLED_NUM; i++) { - hue = 0 + ((i/RGBLIGHT_EFFECT_CHRISTMAS_STEP + current_offset) % 2) * 120; - sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i]); - } - rgblight_set(); + anim->current_offset = (anim->current_offset + 1) % 2; + for (i = 0; i < effect_num_leds; i++) { + hue = 0 + ((i / RGBLIGHT_EFFECT_CHRISTMAS_STEP + anim->current_offset) % 2) * 85; + sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i + effect_start_pos]); + } + rgblight_set(); } +#endif -void rgblight_effect_rgbtest(void) { - static uint8_t pos = 0; - static uint16_t last_timer = 0; - static uint8_t maxval = 0; - uint8_t g; uint8_t r; uint8_t b; +#ifdef RGBLIGHT_EFFECT_RGB_TEST +__attribute__((weak)) const uint16_t RGBLED_RGBTEST_INTERVALS[] PROGMEM = {1024}; - if (timer_elapsed(last_timer) < pgm_read_word(&RGBLED_RGBTEST_INTERVALS[0])) { - return; - } +void rgblight_effect_rgbtest(animation_status_t *anim) { + static uint8_t maxval = 0; + uint8_t g; + uint8_t r; + uint8_t b; - if( maxval == 0 ) { - LED_TYPE tmp_led; - sethsv(0, 255, RGBLIGHT_LIMIT_VAL, &tmp_led); - maxval = tmp_led.r; - } - last_timer = timer_read(); - g = r = b = 0; - switch( pos ) { - case 0: r = maxval; break; - case 1: g = maxval; break; - case 2: b = maxval; break; - } - rgblight_setrgb(r, g, b); - pos = (pos + 1) % 3; + if (maxval == 0) { + LED_TYPE tmp_led; + sethsv(0, 255, RGBLIGHT_LIMIT_VAL, &tmp_led); + maxval = tmp_led.r; + } + g = r = b = 0; + switch (anim->pos) { + // MxSS custom code + case 0: + r = maxval; + fled_hs[0].hue = 0; + fled_hs[0].sat = 255; + fled_hs[1].hue = 0; + fled_hs[1].sat = 255; + break; + case 1: + g = maxval; + fled_hs[0].hue = 85; + fled_hs[0].sat = 255; + fled_hs[1].hue = 85; + fled_hs[1].sat = 255; + break; + case 2: + b = maxval; + fled_hs[0].hue = 170; + fled_hs[0].sat = 255; + fled_hs[1].hue = 170; + fled_hs[1].sat = 255; + break; + } + rgblight_setrgb(r, g, b); + anim->pos = (anim->pos + 1) % 3; } +#endif -#endif /* RGBLIGHT_ANIMATIONS */ +#ifdef RGBLIGHT_EFFECT_ALTERNATING +void rgblight_effect_alternating(animation_status_t *anim) { + for (int i = 0; i < effect_num_leds; i++) { + LED_TYPE *ledp = led + i + effect_start_pos; + if (i < effect_num_leds / 2 && anim->pos) { + sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, ledp); + } else if (i >= effect_num_leds / 2 && !anim->pos) { + sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, ledp); + } else { + sethsv(rgblight_config.hue, rgblight_config.sat, 0, ledp); + } + } + rgblight_set(); + anim->pos = (anim->pos + 1) % 2; +} +#endif diff --git a/keyboards/mxss/rgblight.h b/keyboards/mxss/rgblight.h index 0013a34386..e3aa098e4d 100644 --- a/keyboards/mxss/rgblight.h +++ b/keyboards/mxss/rgblight.h @@ -16,137 +16,245 @@ #ifndef RGBLIGHT_H #define RGBLIGHT_H -#ifdef RGBLIGHT_ANIMATIONS - #define RGBLIGHT_MODES 35 -#else - #define RGBLIGHT_MODES 1 -#endif - -#ifndef RGBLIGHT_EFFECT_BREATHE_CENTER -#define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1-2.7 -#endif - -#ifndef RGBLIGHT_EFFECT_BREATHE_MAX -#define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0-255 -#endif - -#ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH -#define RGBLIGHT_EFFECT_SNAKE_LENGTH 4 -#endif - -#ifndef RGBLIGHT_EFFECT_KNIGHT_LENGTH -#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3 -#endif - -#ifndef RGBLIGHT_EFFECT_KNIGHT_OFFSET -#define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0 -#endif - -#ifndef RGBLIGHT_EFFECT_KNIGHT_LED_NUM -#define RGBLIGHT_EFFECT_KNIGHT_LED_NUM RGBLED_NUM -#endif - -#ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL -#define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 1000 -#endif - -#ifndef RGBLIGHT_EFFECT_CHRISTMAS_STEP -#define RGBLIGHT_EFFECT_CHRISTMAS_STEP 2 -#endif - -#ifndef RGBLIGHT_HUE_STEP -#define RGBLIGHT_HUE_STEP 10 -#endif -#ifndef RGBLIGHT_SAT_STEP -#define RGBLIGHT_SAT_STEP 17 -#endif -#ifndef RGBLIGHT_VAL_STEP -#define RGBLIGHT_VAL_STEP 17 -#endif - -#define RGBLED_TIMER_TOP F_CPU/(256*64) +#include "rgblight_reconfig.h" + +/***** rgblight_mode(mode)/rgblight_mode_noeeprom(mode) **** + + old mode number (before 0.6.117) to new mode name table + +|-----------------|-----------------------------------| +| old mode number | new mode name | +|-----------------|-----------------------------------| +| 1 | RGBLIGHT_MODE_STATIC_LIGHT | +| 2 | RGBLIGHT_MODE_BREATHING | +| 3 | RGBLIGHT_MODE_BREATHING + 1 | +| 4 | RGBLIGHT_MODE_BREATHING + 2 | +| 5 | RGBLIGHT_MODE_BREATHING + 3 | +| 6 | RGBLIGHT_MODE_RAINBOW_MOOD | +| 7 | RGBLIGHT_MODE_RAINBOW_MOOD + 1 | +| 8 | RGBLIGHT_MODE_RAINBOW_MOOD + 2 | +| 9 | RGBLIGHT_MODE_RAINBOW_SWIRL | +| 10 | RGBLIGHT_MODE_RAINBOW_SWIRL + 1 | +| 11 | RGBLIGHT_MODE_RAINBOW_SWIRL + 2 | +| 12 | RGBLIGHT_MODE_RAINBOW_SWIRL + 3 | +| 13 | RGBLIGHT_MODE_RAINBOW_SWIRL + 4 | +| 14 | RGBLIGHT_MODE_RAINBOW_SWIRL + 5 | +| 15 | RGBLIGHT_MODE_SNAKE | +| 16 | RGBLIGHT_MODE_SNAKE + 1 | +| 17 | RGBLIGHT_MODE_SNAKE + 2 | +| 18 | RGBLIGHT_MODE_SNAKE + 3 | +| 19 | RGBLIGHT_MODE_SNAKE + 4 | +| 20 | RGBLIGHT_MODE_SNAKE + 5 | +| 21 | RGBLIGHT_MODE_KNIGHT | +| 22 | RGBLIGHT_MODE_KNIGHT + 1 | +| 23 | RGBLIGHT_MODE_KNIGHT + 2 | +| 24 | RGBLIGHT_MODE_CHRISTMAS | +| 25 | RGBLIGHT_MODE_STATIC_GRADIENT | +| 26 | RGBLIGHT_MODE_STATIC_GRADIENT + 1 | +| 27 | RGBLIGHT_MODE_STATIC_GRADIENT + 2 | +| 28 | RGBLIGHT_MODE_STATIC_GRADIENT + 3 | +| 29 | RGBLIGHT_MODE_STATIC_GRADIENT + 4 | +| 30 | RGBLIGHT_MODE_STATIC_GRADIENT + 5 | +| 31 | RGBLIGHT_MODE_STATIC_GRADIENT + 6 | +| 32 | RGBLIGHT_MODE_STATIC_GRADIENT + 7 | +| 33 | RGBLIGHT_MODE_STATIC_GRADIENT + 8 | +| 34 | RGBLIGHT_MODE_STATIC_GRADIENT + 9 | +| 35 | RGBLIGHT_MODE_RGB_TEST | +| 36 | RGBLIGHT_MODE_ALTERNATING | +|-----------------|-----------------------------------| + *****/ + +#define _RGBM_SINGLE_STATIC(sym) RGBLIGHT_MODE_##sym, +#define _RGBM_SINGLE_DYNAMIC(sym) RGBLIGHT_MODE_##sym, +#define _RGBM_MULTI_STATIC(sym) RGBLIGHT_MODE_##sym, +#define _RGBM_MULTI_DYNAMIC(sym) RGBLIGHT_MODE_##sym, +#define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_##sym, +#define _RGBM_TMP_DYNAMIC(sym, msym) RGBLIGHT_MODE_##sym, +enum RGBLIGHT_EFFECT_MODE { + RGBLIGHT_MODE_zero = 0, +#include "rgblight_modes.h" + RGBLIGHT_MODE_last +}; + +#ifndef RGBLIGHT_H_DUMMY_DEFINE + +# define RGBLIGHT_MODES (RGBLIGHT_MODE_last - 1) + +// sample: #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 + +# ifndef RGBLIGHT_EFFECT_BREATHE_MAX +# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0-255 +# endif + +# ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH +# define RGBLIGHT_EFFECT_SNAKE_LENGTH 4 +# endif + +# ifndef RGBLIGHT_EFFECT_KNIGHT_LENGTH +# define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3 +# endif + +# ifndef RGBLIGHT_EFFECT_KNIGHT_OFFSET +# define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0 +# endif + +# ifndef RGBLIGHT_EFFECT_KNIGHT_LED_NUM +# define RGBLIGHT_EFFECT_KNIGHT_LED_NUM (effect_num_leds) +# endif + +# ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL +# define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 1000 +# endif + +# ifndef RGBLIGHT_EFFECT_CHRISTMAS_STEP +# define RGBLIGHT_EFFECT_CHRISTMAS_STEP 2 +# endif + +# ifndef RGBLIGHT_HUE_STEP +# define RGBLIGHT_HUE_STEP 8 +# endif +# ifndef RGBLIGHT_SAT_STEP +# define RGBLIGHT_SAT_STEP 17 +# endif +# ifndef RGBLIGHT_VAL_STEP +# define RGBLIGHT_VAL_STEP 17 +# endif +# ifndef RGBLIGHT_LIMIT_VAL +# define RGBLIGHT_LIMIT_VAL 255 +# endif + +# define RGBLED_TIMER_TOP F_CPU / (256 * 64) // #define RGBLED_TIMER_TOP 0xFF10 -#include <stdint.h> -#include <stdbool.h> -#include "eeconfig.h" -#ifndef RGBLIGHT_CUSTOM_DRIVER -#include "ws2812.h" -#endif -#include "color.h" -#include "rgblight_list.h" +# include <stdint.h> +# include <stdbool.h> +# include "eeconfig.h" +# ifndef RGBLIGHT_CUSTOM_DRIVER +# include "ws2812.h" +# endif +# include "color.h" +# include "rgblight_list.h" + +# if defined(__AVR__) +# include <avr/pgmspace.h> +# endif extern LED_TYPE led[RGBLED_NUM]; -extern const uint8_t RGBLED_BREATHING_INTERVALS[4] PROGMEM; -extern const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[3] PROGMEM; -extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM; -extern const uint8_t RGBLED_SNAKE_INTERVALS[3] PROGMEM; -extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM; +extern const uint8_t RGBLED_BREATHING_INTERVALS[4] PROGMEM; +extern const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[3] PROGMEM; +extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM; +extern const uint8_t RGBLED_SNAKE_INTERVALS[3] PROGMEM; +extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM; extern const uint16_t RGBLED_RGBTEST_INTERVALS[1] PROGMEM; +extern bool is_rgblight_initialized; +// Should stay in sycn with rgb matrix config as we reuse eeprom storage for both (for now) typedef union { - uint32_t raw; - struct { - bool enable :1; - uint8_t mode :6; - uint16_t hue :9; - uint8_t sat :8; - uint8_t val :8; - uint8_t speed :8;//EECONFIG needs to be increased to support this - }; + uint32_t raw; + struct { + bool enable : 1; + uint8_t mode : 7; + uint8_t hue : 8; + uint8_t sat : 8; + uint8_t val : 8; + uint8_t speed : 8; // EECONFIG needs to be increased to support this + }; } rgblight_config_t; -void rgblight_init(void); +typedef struct _rgblight_status_t { + uint8_t base_mode; + bool timer_enabled; +# ifdef RGBLIGHT_SPLIT + uint8_t change_flags; +# endif +} rgblight_status_t; + +/* === Utility Functions ===*/ +void sethsv(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); +void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); // without RGBLIGHT_LIMIT_VAL check +void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1); + +/* === Low level Functions === */ +void rgblight_set(void); +void rgblight_set_clipping_range(uint8_t start_pos, uint8_t num_leds); + +/* === Effects and Animations Functions === */ +/* effect range setting */ +void rgblight_set_effect_range(uint8_t start_pos, uint8_t num_leds); + +/* direct operation */ +void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index); +void rgblight_sethsv_at(uint8_t hue, uint8_t sat, uint8_t val, uint8_t index); +void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8_t end); +void rgblight_sethsv_range(uint8_t hue, uint8_t sat, uint8_t val, uint8_t start, uint8_t end); +void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b); + +# ifndef RGBLIGHT_SPLIT +void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b); +void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b); +void rgblight_sethsv_master(uint8_t hue, uint8_t sat, uint8_t val); +void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val); +# endif + +/* effect mode change */ +void rgblight_mode(uint8_t mode); +void rgblight_mode_noeeprom(uint8_t mode); void rgblight_increase(void); void rgblight_decrease(void); +void rgblight_step(void); +void rgblight_step_noeeprom(void); +void rgblight_step_reverse(void); +void rgblight_step_reverse_noeeprom(void); + +/* effects mode disable/enable */ void rgblight_toggle(void); +void rgblight_toggle_noeeprom(void); void rgblight_enable(void); +void rgblight_enable_noeeprom(void); void rgblight_disable(void); -void rgblight_step(void); -void rgblight_step_reverse(void); -uint8_t rgblight_get_mode(void); -void rgblight_mode(uint8_t mode); -void rgblight_set(void); -void rgblight_update_dword(uint32_t dword); +void rgblight_disable_noeeprom(void); + +/* hue, sat, val change */ void rgblight_increase_hue(void); +void rgblight_increase_hue_noeeprom(void); void rgblight_decrease_hue(void); +void rgblight_decrease_hue_noeeprom(void); void rgblight_increase_sat(void); +void rgblight_increase_sat_noeeprom(void); void rgblight_decrease_sat(void); +void rgblight_decrease_sat_noeeprom(void); void rgblight_increase_val(void); +void rgblight_increase_val_noeeprom(void); void rgblight_decrease_val(void); +void rgblight_decrease_val_noeeprom(void); void rgblight_increase_speed(void); void rgblight_decrease_speed(void); -void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val); -uint16_t rgblight_get_hue(void); +void rgblight_sethsv(uint8_t hue, uint8_t sat, uint8_t val); +void rgblight_sethsv_noeeprom(uint8_t hue, uint8_t sat, uint8_t val); + +/* query */ +uint8_t rgblight_get_mode(void); +uint8_t rgblight_get_hue(void); uint8_t rgblight_get_sat(void); uint8_t rgblight_get_val(void); -void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b); -void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index); -void rgblight_sethsv_at(uint16_t hue, uint8_t sat, uint8_t val, uint8_t index); +/* === qmk_firmware (core)internal Functions === */ +void rgblight_init(void); +uint32_t rgblight_read_dword(void); +void rgblight_update_dword(uint32_t dword); uint32_t eeconfig_read_rgblight(void); -void eeconfig_update_rgblight(uint32_t val); -void eeconfig_update_rgblight_default(void); -void eeconfig_debug_rgblight(void); +void eeconfig_update_rgblight(uint32_t val); +void eeconfig_update_rgblight_default(void); +void eeconfig_debug_rgblight(void); void rgb_matrix_increase(void); void rgb_matrix_decrease(void); -void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); -void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1); - -void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val); -void rgblight_mode_noeeprom(uint8_t mode); -void rgblight_toggle_noeeprom(void); -void rgblight_enable_noeeprom(void); -void rgblight_disable_noeeprom(void); - -void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom); +void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom); void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom); - -#define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF) +# define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF) void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b); void rgblight_task(void); @@ -155,12 +263,52 @@ void rgblight_timer_init(void); void rgblight_timer_enable(void); void rgblight_timer_disable(void); void rgblight_timer_toggle(void); -void rgblight_effect_breathing(uint8_t interval); -void rgblight_effect_rainbow_mood(uint8_t interval); -void rgblight_effect_rainbow_swirl(uint8_t interval); -void rgblight_effect_snake(uint8_t interval); -void rgblight_effect_knight(uint8_t interval); -void rgblight_effect_christmas(void); -void rgblight_effect_rgbtest(void); - -#endif + +# ifdef RGBLIGHT_SPLIT +# define RGBLIGHT_STATUS_CHANGE_MODE (1 << 0) +# define RGBLIGHT_STATUS_CHANGE_HSVS (1 << 1) +# define RGBLIGHT_STATUS_CHANGE_TIMER (1 << 2) +# define RGBLIGHT_STATUS_ANIMATION_TICK (1 << 3) + +typedef struct _rgblight_syncinfo_t { + rgblight_config_t config; + rgblight_status_t status; +} rgblight_syncinfo_t; + +/* for split keyboard master side */ +uint8_t rgblight_get_change_flags(void); +void rgblight_clear_change_flags(void); +void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo); +/* for split keyboard slave side */ +void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom); +# endif + +# ifdef RGBLIGHT_USE_TIMER + +typedef struct _animation_status_t { + uint16_t last_timer; + uint8_t delta; /* mode - base_mode */ + bool restart; + union { + uint16_t pos16; + uint8_t pos; + int8_t current_hue; + uint16_t current_offset; + }; +} animation_status_t; + +extern animation_status_t animation_status; + +void rgblight_effect_breathing(animation_status_t *anim); +void rgblight_effect_rainbow_mood(animation_status_t *anim); +void rgblight_effect_rainbow_swirl(animation_status_t *anim); +void rgblight_effect_snake(animation_status_t *anim); +void rgblight_effect_knight(animation_status_t *anim); +void rgblight_effect_christmas(animation_status_t *anim); +void rgblight_effect_rgbtest(animation_status_t *anim); +void rgblight_effect_alternating(animation_status_t *anim); + +# endif + +#endif // #ifndef RGBLIGHT_H_DUMMY_DEFINE +#endif // RGBLIGHT_H diff --git a/keyboards/mxss/rules.mk b/keyboards/mxss/rules.mk index f9210319e3..a1ca27ca46 100644 --- a/keyboards/mxss/rules.mk +++ b/keyboards/mxss/rules.mk @@ -14,7 +14,7 @@ BOOTLOADER = atmel-dfu # Build Options # change yes to no to disable # -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) CONSOLE_ENABLE = no # Console for debug(+400) @@ -30,10 +30,12 @@ BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID AUDIO_ENABLE = no # Audio output on port C6 FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches +SRC += mxss_frontled.c + # Remove the common RGB light code and use my iteration instead OPT_DEFS += -DRGBLIGHT_ENABLE SRC += $(QUANTUM_DIR)/process_keycode/process_rgb.c SRC += rgblight.c +SRC += color.c SRC += ws2812.c CIE1931_CURVE = yes -LED_BREATHING_TABLE = yes diff --git a/keyboards/mxss/templates/keymap.c b/keyboards/mxss/templates/keymap.c index 13dbb7206c..a18cff77f0 100644 --- a/keyboards/mxss/templates/keymap.c +++ b/keyboards/mxss/templates/keymap.c @@ -14,23 +14,24 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include QMK_KEYBOARD_H -#include "mxss_frontled.h" -// Predefined colors for layers +hs_set caps_color = { .hue = 0, .sat = 255 }; + +// Colors for layers // Format: {hue, saturation} // {0, 0} to turn off the LED // Add additional rows to handle more layers -hs_set layer_colors[] = { - [0] = {0, 0}, // Color for Layer 0 - [1] = {86, 255}, // Color for Layer 1 - [2] = {36, 255}, // Color for Layer 2 - [3] = {185, 255}, // Color for Layer 3 +hs_set layer_colors[4] = { + [0] = {.hue = 0, .sat = 0}, // Color for Layer 0 + [1] = {.hue = 86, .sat = 255}, // Color for Layer 1 + [2] = {.hue = 36, .sat = 255}, // Color for Layer 2 + [3] = {.hue = 185, .sat = 255}, // Color for Layer 3 }; -const size_t lc_size = sizeof(layer_colors) / sizeof(uint16_t); +size_t lc_size = sizeof(layer_colors) / sizeof(uint16_t); // Use NEW_SAFE_RANGE to define new custom keycodes in order to not overwrite the ones used for front LED control enum custom_keycodes { - MY_KEYCODE = NEW_SAFE_RANGE, + MY_KEYCODE = NEW_SAFE_RANGE, }; diff --git a/keyboards/noxary/268_2/268_2.c b/keyboards/noxary/268_2/268_2.c index 9e2d822364..5af56a386d 100644 --- a/keyboards/noxary/268_2/268_2.c +++ b/keyboards/noxary/268_2/268_2.c @@ -21,7 +21,6 @@ void led_set_kb(uint8_t usb_led) { writePinHigh(B0); } else { setPinInput(B0); - writePinLow(B0); } led_set_user(usb_led); diff --git a/keyboards/numatreus/config.h b/keyboards/numatreus/config.h new file mode 100644 index 0000000000..5b16ef34d8 --- /dev/null +++ b/keyboards/numatreus/config.h @@ -0,0 +1,100 @@ +/* +Copyright 2019 yohei <yohewi@gmail.com> +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ + +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0xE80A +#define DEVICE_VER 0x0001 +#define MANUFACTURER yohewi +#define PRODUCT NumAtreus +#define DESCRIPTION QMK keyboard firmware for NumAtreus + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 11 + + +// wiring of each half +#define MATRIX_ROW_PINS { C6, D7, E6, B4 } +#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2, D2, D1, D0, D4 } + + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION ROW2COL + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +//#define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* ws2812 RGB LED */ +#define RGB_DI_PIN D3 + +// keyboard RGB LED support +//#define RGBLIGHT_ANIMATIONS : see ./rules.mk: LED_ANIMATIONS = yes or no +// see ./rules.mk: LED_BACK_ENABLE or LED_UNDERGLOW_ENABLE set yes +#define RGBLED_NUM 6 + +#define RGBLIGHT_LIMIT_VAL 200 +#define RGBLIGHT_VAL_STEP 17 + +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 + +#if defined(RGBLIGHT_ENABLE) +// USB_MAX_POWER_CONSUMPTION value for stonehenge30 keyboard +// 120 RGBoff, OLEDoff +// 120 OLED +// 330 RGB 6 +// 300 RGB 32 +// 310 OLED & RGB 32 + #define USB_MAX_POWER_CONSUMPTION 400 +#else + // fix iPhone and iPad power adapter issue + // iOS device need lessthan 100 + #define USB_MAX_POWER_CONSUMPTION 100 +#endif + + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION diff --git a/keyboards/numatreus/info.json b/keyboards/numatreus/info.json new file mode 100644 index 0000000000..452d2a9150 --- /dev/null +++ b/keyboards/numatreus/info.json @@ -0,0 +1,12 @@ +{ + "keyboard_name": "numatreus", + "url": "", + "maintainer": "qmk", + "width": 13, + "height": 4.7, + "layouts": { + "LAYOUT": { + "layout": [{"x":0, "y":0.6}, {"x":1, "y":0.35}, {"x":2, "y":0}, {"x":3, "y":0.35}, {"x":4, "y":0.7}, {"x":8, "y":0.7}, {"x":9, "y":0.35}, {"x":10, "y":0}, {"x":11, "y":0.35}, {"x":12, "y":0.6}, {"x":0, "y":1.6}, {"x":1, "y":1.35}, {"x":2, "y":1}, {"x":3, "y":1.35}, {"x":4, "y":1.7}, {"x":8, "y":1.7}, {"x":9, "y":1.35}, {"x":10, "y":1}, {"x":11, "y":1.35}, {"x":12, "y":1.6}, {"x":0, "y":2.6}, {"x":1, "y":2.35}, {"x":2, "y":2}, {"x":3, "y":2.35}, {"x":4, "y":2.7}, {"x":8, "y":2.7}, {"x":9, "y":2.35}, {"x":10, "y":2}, {"x":11, "y":2.35}, {"x":12, "y":2.6}, {"x":0, "y":3.6}, {"x":1, "y":3.35}, {"x":2, "y":3}, {"x":3, "y":3.35}, {"x":4, "y":3.7}, {"x":5, "y":2.95, "h":1.5}, {"x":7, "y":2.95, "h":1.5}, {"x":8, "y":3.7}, {"x":9, "y":3.35}, {"x":10, "y":3}, {"x":11, "y":3.35}, {"x":12, "y":3.6}] + } + } +} diff --git a/keyboards/numatreus/keymaps/default/keymap.c b/keyboards/numatreus/keymaps/default/keymap.c new file mode 100644 index 0000000000..99053002fb --- /dev/null +++ b/keyboards/numatreus/keymaps/default/keymap.c @@ -0,0 +1,60 @@ +#include QMK_KEYBOARD_H + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +enum layer_number { + _QWERTY, + _LOWER, + _RAISE, +}; + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + LOWER, + RAISE, +}; + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT( /* Qwerty */ + /* + * Q W E R T || Y U I O P + * A S D F G || H J K L ; + * Z X C V B || N M , . / + * SFT TAB CTL LW space bksp||ALT Ent RS - ' = + */ + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P , + KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN , + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH , + KC_LSFT, KC_TAB, KC_LCTL, MO(_LOWER), KC_SPC, KC_BSPC, KC_LALT, KC_ENT, MO(_RAISE), KC_MINS, KC_QUOT, KC_PEQL + ), + + /* + * 1 2 3 4 5 || 6 7 8 9 0 + * F1 F2 F3 F4 F5 || F6 F7 F8 F9 F10 + * F11 F12 ( ) & || ` [ ] + \ + * lower insert super shift space bksp|| alt Ent fn . - = + */ + [_RAISE] = LAYOUT( /* [> RAISE <] */ + KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0 , + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 , + KC_F11, KC_F12, KC_LPRN, KC_RPRN, KC_AMPR, KC_GRV, KC_LBRC, KC_RBRC, KC_PSLS, KC_BSLS , + KC_NO, KC_INS, KC_LGUI, KC_LSFT, KC_SPC, KC_BSPC, KC_LALT, KC_ENT, KC_TRNS, KC_DOT, KC_PMNS, KC_EQL ), + + + /* + * ! @ # $ % || ^ & * ( ) + * DEL ESC || PGDN PGUP PSCR + * CAPS volup ENT reset || UP + * voldn super shift space bspc|| alt ent LEFT DOWN RGHT + */ + [_LOWER] = LAYOUT( /* [> LOWER <] */ + KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN , + KC_DELT, KC_ESC, KC_NO, KC_NO, KC_NO, KC_PGDN, KC_PGUP, KC_PSCR, KC_NO, KC_NO, + KC_CAPS, KC_VOLU, KC_NO, KC_ENT, RESET, KC_NO, KC_NO, KC_NO, KC_UP, KC_NO , + KC_NO, KC_VOLD, KC_LGUI, KC_LSFT, KC_SPC, KC_BSPC, KC_LALT, KC_ENT, KC_NO, KC_LEFT, KC_DOWN, KC_RGHT ) + +}; diff --git a/keyboards/numatreus/keymaps/hdbx/keymap.c b/keyboards/numatreus/keymaps/hdbx/keymap.c new file mode 100644 index 0000000000..98fe4d67d8 --- /dev/null +++ b/keyboards/numatreus/keymaps/hdbx/keymap.c @@ -0,0 +1,230 @@ +// WindowsでJIS配列として認識しているときに、オシャレなUS配列用キーキャップを使うためのキーマップです。 +// Google日本語入力の場合、以下のキー設定を行うとLower,Raiseのタップでそれぞれ半角入力と全角入力を切り替えできるようになります。 +// ・Henkan(入力文字なし/直接入力)に「IMEを有効化」を割り当て +// ・Muhenkan(入力文字なし/直接入力)に「IMEを無効化」を割り当て + +#include QMK_KEYBOARD_H +#include "keymap_jp.h" // qmk_firmware-master/quantum/keymap_extras/keymap_jp.h 日本語キーボード設定用 +#include <sendstring_jis.h> // macro sendstring for jis keyboard マクロ文字列送信時に日本語キーボード設定での文字化け回避 + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +enum layer_number { + _QWERTY, + _HDBX, + _LOWER, + _RAISE, + _GAME, + _ADJUST +}; + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + HDBX, + MCR1, // マクロ1 + MCR2, // マクロ2 + MCR3, // マクロ3 + MCR4, // マクロ4 + MCR5, // マクロ5 + WN_SCLN, // タップでJISの「:」 シフトでJISの「;」 (Windows) + DM_PLY1, + DM_PLY2, + DM_REC1, + DM_REC2, + DM_RSTP, +}; + +// Use Dynamic macro + +// Fillers to make layering more clear +#define LOWER LT(_LOWER, KC_MHEN) // タップで無変換 ホールドでLower +#define RAISE LT(_RAISE, KC_HENK) // タップで変換 ホールドでRaise +#define GUI_ESC GUI_T(KC_ESC) // タップでESC ホールドでGUI +#define SFT_BS SFT_T(KC_BSPC) // タップでBackSpace ホールドでSHIFT +#define CTL_ENT CTL_T(KC_ENT) // タップでEnter ホールドでCTRL +#define CTL_TAB CTL_T(KC_TAB) // タップでTAB ホールドでCTRL +#define SFT_DEL SFT_T(KC_DEL) // タップでDELETE ホールドでSHIFT +#define ALT_LBR ALT_T(JP_LBRC) // タップで[ ホールドでALT +#define SFT_RBR SFT_T(JP_RBRC) // タップで] ホールドでSHIFT +#define SFT_SPC S(KC_SPC) // Shift + Space +#define WN_CAPS S(KC_CAPS) // Caps Lock (Windows) +#define GAME TO(_GAME) // _GAMEレイヤーへ移動 +#define ADJUST TO(_ADJUST) // _ADJUSTレイヤーへ移動 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Qwerty配列 + * ,----------------------------------. ,----------------------------------. + * | Q | W | E | R | T | | Y | U | I | O | P | + * |------+------+------+------+------| |------+------+------+------+------| + * | A | S | D | F | G | | H | J | K | L | ; | + * |------+------+------+------+------| |------+------+------+------+------| + * | Z | X | C | V | B | | N | M | , | . | / | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * |Alt/[ |WINESC| ~ |Sft/Bs|Lower |CtlEnt|Space |Raise |CtrlTb| - | ' |Sft/] | + * `-----------------------------------------------------------------------------------' + */ + [_QWERTY] = LAYOUT( + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, + KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, WN_SCLN, + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, + ALT_LBR, GUI_ESC, JP_TILD, SFT_BS, LOWER, CTL_ENT, KC_SPC, RAISE, CTL_TAB, KC_MINS, JP_QUOT, SFT_RBR + ), + + /* HDBX配列 デフォルトレイヤーをこの配列にしたい場合は、AdjustレイヤーでK (Lower + Raise + K) + * ,----------------------------------. ,----------------------------------. + * | Q | W | E | , | . | | Y | D | P | F | : | + * |------+------+------+------+------| |------+------+------+------+------| + * | A | I | O | U | G | | M | N | T | R | S | + * |------+------+------+------+------| |------+------+------+------+------| + * | Z | X | C | V | B | | H | J | K | L | / | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * |Alt/[ |WINESC| ~ |Sft/Bs|Lower |CtlEnt|Space |Raise |CtrlTb| - | ' |Sft/] | + * `-----------------------------------------------------------------------------------' + */ + [_HDBX] = LAYOUT( + KC_Q, KC_W, KC_E, KC_COMM, KC_DOT, KC_Y, KC_D, KC_P, KC_F, WN_SCLN, + KC_A, KC_I, KC_O, KC_U, KC_G, KC_M, KC_N, KC_T, KC_R, KC_S, + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_H, KC_J, KC_K, KC_L, KC_SLSH, + ALT_LBR, GUI_ESC, JP_TILD, SFT_BS, LOWER, CTL_ENT, KC_SPC, RAISE, CTL_TAB, KC_MINS, JP_QUOT, SFT_RBR + ), + + /* Lower + * ,----------------------------------. ,----------------------------------. + * | F1 | F2 | F3 | F4 | F5 | | 7 | 8 | 9 | . | Bspc | + * |------+------+------+------+------| |------+------+------+------+------| + * | F6 | F7 | F8 | F9 | F10 | | 4 | 5 | 6 | + | * | + * |------+------+------+------+------| |------+------+------+------+------| + * |Zen/Ha|ScLock|Pause | F11 | F12 | | 1 | 2 | 3 | - | / | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Alt | WIN | ` |SftDel|Lower | Ctrl |SftSpc|Raise | 0 | , | = |Enter | + * `-----------------------------------------------------------------------------------' + */ + [_LOWER] = LAYOUT( + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_7, KC_8, KC_9, KC_DOT, KC_BSPC, + KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_4, KC_5, KC_6, KC_PPLS, KC_PAST, + KC_ZKHK, KC_SLCK, KC_PAUS, KC_F11, KC_F12, KC_1, KC_2, KC_3, KC_PMNS, KC_PSLS, + KC_LALT, KC_LGUI, JP_GRV, SFT_DEL, _______, KC_LCTL, SFT_SPC, _______, KC_0, KC_COMM, JP_EQL, KC_ENT + ), + + /* Raise + * ,----------------------------------. ,----------------------------------. + * | ! | @ | # | $ | % | | Home | App | Ins | Calc |PrtScr| + * |------+------+------+------+------| |------+------+------+------+------| + * | ^ | & | * | \ | | | | Left | Down | Up |Right | ; | + * |------+------+------+------+------| |------+------+------+------+------| + * | ` | { | } | < | > | | End | Mute | ( | ) | ? | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Alt | WIN | ` | Del |Lower | Ctrl | Caps |Raise | Ctrl | _ | " |Shift | + * `-----------------------------------------------------------------------------------' + */ + [_RAISE] = LAYOUT( + KC_EXLM, JP_AT, KC_HASH, KC_DLR, KC_PERC, KC_HOME, KC_APP, KC_INS, KC_CALC, KC_PSCR, + JP_CIRC, JP_AMPR, JP_ASTR, JP_YEN, JP_PIPE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_SCLN, + JP_GRV, JP_LCBR, JP_RCBR, KC_LT, KC_GT, KC_END, KC_MUTE, JP_LPRN, JP_RPRN, KC_QUES, + KC_LALT, KC_LGUI, JP_GRV, KC_DEL, _______, KC_LCTL, WN_CAPS, _______, KC_RCTL, JP_UNDS, JP_DQT, KC_RSFT + ), + + /* GAME ゲームやテンキー固定で使用するレイヤーです。AdjustレイヤーでGを押下して遷移。戻るときはtoBaseから。 + * ,----------------------------------. ,----------------------------------. + * | Q | Up | E | R | T | | 7 | 8 | 9 | . | Bspc | + * |------+------+------+------+------| |------+------+------+------+------| + * | Left | Down |Right | F | G | | 4 | 5 | 6 | + | * | + * |------+------+------+------+------| |------+------+------+------+------| + * | Z | X | C | V | B | | 1 | 2 | 3 | - | / | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Alt | Esc | Tab |Shift |Space | Ctrl |toBase| \ | 0 | , | = |Enter | + * `-----------------------------------------------------------------------------------' + */ + [_GAME] = LAYOUT( + KC_Q, KC_UP, KC_E, KC_R, KC_T, KC_7, KC_8, KC_9, KC_DOT, KC_BSPC, + KC_LEFT, KC_DOWN, KC_RGHT, KC_F, KC_G, KC_4, KC_5, KC_6, KC_PPLS, KC_PAST, + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_1, KC_2, KC_3, KC_PMNS, KC_PSLS, + KC_LALT, KC_ESC, KC_TAB, KC_LSFT, KC_SPC, KC_LCTL, ADJUST, JP_YEN, KC_0, KC_COMM, JP_EQL, KC_ENT + ), + + /* Adjust (Lower + Raise) + * ,----------------------------------. ,----------------------------------. + * | MCR1 | MCR2 | MCR3 | MCR4 | MCR5 | |DyMcr1|DyMcr2|RcMcr1|RcMcr2|StpRec| + * |------+------+------+------+------| |------+------+------+------+------| + * | | | | |ToGAME| | |Qwerty| HDBX | | | + * |------+------+------+------+------| |------+------+------+------+------| + * | | | | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * |RESET | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ + [_ADJUST] = LAYOUT( + MCR1, MCR2, MCR3, MCR4, MCR5, DM_PLY1, DM_PLY2, DM_REC1, DM_REC2, DM_RSTP, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, GAME, XXXXXXX, QWERTY, HDBX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + RESET, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + ) +}; + +layer_state_t layer_state_set_user(layer_state_t state) { + state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); +return state; +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + return false; + break; + case HDBX: + if (record->event.pressed) { + set_single_persistent_default_layer(_HDBX); + } + return false; + break; + static bool lshift = false; + case WN_SCLN: // コロン「;:」 + if (record->event.pressed) { + lshift = get_mods() & MOD_BIT(KC_LSFT); + if (lshift) { + unregister_code(KC_LSFT); + tap_code(JP_SCLN); + } else { + tap_code(JP_SCLN); + } + } + return false; + break; + case MCR1: + if (record->event.pressed) { + SEND_STRING("0123456789"); // 送信文字列 + } + return false; + break; + case MCR2: + if (record->event.pressed) { + SEND_STRING("hogehoge\n"); // 送信文字列 + } + return false; + break; + case MCR3: + if (record->event.pressed) { + SEND_STRING("hoge@hoge.hoge"); // 送信文字列 + } + return false; + break; + case MCR4: + if (record->event.pressed) { + SEND_STRING("\"\""SS_TAP(X_LEFT)); // 送信文字列 + } + return false; + break; + case MCR5: + if (record->event.pressed) { + SEND_STRING("<>"SS_TAP(X_LEFT)); // 送信文字列 + } + return false; + break; + } + return true; +} diff --git a/keyboards/numatreus/keymaps/hdbx/rules.mk b/keyboards/numatreus/keymaps/hdbx/rules.mk new file mode 100644 index 0000000000..d4e78b385c --- /dev/null +++ b/keyboards/numatreus/keymaps/hdbx/rules.mk @@ -0,0 +1,3 @@ +MOUSEKEY_ENABLE = no +EXTRAKEY_ENABLE = yes +DYNAMIC_MACRO_ENABLE = yes
\ No newline at end of file diff --git a/keyboards/numatreus/keymaps/like_jis/config.h b/keyboards/numatreus/keymaps/like_jis/config.h new file mode 100644 index 0000000000..961de83e42 --- /dev/null +++ b/keyboards/numatreus/keymaps/like_jis/config.h @@ -0,0 +1,59 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako <wakojun@gmail.com> +Copyright 2015 Jack Humbert + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +// place overrides here + +#ifdef TAPPING_TERM +#undef TAPPING_TERM +#endif +#define TAPPING_TERM 225 +#define IGNORE_MOD_TAP_INTERRUPT + +#ifdef MOUSEKEY_ENABLE + #undef MOUSEKEY_INTERVAL + #define MOUSEKEY_INTERVAL 1 + + #undef MOUSEKEY_TIME_TO_MAX + #define MOUSEKEY_TIME_TO_MAX 150 + + #undef MOUSEKEY_MAX_SPEED + #define MOUSEKEY_MAX_SPEED 3 + + #undef MOUSEKEY_MOVE_DELTA + #define MOUSEKEY_MOVE_DELTA 4 + + #undef MOUSEKEY_DELAY + #define MOUSEKEY_DELAY 0 +#endif + +// Selection of RGBLIGHT MODE to use. +#if defined(LED_ANIMATIONS) + //#define RGBLIGHT_EFFECT_BREATHING + #define RGBLIGHT_EFFECT_RAINBOW_MOOD + #define RGBLIGHT_EFFECT_RAINBOW_SWIRL + //#define RGBLIGHT_EFFECT_SNAKE + #define RGBLIGHT_EFFECT_KNIGHT + //#define RGBLIGHT_EFFECT_CHRISTMAS + #define RGBLIGHT_EFFECT_STATIC_GRADIENT + //#define RGBLIGHT_EFFECT_RGB_TEST + //#define RGBLIGHT_EFFECT_ALTERNATING +#endif diff --git a/keyboards/numatreus/keymaps/like_jis/keymap.c b/keyboards/numatreus/keymaps/like_jis/keymap.c new file mode 100644 index 0000000000..eb9e9230d7 --- /dev/null +++ b/keyboards/numatreus/keymaps/like_jis/keymap.c @@ -0,0 +1,196 @@ +#include QMK_KEYBOARD_H +#include "keymap_jp.h" + + +#ifdef RGBLIGHT_ENABLE +//Following line allows macro to read current RGB settings +extern rgblight_config_t rgblight_config; +#endif + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +enum layer_number { + _BASE = 0, + _NUMPAD, + _LOWER, + _RAISE, + _ADJUST, +}; + +enum custom_keycodes { + BASE = SAFE_RANGE, + NUMPAD, + KANJI, + LOWER, + RAISE, + ADJUST, + RGBRST +}; + +enum tapdances{ + TD_CODO = 0, + // TD_MNUB, +}; + +// Layer Mode aliases +#define KC_LOWER LOWER +#define KC_RAISE RAISE +#define KC_ADJST ADJUST +#define KC_DLNP NUMPAD //DF(_NUMPAD) +#define KC_DLBS BASE //DF(_BASE) + +#define KC_ZSFT LSFT_T(KC_Z) +#define KC_MNSF LSFT_T(KC_MINS) +#define KC_ESCT LCTL_T(KC_ESC) +#define KC_TBAL LALT_T(KC_TAB) +#define KC_11SF LSFT_T(KC_F11) +#define KC_ALAP LALT_T(KC_APP) +#define KC_JEQL LSFT(KC_MINS) +#define KC_WLCK LALT(KC_L) +#define KC_SFEQ LSFT(KC_MINS) +#define KC_SFPL LSFT(KC_SCLN) +#define KC_SFAS LSFT(KC_QUOT) + +#define KC_CODO TD(TD_CODO) +// #define KC_MNUB TD(TD_MNUB) + +qk_tap_dance_action_t tap_dance_actions[] = { + [TD_CODO] = ACTION_TAP_DANCE_DOUBLE(KC_COMM, KC_DOT), + // [TD_MNUB] = ACTION_TAP_DANCE_DOUBLE(KC_MINS, LSFT(KC_RO)), +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT( + //,----------------------------------. ,----------------------------------. + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, + //|------+------+------+------+------| |------+------+------+------+------| + KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT, + //|------+------+------+------+------| |------+------+------+------+------| + KC_ZSFT, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_CODO, KC_UP, KC_MNSF, + //|------+------+------+------+------|------+------+------+------+------+------+------| + KC_ESCT, KC_TBAL, KC_LGUI, KC_LOWER, KC_BSPC, KC_BSPC, KC_SPC, KC_SPC, KC_RAISE, KC_LEFT, KC_DOWN, KC_RGHT + //|------+------+------+------+-------------+------+------+------+------+------+------| + ), + + [_NUMPAD] = LAYOUT( + //,----------------------------------. ,----------------------------------. + KC_P7, KC_P8, KC_P9, KC_PAST, KC_NLCK, KC_P7, KC_P8, KC_P9, KC_PAST, KC_NLCK, + //|------+------+------+------+------| |------+------+------+------+------| + KC_P4, KC_P5, KC_P6, KC_PMNS, KC_PSLS, KC_P4, KC_P5, KC_P6, KC_PMNS, KC_PSLS, + //|------+------+------+------+------| |------+------+------+------+------| + KC_P1, KC_P2, KC_P3, KC_PPLS, KC_QUOT, KC_P1, KC_P2, KC_P3, KC_PPLS, KC_QUOT, + //|------+------+------+------+------|------+------+------+------+------+------+------| + KC_DLBS, KC_P0, KC_PDOT, KC_SFEQ, KC_SPC, KC_DEL, KC_SPC, KC_DLBS, KC_P0, KC_PDOT, KC_SFEQ, KC_BSPC + //|------+------+------+------+-------------+------+------+------+------+------+------| + ), + + [_LOWER] = LAYOUT( + //,----------------------------------. ,----------------------------------. + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_MINS, KC_EQL, KC_JYEN, KC_LBRC, KC_RBRC, + //|------+------+------+------+------| |------+------+------+------+------| + KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, XXXXXXX, XXXXXXX, KC_SCLN, KC_QUOT, KC_BSLS, + //|------+------+------+------+------| |------+------+------+------+------| + KC_11SF, KC_F12, KC_DLNP, KANJI, KC_ENT, XXXXXXX, KC_COMM, KC_DOT, KC_SLSH, KC_RO, + //|------+------+------+------+------|------+------+------+------+------+------+------| + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + //|------+------+------+------+-------------+------+------+------+------+------+------| + ), + + [_RAISE] = LAYOUT( + //,----------------------------------. ,----------------------------------. + KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, + //|------+------+------+------+------| |------+------+------+------+------| + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_QUOT, KC_4, KC_5, KC_6, KC_MINS, + //|------+------+------+------+------| |------+------+------+------+------| + KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_SLSH, KC_1, KC_2, KC_3, KC_PPLS, + //|------+------+------+------+------|------+------+------+------+------+------+------| + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_WLCK, KC_TRNS, KC_0, KC_DOT, KC_JEQL + //|------+------+------+------+-------------+------+------+------+------+------+------| + ), + + [_ADJUST] = LAYOUT( + //,----------------------------------. ,----------------------------------. + RESET, RGBRST, AG_NORM, AG_SWAP, KC_CAPS, XXXXXXX, KC_WH_L, KC_WH_U, KC_HOME, KC_PGUP, + //|------+------+------+------+------| |------+------+------+------+------| + RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, KC_SLCK, XXXXXXX, KC_WH_R, KC_WH_D, KC_END, KC_PGDN, + //|------+------+------+------+------| |------+------+------+------+------| + RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, KC_NLCK, XXXXXXX, KC_BTN1, KC_BTN2, KC_MS_U, XXXXXXX, + //|------+------+------+------+------|------+------+------+------+------+------+------| + KC_LSFT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R + //|------+------+------+------+-------------+------+------+------+------+------+------| + ) +}; + +#define L_BASE _BASE +#define L_NUMPAD (1<<_NUMPAD) + +static inline void update_change_layer(bool pressed, uint8_t layer1, uint8_t layer2, uint8_t layer3) { + + pressed ? layer_on(layer1) : layer_off(layer1); + IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2) ? layer_on(layer3) : layer_off(layer3); +} + +int RGB_current_mode; +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + + bool result = false; + switch (keycode) { + case BASE: + if (record->event.pressed) { + default_layer_set(L_BASE); + } + break; + case NUMPAD: + if (record->event.pressed) { + default_layer_set(L_NUMPAD); + } + break; + case LOWER: + update_change_layer(record->event.pressed, _LOWER, _RAISE, _ADJUST); + break; + case RAISE: + update_change_layer(record->event.pressed, _RAISE, _LOWER, _ADJUST); + break; + case KANJI: + if (record->event.pressed) { + if (keymap_config.swap_lalt_lgui == false) { + register_code(KC_LANG2); + } else { + tap_code16(A(KC_GRV)); + } + } else { + unregister_code(KC_LANG2); + } + break; + #ifdef RGBLIGHT_ENABLE + //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released + case RGB_MOD: + if (record->event.pressed) { + rgblight_mode(RGB_current_mode); + rgblight_step(); + RGB_current_mode = rgblight_config.mode; + } + break; + case RGBRST: + if (record->event.pressed) { + eeconfig_update_rgblight_default(); + rgblight_enable(); + RGB_current_mode = rgblight_config.mode; + } + break; + #endif + default: + result = true; + break; + } + + return result; +} + +void matrix_init_user(void) { + #ifdef RGBLIGHT_ENABLE + RGB_current_mode = rgblight_config.mode; + #endif +} diff --git a/keyboards/numatreus/keymaps/like_jis/rules.mk b/keyboards/numatreus/keymaps/like_jis/rules.mk new file mode 100644 index 0000000000..959653f3f8 --- /dev/null +++ b/keyboards/numatreus/keymaps/like_jis/rules.mk @@ -0,0 +1,8 @@ +MOUSEKEY_ENABLE = yes +TAP_DANCE_ENABLE = yes +RGBLIGHT_ENABLE = yes +LED_ANIMATIONS = yes + +ifeq ($(strip $(LED_ANIMATIONS)), yes) + OPT_DEFS += -DLED_ANIMATIONS +endif diff --git a/keyboards/numatreus/keymaps/yohewi/keymap.c b/keyboards/numatreus/keymaps/yohewi/keymap.c new file mode 100644 index 0000000000..8027a972e4 --- /dev/null +++ b/keyboards/numatreus/keymaps/yohewi/keymap.c @@ -0,0 +1,61 @@ +#include QMK_KEYBOARD_H + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. + +enum layer_number { + _QWERTY, + _LOWER, + _RAISE, +}; + +enum custom_keycodes { + BASE = SAFE_RANGE, + LOWER, + RAISE, +}; + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* + * q w e r t || y u i o p + * a s d f g || h j k l ; + * z x c v b || n m , . \ + * esc tab ctl lw spc bspc|| GRV ent RS / alt - + */ + + [_QWERTY] = LAYOUT( /* Qwerty */ + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P , + KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN , + SFT_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, SFT_T(KC_BSLS) , + KC_ESC, KC_TAB, KC_LCTL, MO(_LOWER), KC_SPC, KC_BSPC, LALT(KC_GRV), KC_ENT, MO(_RAISE), KC_DOT, KC_RALT, KC_MINS ), + + + /* + * 1 2 3 4 5 || 6 7 8 9 0 + * # < > = - || _ + ENT + * [ ] ( ) & || ` . UP \ + * TRANS TRANS TRANS TRANS TRANS TRANS|| TRANS TRANS RS LEFT DPWM RGHT + */ + [_RAISE] = LAYOUT( /* [> RAISE <] */ + KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0 , + KC_HASH, KC_LABK, KC_RABK, KC_EQL, KC_MINS, KC_UNDS, KC_PLUS, KC_TRNS, KC_TRNS, KC_ENT , + KC_LBRC, KC_RBRC, KC_LPRN, KC_RPRN, KC_AMPR, KC_GRV, KC_TRNS, KC_DOT, KC_UP, KC_BSLS , + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT ), + + /* + * ! @ # $ % || ^ & * ( ) + * F1 F2 F3 F4 F5 || F6 F7 F8 F9 F10 + * F11 F12 reset || , UP \ + * TRNS TRNS TRNS TRNS TRNS TRNS||TRNS TRNS TRNS LEFT DPWM RGHT + */ + + [_LOWER] = LAYOUT( /* [> LOWER <] */ + KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN , + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 , + KC_F11, KC_F12, KC_NO, KC_NO, RESET, KC_TRNS, KC_TRNS, KC_QUOT, KC_UP, KC_BSLS , + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENT, TO(_QWERTY), KC_LEFT, KC_DOWN, KC_RGHT ) +}; diff --git a/keyboards/numatreus/numatreus.c b/keyboards/numatreus/numatreus.c new file mode 100644 index 0000000000..0338210e86 --- /dev/null +++ b/keyboards/numatreus/numatreus.c @@ -0,0 +1 @@ +#include "numatreus.h"
\ No newline at end of file diff --git a/keyboards/numatreus/numatreus.h b/keyboards/numatreus/numatreus.h new file mode 100644 index 0000000000..6ec56504ab --- /dev/null +++ b/keyboards/numatreus/numatreus.h @@ -0,0 +1,20 @@ +#pragma once + +#include "quantum.h" + + +// This a shortcut to help you visually see your layout. +// The first section contains all of the arguements +// The second converts the arguments into a two-dimensional array +#define LAYOUT( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \ +) \ +{ \ + { k00, k01, k02, k03, k04, KC_NO, k05, k06, k07, k08, k09 }, \ + { k10, k11, k12, k13, k14, KC_NO, k15, k16, k17, k18, k19 }, \ + { k20, k21, k22, k23, k24, k35, k25, k26, k27, k28, k29 }, \ + { k30, k31, k32, k33, k34, k36, k37, k38, k39, k3a, k3b } \ +} diff --git a/keyboards/numatreus/readme.md b/keyboards/numatreus/readme.md new file mode 100644 index 0000000000..e945c31467 --- /dev/null +++ b/keyboards/numatreus/readme.md @@ -0,0 +1,13 @@ +# NumAtreus + +A small mechanical keyboard that is based around the shape of the human hand. + +* Keyboard Maintainer: yohewi(yohewi@gmail.com) +* Hardware Supported: NumAtreus, PCB +* Hardware Availability: [Case Data](https://github.com/yohewi/NumAtreuscase) + +Make example for this keyboard (after setting up your build environment): + + make numatreus:default:flash + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
\ No newline at end of file diff --git a/keyboards/numatreus/rules.mk b/keyboards/numatreus/rules.mk new file mode 100644 index 0000000000..f1efe4cc5e --- /dev/null +++ b/keyboards/numatreus/rules.mk @@ -0,0 +1,36 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = no # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +#BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +#MIDI_ENABLE = no # MIDI controls +UNICODE_ENABLE = yes # Unicode +#BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID +#TAP_DANCE_ENABLE = yes +RGBLIGHT_ENABLE = no +LED_ANIMATIONS = no + +ifeq ($(strip $(LED_ANIMATIONS)), yes) + OPT_DEFS += -DLED_ANIMATIONS +endif + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend diff --git a/keyboards/ogre/ergo_split/config.h b/keyboards/ogre/ergo_split/config.h new file mode 100644 index 0000000000..d92c2538bf --- /dev/null +++ b/keyboards/ogre/ergo_split/config.h @@ -0,0 +1,52 @@ +/* +Copyright 2020 ctrlshiftba + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x1209 +#define PRODUCT_ID 0x095E +#define DEVICE_VER 0x0001 +#define MANUFACTURER ctrlshiftba +#define PRODUCT ergo_split +#define DESCRIPTION a keycap friendly ergo. the split version + +/* key matrix size */ +#define MATRIX_ROWS 10 +#define MATRIX_COLS 7 + +/* Keyboard Matrix Assignments */ +#define MATRIX_ROW_PINS { C6, D7, E6, B4, B5 } +#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 } + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW + +/* + * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN. + */ +#define SOFT_SERIAL_PIN D3 +#define SPLIT_HAND_PIN D1 + +#define RGB_DI_PIN B6 +#define RGBLED_SPLIT { 7, 7 } +#define RGBLED_NUM 14 +#define RGBLIGHT_LED_MAP { 6, 5, 4, 3, 2, 1, 0, 13, 12,11, 10, 9, 8, 7} +#define RGBLIGHT_ANIMATIONS +#define DEBOUNCE 5 diff --git a/keyboards/ogre/ergo_split/ergo_split.c b/keyboards/ogre/ergo_split/ergo_split.c new file mode 100644 index 0000000000..0d83a5e8e4 --- /dev/null +++ b/keyboards/ogre/ergo_split/ergo_split.c @@ -0,0 +1,17 @@ +/* Copyright 2020 ctrlshiftba + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "ergo_split.h" diff --git a/keyboards/ogre/ergo_split/ergo_split.h b/keyboards/ogre/ergo_split/ergo_split.h new file mode 100644 index 0000000000..f8f9ddf65f --- /dev/null +++ b/keyboards/ogre/ergo_split/ergo_split.h @@ -0,0 +1,39 @@ +/* Copyright 2020 ctrlshiftba + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +#include "quantum.h" + +#define LAYOUT( \ + k63, k00, k10, k20, k30, k40, k50, k60, k65, k55, k45, k35, k25, k15, k05, k68, \ + k01, k11, k21, k31, k41, k51, k61, k66, k56, k46, k36, k26, k16, k06, \ + k02, k12, k22, k32, k42, k52, k62, k67, k57, k47, k37, k27, k17, k07, \ + k03, k13, k23, k33, k43, k53, k58, k48, k38, k28, k18, k08, \ + k04, k14, k24, k34, k44, k54, k64, k69, k59, k49, k39, k29, k19, k09 \ +) \ +{ \ + { k00, k10, k20, k30, k40, k50, k60 }, \ + { k01, k11, k21, k31, k41, k51, k61 }, \ + { k02, k12, k22, k32, k42, k52, k62 }, \ + { k03, k13, k23, k33, k43, k53, k63 }, \ + { k04, k14, k24, k34, k44, k54, k64 }, \ + { k05, k15, k25, k35, k45, k55, k65 }, \ + { k06, k16, k26, k36, k46, k56, k66 }, \ + { k07, k17, k27, k37, k47, k57, k67 }, \ + { k08, k18, k28, k38, k48, k58, k68 }, \ + { k09, k19, k29, k39, k49, k59, k69 }, \ +} diff --git a/keyboards/ogre/ergo_split/keymaps/default/keymap.c b/keyboards/ogre/ergo_split/keymaps/default/keymap.c new file mode 100644 index 0000000000..94e725791e --- /dev/null +++ b/keyboards/ogre/ergo_split/keymaps/default/keymap.c @@ -0,0 +1,41 @@ +/* Copyright 2020 ctrlshiftba + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +#define TP_Z MT(MOD_LCTL, KC_Z) +#define TP_X MT(MOD_LGUI, KC_X) +#define TP_GR MT(MOD_LCTL, KC_GRV) +#define TP_SPC LT(1, KC_SPC) +#define TP_ENT LT(1, KC_ENT) +#define TP_QUOT MT(MOD_RGUI, KC_QUOT) +#define TP_RCTRL MT(MOD_RCTL, KC_RBRC) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_ESC, KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_GRV, KC_PGUP, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_DEL, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_RBRC, KC_LBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_PGDN, KC_QUOT, KC_H, KC_J, KC_K, KC_L, KC_SCLN, TP_QUOT, + KC_LSFT, TP_Z, TP_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + TP_GR, KC_LALT, KC_LEFT, KC_RGHT, TP_SPC, KC_SPC, KC_BSPC, KC_RALT, KC_ENT, TP_ENT, KC_DOWN, KC_UP, KC_LBRC, TP_RCTRL + ), + [1] = LAYOUT( + RESET, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_INS, KC_HOME, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_M_P, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, KC_END, _______, _______, _______, _______, _______, _______, _______, + RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MENU, _______ + ), +}; diff --git a/keyboards/ogre/ergo_split/keymaps/default/readme.md b/keyboards/ogre/ergo_split/keymaps/default/readme.md new file mode 100644 index 0000000000..4e225222b1 --- /dev/null +++ b/keyboards/ogre/ergo_split/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for ergo_split diff --git a/keyboards/ogre/ergo_split/readme.md b/keyboards/ogre/ergo_split/readme.md new file mode 100644 index 0000000000..e027e6be02 --- /dev/null +++ b/keyboards/ogre/ergo_split/readme.md @@ -0,0 +1,15 @@ +# ogre ergo (split) +## a keycap friendly ergo +![ogre_ergo_split](https://i.imgur.com/55luvRi.jpg) + +The ogre ergo is a ergodox inspired keyboard that is a keycap friendly ergo supporting a wide variety of keycap layout possiblities. Its can be built as either a split or single keyboard. + +* Keyboard Maintainer: [ctrlshiftba](https://github.com/ctrlshiftbryan) +* Hardware Supported: the ogre ergo pcb +* Hardware Availability: https://ctrlshiftba.com/ + +Make example for this keyboard (after setting up your build environment): + + make ogre/ergo_split:default + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/ogre/ergo_split/rules.mk b/keyboards/ogre/ergo_split/rules.mk new file mode 100644 index 0000000000..06f53864c1 --- /dev/null +++ b/keyboards/ogre/ergo_split/rules.mk @@ -0,0 +1,33 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = no # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = no # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +MIDI_ENABLE = no # MIDI support +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches +HD44780_ENABLE = no # Enable support for HD44780 based LCDs +SPLIT_KEYBOARD = yes diff --git a/keyboards/orthodox/keymaps/xyverz/keymap.c b/keyboards/orthodox/keymaps/xyverz/keymap.c index cc3c38943b..0417c1a4a0 100644 --- a/keyboards/orthodox/keymaps/xyverz/keymap.c +++ b/keyboards/orthodox/keymaps/xyverz/keymap.c @@ -63,9 +63,7 @@ void matrix_init_user(void) { #ifdef BOOTLOADER_CATERINA // This will disable the red LEDs on the ProMicros setPinInput(D5); - writePinLow(D5); setPinInput(B0); - writePinLow(B0); #endif }; @@ -86,4 +84,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } return true; -}
\ No newline at end of file +} diff --git a/keyboards/whitefox/rules.mk b/keyboards/whitefox/rules.mk index 59332d1d5a..7b33285004 100644 --- a/keyboards/whitefox/rules.mk +++ b/keyboards/whitefox/rules.mk @@ -72,6 +72,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration NKRO_ENABLE = yes # USB Nkey Rollover CUSTOM_MATRIX = yes # Custom matrix file BACKLIGHT_ENABLE = yes +BACKLIGHT_DRIVER = custom VISUALIZER_ENABLE = yes LED_DRIVER = is31fl3731c diff --git a/keyboards/yd60mq/yd60mq.c b/keyboards/yd60mq/yd60mq.c index 96306d6a66..6e391046e5 100644 --- a/keyboards/yd60mq/yd60mq.c +++ b/keyboards/yd60mq/yd60mq.c @@ -6,7 +6,6 @@ void led_set_kb(uint8_t usb_led) { writePinLow(F4); } else { setPinInput(F4); - writePinLow(F4); } led_set_user(usb_led); diff --git a/layouts/community/ortho_4x12/xyverz/keymap.c b/layouts/community/ortho_4x12/xyverz/keymap.c index a21c143f00..c9811ea4b1 100644 --- a/layouts/community/ortho_4x12/xyverz/keymap.c +++ b/layouts/community/ortho_4x12/xyverz/keymap.c @@ -132,9 +132,7 @@ void matrix_init_user(void) { #ifdef BOOTLOADER_CATERINA // This will disable the red LEDs on the ProMicros setPinInput(D5); - writePinLow(D5); setPinInput(B0); - writePinLow(B0); #endif }; @@ -155,4 +153,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } return true; -}
\ No newline at end of file +} diff --git a/layouts/community/ortho_5x12/xyverz/keymap.c b/layouts/community/ortho_5x12/xyverz/keymap.c index 2cca237bbe..00fca1b48e 100644 --- a/layouts/community/ortho_5x12/xyverz/keymap.c +++ b/layouts/community/ortho_5x12/xyverz/keymap.c @@ -151,9 +151,7 @@ void matrix_init_user(void) { #ifdef BOOTLOADER_CATERINA // This will disable the red LEDs on the ProMicros setPinInput(D5); - writePinLow(D5); setPinInput(B0); - writePinLow(B0); #endif }; @@ -174,4 +172,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } return true; -}
\ No newline at end of file +} diff --git a/lib/python/qmk/cli/doctor.py b/lib/python/qmk/cli/doctor.py index 6ddc5571b4..013bf7943c 100755 --- a/lib/python/qmk/cli/doctor.py +++ b/lib/python/qmk/cli/doctor.py @@ -1,14 +1,18 @@ -"""QMK Python Doctor +"""QMK Doctor -Check up for QMK environment. +Check out the user's QMK environment and make sure it's ready to compile. """ -import os import platform import shutil import subprocess -import glob +from pathlib import Path from milc import cli +from qmk import submodules +from qmk.questions import yesno + +ESSENTIAL_BINARIES = ['dfu-programmer', 'avrdude', 'dfu-util', 'avr-gcc', 'arm-none-eabi-gcc', 'bin/qmk'] +ESSENTIAL_SUBMODULES = ['lib/chibios', 'lib/lufa'] def _udev_rule(vid, pid=None): @@ -20,6 +24,137 @@ def _udev_rule(vid, pid=None): return 'SUBSYSTEMS=="usb", ATTRS{idVendor}=="%s", MODE:="0666"' % vid +def check_binaries(): + """Iterates through ESSENTIAL_BINARIES and tests them. + """ + ok = True + + for binary in ESSENTIAL_BINARIES: + if not is_executable(binary): + ok = False + + return ok + + +def check_submodules(): + """Iterates through all submodules to make sure they're cloned and up to date. + """ + ok = True + + for submodule in submodules.status().values(): + if submodule['status'] is None: + if submodule['name'] in ESSENTIAL_SUBMODULES: + cli.log.error('Submodule %s has not yet been cloned!', submodule['name']) + ok = False + else: + cli.log.warn('Submodule %s is not available.', submodule['name']) + elif not submodule['status']: + if submodule['name'] in ESSENTIAL_SUBMODULES: + cli.log.warn('Submodule %s is not up to date!') + + return ok + + +def check_udev_rules(): + """Make sure the udev rules look good. + """ + ok = True + udev_dir = Path("/etc/udev/rules.d/") + desired_rules = { + 'dfu': {_udev_rule("03eb", "2ff4"), _udev_rule("03eb", "2ffb"), _udev_rule("03eb", "2ff0")}, + 'tmk': {_udev_rule("feed")}, + 'input_club': {_udev_rule("1c11")}, + 'stm32': {_udev_rule("1eaf", "0003"), _udev_rule("0483", "df11")}, + 'caterina': {'ATTRS{idVendor}=="2a03", ENV{ID_MM_DEVICE_IGNORE}="1"', 'ATTRS{idVendor}=="2341", ENV{ID_MM_DEVICE_IGNORE}="1"'}, + } + + if udev_dir.exists(): + udev_rules = [str(rule_file) for rule_file in udev_dir.glob('*.rules')] + current_rules = set() + + # Collect all rules from the config files + for rule_file in udev_rules: + with open(rule_file, "r") as fd: + for line in fd.readlines(): + line = line.strip() + if not line.startswith("#") and len(line): + current_rules.add(line) + + # Check if the desired rules are among the currently present rules + for bootloader, rules in desired_rules.items(): + if not rules.issubset(current_rules): + # If the rules for catalina are not present, check if ModemManager is running + if bootloader == "caterina": + if check_modem_manager(): + ok = False + cli.log.warn("{bg_yellow}Detected ModemManager without udev rules. Please either disable it or set the appropriate udev rules if you are using a Pro Micro.") + else: + cli.log.warn("{bg_yellow}Missing udev rules for '%s' boards. You'll need to use `sudo` in order to flash them.", bootloader) + + return ok + + +def check_modem_manager(): + """Returns True if ModemManager is running. + """ + if shutil.which("systemctl"): + mm_check = subprocess.run(["systemctl", "--quiet", "is-active", "ModemManager.service"], timeout=10) + if mm_check.returncode == 0: + return True + + else: + cli.log.warn("Can't find systemctl to check for ModemManager.") + + +def is_executable(command): + """Returns True if command exists and can be executed. + """ + # Make sure the command is in the path. + res = shutil.which(command) + if res is None: + cli.log.error("{fg_red}Can't find %s in your path.", command) + return False + + # Make sure the command can be executed + check = subprocess.run([command, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=5) + if check.returncode in [0, 1]: # Older versions of dfu-programmer exit 1 + cli.log.debug('Found {fg_cyan}%s', command) + return True + + cli.log.error("{fg_red}Can't run `%s --version`", command) + return False + + +def os_test_linux(): + """Run the Linux specific tests. + """ + cli.log.info("Detected {fg_cyan}Linux.") + ok = True + + if not check_udev_rules(): + ok = False + + return ok + + +def os_test_macos(): + """Run the Mac specific tests. + """ + cli.log.info("Detected {fg_cyan}macOS.") + + return True + + +def os_test_windows(): + """Run the Windows specific tests. + """ + cli.log.info("Detected {fg_cyan}Windows.") + + return True + + +@cli.argument('-y', '--yes', action='store_true', arg_only=True, help='Answer yes to all questions.') +@cli.argument('-n', '--no', action='store_true', arg_only=True, help='Answer no to all questions.') @cli.subcommand('Basic QMK environment checks') def doctor(cli): """Basic QMK environment checks. @@ -30,75 +165,53 @@ def doctor(cli): * [ ] Compile a trivial program with each compiler """ cli.log.info('QMK Doctor is checking your environment.') - - # Make sure the basic CLI tools we need are available and can be executed. - binaries = ['dfu-programmer', 'avrdude', 'dfu-util', 'avr-gcc', 'arm-none-eabi-gcc', 'bin/qmk'] ok = True - for binary in binaries: - res = shutil.which(binary) - if res is None: - cli.log.error("{fg_red}QMK can't find %s in your path.", binary) - ok = False - else: - check = subprocess.run([binary, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=5) - if check.returncode in [0, 1]: - cli.log.info('Found {fg_cyan}%s', binary) - else: - cli.log.error("{fg_red}Can't run `%s --version`", binary) - ok = False - # Determine our OS and run platform specific tests OS = platform.system() # noqa (N806), uppercase name is ok in this instance - if OS == "Darwin": - cli.log.info("Detected {fg_cyan}macOS.") - - elif OS == "Linux": - cli.log.info("Detected {fg_cyan}Linux.") - # Checking for udev rules - udev_dir = "/etc/udev/rules.d/" - # These are the recommended udev rules - desired_rules = { - 'dfu': {_udev_rule("03eb", "2ff4"), _udev_rule("03eb", "2ffb"), _udev_rule("03eb", "2ff0")}, - 'tmk': {_udev_rule("feed")}, - 'input_club': {_udev_rule("1c11")}, - 'stm32': {_udev_rule("1eaf", "0003"), _udev_rule("0483", "df11")}, - 'caterina': {'ATTRS{idVendor}=="2a03", ENV{ID_MM_DEVICE_IGNORE}="1"', 'ATTRS{idVendor}=="2341", ENV{ID_MM_DEVICE_IGNORE}="1"'}, - } - - if os.path.exists(udev_dir): - udev_rules = [rule for rule in glob.iglob(os.path.join(udev_dir, "*.rules")) if os.path.isfile(rule)] - # Collect all rules from the config files - current_rules = set() - for rule in udev_rules: - with open(rule, "r") as fd: - for line in fd.readlines(): - line = line.strip() - if not line.startswith("#") and len(line): - current_rules.add(line) - - # Check if the desired rules are among the currently present rules - for bootloader, rules in desired_rules.items(): - if not rules.issubset(current_rules): - # If the rules for catalina are not present, check if ModemManager is running - if bootloader == "caterina": - if shutil.which("systemctl"): - mm_check = subprocess.run(["systemctl", "--quiet", "is-active", "ModemManager.service"], timeout=10) - if mm_check.returncode == 0: - ok = False - cli.log.warn("{bg_yellow}Detected ModemManager without udev rules. Please either disable it or set the appropriate udev rules if you are using a Pro Micro.") - else: - cli.log.warn("Can't find systemctl to check for ModemManager.") - else: - cli.log.warn("{bg_yellow}Missing udev rules for '%s' boards. You'll need to use `sudo` in order to flash them.", bootloader) + if OS == 'Darwin': + if not os_test_macos(): + ok = False + elif OS == 'Linux': + if not os_test_linux(): + ok = False + elif OS == 'Windows': + if not os_test_windows(): + ok = False + else: + cli.log.error('Unsupported OS detected: %s', OS) + ok = False + # Make sure the basic CLI tools we need are available and can be executed. + bin_ok = check_binaries() + + if not bin_ok: + if yesno('Would you like to install dependencies?', default=True): + subprocess.run(['util/qmk_install.sh']) + bin_ok = check_binaries() + + if bin_ok: + cli.log.info('All dependencies are installed.') else: - cli.log.info("Assuming {fg_cyan}Windows.") + ok = False + + # Check out the QMK submodules + sub_ok = check_submodules() + + if sub_ok: + cli.log.info('Submodules are up to date.') + else: + if yesno('Would you like to clone the submodules?', default=True): + submodules.update() + sub_ok = check_submodules() + + if not sub_ok: + ok = False # Report a summary of our findings to the user if ok: cli.log.info('{fg_green}QMK is ready to go') else: cli.log.info('{fg_yellow}Problems detected, please fix these problems before proceeding.') - # FIXME(skullydazed): Link to a document about troubleshooting, or discord or something + # FIXME(skullydazed/unclaimed): Link to a document about troubleshooting, or discord or something diff --git a/lib/python/qmk/questions.py b/lib/python/qmk/questions.py new file mode 100644 index 0000000000..34b0b43bc8 --- /dev/null +++ b/lib/python/qmk/questions.py @@ -0,0 +1,97 @@ +"""Functions to collect user input. +""" + +from milc import cli, format_ansi + + +def yesno(prompt, *args, default=None, **kwargs): + """Displays prompt to the user and gets a yes or no response. + + Returns True for a yes and False for a no. + + If you add `--yes` and `--no` arguments to your program the user can answer questions by passing command line flags. + + @add_argument('-y', '--yes', action='store_true', arg_only=True, help='Answer yes to all questions.') + @add_argument('-n', '--no', action='store_true', arg_only=True, help='Answer no to all questions.') + + Arguments: + prompt + The prompt to present to the user. Can include ANSI and format strings like milc's `cli.print()`. + + default + Whether to default to a Yes or No when the user presses enter. + + None- force the user to enter Y or N + + True- Default to yes + + False- Default to no + """ + if not args and kwargs: + args = kwargs + + if 'no' in cli.args and cli.args.no: + return False + + if 'yes' in cli.args and cli.args.yes: + return True + + if default is not None: + if default: + prompt = prompt + ' [Y/n] ' + else: + prompt = prompt + ' [y/N] ' + + while True: + print() + answer = input(format_ansi(prompt % args)) + print() + + if not answer and prompt is not None: + return default + + elif answer.lower() in ['y', 'yes']: + return True + + elif answer.lower() in ['n', 'no']: + return False + + +def question(prompt, *args, default=None, confirm=False, answer_type=str, **kwargs): + """Prompt the user to answer a question with a free-form input. + + prompt + The prompt to present to the user. Can include ANSI and format strings like milc's `cli.print()`. + + default + The value to return when the user doesn't enter any value. Use None to prompt until they enter a value. + + answer_type + Specify a type function for the answer. Will re-prompt the user if the function raises any errors. Common choices here include int, float, and decimal.Decimal. + """ + if not args and kwargs: + args = kwargs + + if default is not None: + prompt = '%s [%s] ' % (prompt, default) + + while True: + print() + answer = input(format_ansi(prompt % args)) + print() + + if answer: + if confirm: + if yesno('Is the answer "%s" correct?', answer, default=True): + try: + return answer_type(answer) + except Exception as e: + cli.log.error('Could not convert answer (%s) to type %s: %s', answer, answer_type.__name__, str(e)) + else: + try: + return answer_type(answer) + except Exception as e: + cli.log.error('Could not convert answer (%s) to type %s: %s', answer, answer_type.__name__, str(e)) + + elif default is not None: + return default diff --git a/lib/python/qmk/submodules.py b/lib/python/qmk/submodules.py new file mode 100644 index 0000000000..be51a68043 --- /dev/null +++ b/lib/python/qmk/submodules.py @@ -0,0 +1,71 @@ +"""Functions for working with QMK's submodules. +""" + +import subprocess + + +def status(): + """Returns a dictionary of submodules. + + Each entry is a dict of the form: + + { + 'name': 'submodule_name', + 'status': None/False/True, + 'githash': '<sha-1 hash for the submodule> + } + + status is None when the submodule doesn't exist, False when it's out of date, and True when it's current + """ + submodules = {} + git_cmd = subprocess.run(['git', 'submodule', 'status'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=30, universal_newlines=True) + + for line in git_cmd.stdout.split('\n'): + if not line: + continue + + status = line[0] + githash, submodule = line[1:].split()[:2] + submodules[submodule] = {'name': submodule, 'githash': githash} + + if status == '-': + submodules[submodule]['status'] = None + elif status == '+': + submodules[submodule]['status'] = False + elif status == ' ': + submodules[submodule]['status'] = True + else: + raise ValueError('Unknown `git submodule status` sha-1 prefix character: "%s"' % status) + + return submodules + + +def update(submodules=None): + """Update the submodules. + + submodules + A string containing a single submodule or a list of submodules. + """ + git_sync_cmd = ['git', 'submodule', 'sync'] + git_update_cmd = ['git', 'submodule', 'update', '--init'] + + if submodules is None: + # Update everything + git_sync_cmd.append('--recursive') + git_update_cmd.append('--recursive') + subprocess.run(git_sync_cmd, check=True) + subprocess.run(git_update_cmd, check=True) + + else: + if isinstance(submodules, str): + # Update only a single submodule + git_sync_cmd.append(submodules) + git_update_cmd.append(submodules) + subprocess.run(git_sync_cmd, check=True) + subprocess.run(git_update_cmd, check=True) + + else: + # Update submodules in a list + for submodule in submodules: + subprocess.run(git_sync_cmd + [submodule], check=True) + subprocess.run(git_update_cmd + [submodule], check=True) diff --git a/quantum/config_common.h b/quantum/config_common.h index 8de3f070c5..f981f3f8cb 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h @@ -132,7 +132,7 @@ # endif # ifndef __ASSEMBLER__ -# define _PIN_ADDRESS(p, offset) _SFR_IO8(ADDRESS_BASE + (p >> PORT_SHIFTER) + offset) +# define _PIN_ADDRESS(p, offset) _SFR_IO8(ADDRESS_BASE + ((p) >> PORT_SHIFTER) + (offset)) // Port X Input Pins Address # define PINx_ADDRESS(p) _PIN_ADDRESS(p, 0) // Port X Data Direction Register, 0:input 1:output diff --git a/quantum/quantum.h b/quantum/quantum.h index 48887026d2..3b9eeaa6de 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -174,7 +174,7 @@ extern layer_state_t layer_state; #if defined(__AVR__) typedef uint8_t pin_t; -# define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF)) +# define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) &= ~_BV((pin)&0xF)) # define setPinInputHigh(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) |= _BV((pin)&0xF)) # define setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low") # define setPinOutput(pin) (DDRx_ADDRESS(pin) |= _BV((pin)&0xF)) @@ -184,6 +184,7 @@ typedef uint8_t pin_t; # define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin)) # define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin)&0xF))) + #elif defined(PROTOCOL_CHIBIOS) typedef ioline_t pin_t; diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index 62e1561878..b2e364f216 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk @@ -108,6 +108,8 @@ else ifneq ("$(wildcard $(KEYBOARD_PATH_2)/ld/$(MCU_LDSCRIPT).ld)","") LDSCRIPT = $(KEYBOARD_PATH_2)/ld/$(MCU_LDSCRIPT).ld else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/ld/$(MCU_LDSCRIPT).ld)","") LDSCRIPT = $(KEYBOARD_PATH_1)/ld/$(MCU_LDSCRIPT).ld +else ifneq ("$(wildcard $(TOP_DIR)/drivers/boards/ld/$(MCU_LDSCRIPT).ld)","") + LDSCRIPT = $(TOP_DIR)/drivers/boards/ld/$(MCU_LDSCRIPT).ld else LDSCRIPT = $(STARTUPLD)/$(MCU_LDSCRIPT).ld endif diff --git a/tmk_core/common/chibios/printf.c b/tmk_core/common/chibios/printf.c index dcf33f35f8..3a81acd312 100644 --- a/tmk_core/common/chibios/printf.c +++ b/tmk_core/common/chibios/printf.c @@ -120,7 +120,8 @@ static void putchw(void* putp, putcf putf, int n, char z, char* bf) { } void tfp_format(void* putp, putcf putf, char* fmt, va_list va) { - char bf[12]; + // This used to handle max of 12, but binary support jumps this to at least 32 + char bf[36]; char ch; diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 9981477a58..dd701f661e 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -175,61 +175,61 @@ typedef struct { } usb_driver_config_t; /* Reusable initialization structure - see USBEndpointConfig comment at top of file */ -#define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ - { \ - .queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \ - .in_ep_config = \ - { \ - stream##_IN_MODE, /* Interrupt EP */ \ - NULL, /* SETUP packet notification callback */ \ - qmkusbDataTransmitted, /* IN notification callback */ \ - NULL, /* OUT notification callback */ \ - stream##_EPSIZE, /* IN maximum packet size */ \ - 0, /* OUT maximum packet size */ \ - NULL, /* IN Endpoint state */ \ - NULL, /* OUT endpoint state */ \ - 2, /* IN multiplier */ \ - NULL /* SETUP buffer (not a SETUP endpoint) */ \ - }, \ - .out_ep_config = \ - { \ - stream##_OUT_MODE, /* Interrupt EP */ \ - NULL, /* SETUP packet notification callback */ \ - NULL, /* IN notification callback */ \ - qmkusbDataReceived, /* OUT notification callback */ \ - 0, /* IN maximum packet size */ \ - stream##_EPSIZE, /* OUT maximum packet size */ \ - NULL, /* IN Endpoint state */ \ - NULL, /* OUT endpoint state */ \ - 2, /* IN multiplier */ \ - NULL, /* SETUP buffer (not a SETUP endpoint) */ \ - }, \ - .int_ep_config = \ - { \ - USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ - NULL, /* SETUP packet notification callback */ \ - qmkusbInterruptTransmitted, /* IN notification callback */ \ - NULL, /* OUT notification callback */ \ - CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ - 0, /* OUT maximum packet size */ \ - NULL, /* IN Endpoint state */ \ - NULL, /* OUT endpoint state */ \ - 2, /* IN multiplier */ \ - NULL, /* SETUP buffer (not a SETUP endpoint) */ \ - }, \ - .config = { \ - .usbp = &USB_DRIVER, \ - .bulk_in = stream##_IN_EPNUM, \ - .bulk_out = stream##_OUT_EPNUM, \ - .int_in = notification, \ - .in_buffers = stream##_IN_CAPACITY, \ - .out_buffers = stream##_OUT_CAPACITY, \ - .in_size = stream##_EPSIZE, \ - .out_size = stream##_EPSIZE, \ - .fixed_size = fixedsize, \ - .ib = (uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ - .ob = (uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ - } \ +#define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ + { \ + .queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \ + .in_ep_config = \ + { \ + stream##_IN_MODE, /* Interrupt EP */ \ + NULL, /* SETUP packet notification callback */ \ + qmkusbDataTransmitted, /* IN notification callback */ \ + NULL, /* OUT notification callback */ \ + stream##_EPSIZE, /* IN maximum packet size */ \ + 0, /* OUT maximum packet size */ \ + NULL, /* IN Endpoint state */ \ + NULL, /* OUT endpoint state */ \ + 2, /* IN multiplier */ \ + NULL /* SETUP buffer (not a SETUP endpoint) */ \ + }, \ + .out_ep_config = \ + { \ + stream##_OUT_MODE, /* Interrupt EP */ \ + NULL, /* SETUP packet notification callback */ \ + NULL, /* IN notification callback */ \ + qmkusbDataReceived, /* OUT notification callback */ \ + 0, /* IN maximum packet size */ \ + stream##_EPSIZE, /* OUT maximum packet size */ \ + NULL, /* IN Endpoint state */ \ + NULL, /* OUT endpoint state */ \ + 2, /* IN multiplier */ \ + NULL, /* SETUP buffer (not a SETUP endpoint) */ \ + }, \ + .int_ep_config = \ + { \ + USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ + NULL, /* SETUP packet notification callback */ \ + qmkusbInterruptTransmitted, /* IN notification callback */ \ + NULL, /* OUT notification callback */ \ + CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ + 0, /* OUT maximum packet size */ \ + NULL, /* IN Endpoint state */ \ + NULL, /* OUT endpoint state */ \ + 2, /* IN multiplier */ \ + NULL, /* SETUP buffer (not a SETUP endpoint) */ \ + }, \ + .config = { \ + .usbp = &USB_DRIVER, \ + .bulk_in = stream##_IN_EPNUM, \ + .bulk_out = stream##_OUT_EPNUM, \ + .int_in = notification, \ + .in_buffers = stream##_IN_CAPACITY, \ + .out_buffers = stream##_OUT_CAPACITY, \ + .in_size = stream##_EPSIZE, \ + .out_size = stream##_EPSIZE, \ + .fixed_size = fixedsize, \ + .ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ + .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ + } \ } typedef struct { diff --git a/users/datagrok/README.md b/users/datagrok/README.md new file mode 100644 index 0000000000..0d58c04e74 --- /dev/null +++ b/users/datagrok/README.md @@ -0,0 +1,63 @@ +# datagrok's QMK user-space code + +## cdeq "comma dot exclamation question" + +This is a hack to place `question mark` on `shift-comma` and `exclamation mark` on `shift-period`. + +When using an operating system configured for a US/qwerty layout this replaces the angle brackets `<` `>` with `?` `!`. This helps on small keyboards to keep symbols for prose co-located in one layer, and symbols for programming in another. + +It's a "hack" because the "proper" way to accomplish this would be to edit the operating system's keymap. + +### setup + +in your `keymap.c`: + + #include "feature_cdeq.h" + + bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return process_record_cdeq(keycode, record); + } + +in your `rules.mk`, + + SRC += feature_cdeq.c + +### examples + +- atreus:datagrok +- bm43a:datagrok +- mitosis:datagrok + +## base layer selector + +Defines a keycode `KF_LAYO` to rotate between available default layers. + +`Shift`+`KF_LAYO` makes the currently selected one persistent across reboots. + +This is useful if you'd like your keyboard to support and toggle between QWERTY, Dvorak, Colemak, Workman, and other layouts while keeping a common arrangement of modifier and function keys. + +Since toggling layouts seems like something one does infrequently, I wanted to be able to operate this feature with a single key, instead of one for each layer like planck:default or bootmagic. + +### setup + +in your `keymap.c`: + + #define KF_LAYO SAFE_RANGE + #include "feature_default_layers_selector.h" + const uint8_t highest_base_layer = 4; + + bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return \ + process_record_save_default_layer(keycode, record) && \ + process_record_select_default_layer(keycode, record); + } + +in your `rules.mk`, + + SRC += feature_default_layers_selector.c + +### examples + +- atreus:datagrok +- bm43a:datagrok +- mitosis:datagrok diff --git a/users/datagrok/feature_cdeq.c b/users/datagrok/feature_cdeq.c new file mode 100644 index 0000000000..c1796ab227 --- /dev/null +++ b/users/datagrok/feature_cdeq.c @@ -0,0 +1,47 @@ +// This is a hack to place <question mark> on <shift-comma> and <exclamation +// mark> on <shift-period>, when using an operating system configured for a +// US/qwerty layout. +// +// cdeq = "comma dot exclamation question" + +#include QMK_KEYBOARD_H + +bool comm_shifted = false; +bool ques_shifted = false; + +bool process_record_cdeq(uint16_t keycode, keyrecord_t *record) { + uint8_t shifted; + uint16_t s_keycode; + bool *k_shifted; + + switch (keycode) { + case KC_COMM: + s_keycode = KC_SLSH; + k_shifted = &comm_shifted; + break; + case KC_DOT: + s_keycode = KC_1; + k_shifted = &ques_shifted; + break; + default: + return true; + } + + shifted = get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)); + + // Keydown. If shift is currently pressed, register its alternate keycode. + if (record->event.pressed && shifted) { + *k_shifted = true; + register_code(s_keycode); + return false; + // Keyup. If shift was pressed back when the key was pressed, unregister + // its alternate keycode. + } else if (!(record->event.pressed) && *k_shifted) { + *k_shifted = false; + unregister_code(s_keycode); + return false; + // Otherwise, behave as normal. + } else { + return true; + } +} diff --git a/users/datagrok/feature_cdeq.h b/users/datagrok/feature_cdeq.h new file mode 100644 index 0000000000..ff3509b4de --- /dev/null +++ b/users/datagrok/feature_cdeq.h @@ -0,0 +1,2 @@ +#include QMK_KEYBOARD_H +bool process_record_cdeq(uint16_t keycode, keyrecord_t *record); diff --git a/users/datagrok/feature_default_layers_selector.c b/users/datagrok/feature_default_layers_selector.c new file mode 100644 index 0000000000..c83c773f83 --- /dev/null +++ b/users/datagrok/feature_default_layers_selector.c @@ -0,0 +1,46 @@ +#include "feature_default_layers_selector.h" + +#ifdef AUDIO_ENABLE +#include "audio.h" +#ifdef DEFAULT_LAYER_SONGS +extern float default_layer_songs[][16][2]; +#endif +#endif + +bool process_record_save_default_layer(uint16_t keycode, keyrecord_t *record) { + +#if defined(AUDIO_ENABLE) + float saved_song[][2] = SONG(COIN_SOUND); +#endif + + if (!(keycode == KF_LAYO + && record->event.pressed + && get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)))) { + return true; + } + + eeconfig_update_default_layer(default_layer_state); +#if defined(AUDIO_ENABLE) + PLAY_SONG(saved_song); +#endif + return false; +} + +bool process_record_select_default_layer(uint16_t keycode, keyrecord_t *record) { + if (!(keycode == KF_LAYO + && record->event.pressed)) { + return true; + } + if (!default_layer_state) { + default_layer_set(2); + } else { + default_layer_set( + (((1U<<(highest_base_layer+1))-1) & (default_layer_state<<1)) + | (default_layer_state>>highest_base_layer)); + } + led_set(host_keyboard_leds()); +#if defined(AUDIO_ENABLE) && defined(DEFAULT_LAYER_SONGS) + PLAY_SONG(default_layer_songs[get_highest_layer(default_layer_state)]); +#endif + return false; +} diff --git a/users/datagrok/feature_default_layers_selector.h b/users/datagrok/feature_default_layers_selector.h new file mode 100644 index 0000000000..37d82de82b --- /dev/null +++ b/users/datagrok/feature_default_layers_selector.h @@ -0,0 +1,69 @@ +#include QMK_KEYBOARD_H + +/* + Define a keycode KF_LAYO to rotate between available default layers. + Shift+KF_LAYO makes the current one persistent. + + To use: + + in your keymap.c, define KF_LAYO so it does not conflict with anything else. + then include this header and set highest_base_layer. + + #define KF_LAYO SAFE_RANGE + #include "feature_default_layers_selector.h" + + const uint8_t highest_base_layer = 4; // the index + + and in your rules.mk, + + SRC += feature_default_layers_selector.c +*/ + +/* + See https://docs.qmk.fm/#/keymap for docs about layers including the concept + of "base" or "default" layers. + + This is broken into two functions so that: + + - If you don't want to store the default layer state in eeprom, don't call + process_record_save_default_layer. + + - If you have your own mechanism for setting the default layer state (to one + or multiple layers), do that instead of process_record_select_default_layer. + + If you call both functions, call process_record_save_default_layer first. + + The QMK docs seem to assume that you will have only one layer as your + default layer at any time, but the source code actually supports an arbitrary + default_layer_state (composition of layers) + + quantum has "set_single_persistent_default_layer" but that writes to eeprom + every time you change your default layer preference. i wanted a behavior + instead which lets you switch default layers all you want, then store the + current configuration once you're happy with it. that way if you get into an + unusable state you can just unplug and replug your keyboard to escape from it. + + this code assumes: + + 1. each default layer state that you would select among consists of a single + layer, which we will call a "base" layer. + + 2. all your "base" layers are stored contiguously at the bottom of your + keymaps[] stack, and there are no non-"base" layers mixed in. + + 3. you have a maximum of 8 "base" layers. that is, the highest base layer is + index 7. + + while 16 and 32 bit platforms might allow default_layer_state to include more + and higher-numbered layers, eeconfig_update_default_layer saves only the first + 8 bits of default_layer_state to eeprom. + +*/ + +#ifndef KF_LAYO +#define KF_LAYO SAFE_RANGE +#endif + +const uint8_t highest_base_layer; +bool process_record_save_default_layer(uint16_t keycode, keyrecord_t *record); +bool process_record_select_default_layer(uint16_t keycode, keyrecord_t *record); |