Compare commits

...
11 Commits
Author SHA1 Message Date
Joel Challis 9a0245b778 Fix boards which were overriding backlight without setting custom (#7970) 2020-01-27 22:31:54 +00:00
Bryan Arendt 43d2a0e167 [Keyboard] Adds ogre ergo split (#8011)
* Adds ogre ergo split

* remove uneeded line breaks
2020-01-27 10:14:50 -08:00
skullydazed 212aeee202 Revert "Clueboard Rev4 Updates aka Volcano 660 (#7942)"
This reverts commit e0a0430c31.
2020-01-27 17:38:47 +11:00
Michael F. Lamb 5fb95c5f94 create users/datagrok (#7653)
* users/datagrok: add shared functions

* users/datagrok: improve base-layer selection feature

* users/datagrok: add README.md
2020-01-26 23:26:40 -05:00
Mikkel Jeppesenandfauxpark 05d6e6ca78 Ensure setPinInput actually sets input high-Z (#6237)
* Ensure setPinInput actually sets input high-z

* Fixed _PIN_ADDRESS Macro arguments
as recommended by vomindoraan

* Fixed instances of setInput to use new behavour

* Changed kmac matrix to use input with pullups

* Update keyboards/gh60/revc/revc.h

Co-Authored-By: fauxpark <[email protected]>

* Fixed input state for unselect_rows

* fixed merge conflict

* Updated all instances of older uses of setPinInput()

* Fixed naming mistake

Co-authored-by: fauxpark <[email protected]>
2020-01-26 23:04:38 -05:00
Jumail Mundekkat 645c5fabf2 Add VIA support to MxSS, plus minor tweaks (#7809)
* Add VIA support to mxss and general cleanup

* Add support for RGB test for FLEDs

* Add LAYOUT_all to allow for more configuration

* Remove blank layers

* Updated readme

* Improve use of EEPROM

* Credit where its due

* Use the latest iteration of rgblight code

* Keep the RGB timer running if the front LED is in RGB mode

* Fix RGB breathing animation

* Better supported RGB animation
Only thing not working is alternating, but that's not too important

* Abstract front LED handlers from main kb code

* Add support for indicator LED color changing

* Remove debug statement

* Persist indicator LED colors

* Mark custom sections in rgblight.c

* Light commenting

* Fix up keymaps

* Add/update comments

* Remove bloat from default hex

* Tidy a stray tab

* Out with the old, in with the new

* Out with the old, in with the new

* Add LAYER_STATE_8BIT for VIA keymap
2020-01-26 17:06:56 -05:00
yiancar 7f7b6b08e8 [Keyboard] Initial commit for mc76k (#8000)
* Initial commit for mc76k

* Update config.h
2020-01-25 23:05:22 -08:00
James Young 72d7661b30 suggestions by skullydazed 2020-01-25 18:15:07 -08:00
James Young d0d106cef7 change Instructions listing in Docs summary 2020-01-25 18:15:07 -08:00
James Young d603e94f68 add Breaking Change PR Instructions doc 2020-01-25 18:15:07 -08:00
Lucas MoreiraandDrashna Jaelre 9ff61601e3 [Keymap] crkbd/kidbrazil adding layer dependent RGB & better idle timeout. (#7901)
* Added KidBrazil custom keymap for CRKBD
-Custom Font
-Custom OLED output

* Added missing readme

* Oled Timeout Update for KidBrazil Keymap (#1)

* Setup Oled timeout based on simple timer

* Cleaned up comments and added timeout for LEDs

* Fixed some small errors

* Updated oled timout with matrix scan

* Updated oled timout with matrix scan

* Update withou eeprom

* Update timer code

* Use process user instead of keymap

* Added ifdef to protect oledtimer

* Updated with half timeout state for logo

* Removed middle tier timer

* Final cleanup of unused files

* Updated code as per suggestions & requests

* Second round of revisions

* Updated keymap to better handle LED timeout
- Added boolean to hold LED state
- Added init function to set rgb to known state
- Modified RGB_TOG to work with noeeprom commands

* Finished adding the timeout for OLED and testing on CRKBD

* Updated documentation

* fixed the timeout logic so it works as intended

* Added initial limits to color settings

* Added layer reset as part of the iddle timeout process

* Split Keymap into more manageable files

* Finalizing RGB Layer status on CRKBD
- Refactored OLED timeout to deal only with oled
- If user remains iddle on game layer for too long it will switch to
default
- LED / OLED iddle working
- Minor changes to _SYM layer
- Removed some rgb controls from keyboard due to layer dependent RGB
colors

* Update keyboards/crkbd/keymaps/kidbrazil/keymap.c

Used suggestion from Drashna to replace EEPROM_RESET with shorter version.

Co-Authored-By: Drashna Jaelre <[email protected]>

* Update keyboards/crkbd/keymaps/kidbrazil/keymap.c

Co-Authored-By: Drashna Jaelre <[email protected]>

* Implemented drashna's comment

Co-authored-by: Drashna Jaelre <[email protected]>
2020-01-25 14:43:57 -08:00
78 changed files with 2787 additions and 1142 deletions

No files matched your search

+7 -5
View File
@@ -175,7 +175,9 @@ ifneq ($(strip $(LED_MATRIX_ENABLE)), no)
ifeq ($(filter $(LED_MATRIX_ENABLE),$(VALID_MATRIX_TYPES)),) ifeq ($(filter $(LED_MATRIX_ENABLE),$(VALID_MATRIX_TYPES)),)
$(error LED_MATRIX_ENABLE="$(LED_MATRIX_ENABLE)" is not a valid matrix type) $(error LED_MATRIX_ENABLE="$(LED_MATRIX_ENABLE)" is not a valid matrix type)
else 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.c
SRC += $(QUANTUM_DIR)/led_matrix_drivers.c SRC += $(QUANTUM_DIR)/led_matrix_drivers.c
endif endif
@@ -300,10 +302,6 @@ ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
$(error BACKLIGHT_DRIVER="$(BACKLIGHT_DRIVER)" is not a valid backlight type) $(error BACKLIGHT_DRIVER="$(BACKLIGHT_DRIVER)" is not a valid backlight type)
endif endif
ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
CIE1931_CURVE := yes
endif
COMMON_VPATH += $(QUANTUM_DIR)/backlight COMMON_VPATH += $(QUANTUM_DIR)/backlight
SRC += $(QUANTUM_DIR)/backlight/backlight.c SRC += $(QUANTUM_DIR)/backlight/backlight.c
OPT_DEFS += -DBACKLIGHT_ENABLE OPT_DEFS += -DBACKLIGHT_ENABLE
@@ -343,6 +341,10 @@ ifeq ($(strip $(WS2812_DRIVER_REQUIRED)), yes)
endif endif
endif endif
ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
CIE1931_CURVE := yes
endif
ifeq ($(strip $(CIE1931_CURVE)), yes) ifeq ($(strip $(CIE1931_CURVE)), yes)
OPT_DEFS += -DUSE_CIE1931_CURVE OPT_DEFS += -DUSE_CIE1931_CURVE
LED_TABLES := yes LED_TABLES := yes
+1
View File
@@ -18,6 +18,7 @@
* [Getting Help](getting_started_getting_help.md) * [Getting Help](getting_started_getting_help.md)
* [Breaking Changes](breaking_changes.md) * [Breaking Changes](breaking_changes.md)
* [My Pull Request Was Flagged](breaking_changes_instructions.md)
* [2019 Aug 30](ChangeLog/20190830.md) * [2019 Aug 30](ChangeLog/20190830.md)
* [FAQ](faq.md) * [FAQ](faq.md)
+42
View File
@@ -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 &ndash; [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 &ndash; usually named `future` &ndash; 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).
@@ -48,8 +48,6 @@ void led_set_user(uint8_t usb_led){
} else { } else {
//set to Hi-Z //set to Hi-Z
setPinInput(B0); setPinInput(B0);
writePinLow(B0);
setPinInput(D5); setPinInput(D5);
writePinLow(D5);
} }
} }
+1 -2
View File
@@ -30,6 +30,7 @@ CHANGELOG:
0.6 - Swapped ESC and GRV in all layers. 0.6 - Swapped ESC and GRV in all layers.
0.7 - Brought code up to current standards. 0.7 - Brought code up to current standards.
0.8 - Added MACLOCK macro. 0.8 - Added MACLOCK macro.
0.9 - Updated code to correspond to new setPinInput behaviour
TODO: TODO:
@@ -124,9 +125,7 @@ void matrix_init_user(void) {
#ifdef BOOTLOADER_CATERINA #ifdef BOOTLOADER_CATERINA
// This will disable the red LEDs on the ProMicros // This will disable the red LEDs on the ProMicros
setPinInput(D5); setPinInput(D5);
writePinLow(D5);
setPinInput(B0); setPinInput(B0);
writePinLow(B0);
#endif #endif
}; };
@@ -30,6 +30,10 @@ The bottom row is fairly Kinesis-ish since the Contour and Advantage keyboards h
### 0.7 ### 0.7
* Brought code up to new standards (as of 27 June 2019). * Brought code up to new standards (as of 27 June 2019).
* Updated this readme file. * Updated this readme file.
### 0.8
* Added MACLOCK macro.
### 0.9
* Updated code to correspond to new setPinInput behaviour.
### TODO: ### TODO:
+1
View File
@@ -22,6 +22,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover NKRO_ENABLE = yes # USB Nkey Rollover
BACKLIGHT_ENABLE = yes BACKLIGHT_ENABLE = yes
BACKLIGHT_DRIVER = custom
RGBLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes
LAYOUTS = ortho_4x12 LAYOUTS = ortho_4x12
+1
View File
@@ -22,6 +22,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover NKRO_ENABLE = yes # USB Nkey Rollover
BACKLIGHT_ENABLE = yes BACKLIGHT_ENABLE = yes
BACKLIGHT_DRIVER = custom
RGBLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes
LAYOUTS = ortho_5x12 LAYOUTS = ortho_5x12
+1
View File
@@ -22,6 +22,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover NKRO_ENABLE = yes # USB Nkey Rollover
BACKLIGHT_ENABLE = yes BACKLIGHT_ENABLE = yes
BACKLIGHT_DRIVER = custom
RGBLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes
ENCODER_ENABLE = yes ENCODER_ENABLE = yes
+1
View File
@@ -22,6 +22,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover NKRO_ENABLE = yes # USB Nkey Rollover
BACKLIGHT_ENABLE = yes BACKLIGHT_ENABLE = yes
BACKLIGHT_DRIVER = custom
RGBLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes
LAYOUTS = 60_ansi LAYOUTS = 60_ansi
+1
View File
@@ -22,4 +22,5 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover NKRO_ENABLE = yes # USB Nkey Rollover
BACKLIGHT_ENABLE = yes BACKLIGHT_ENABLE = yes
BACKLIGHT_DRIVER = custom
RGBLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes
+22
View File
@@ -54,3 +54,25 @@
//#define NO_ACTION_ONESHOT //#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO //#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION //#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
+42 -11
View File
@@ -1,4 +1,5 @@
#include "rev4.h" #include "rev4.h"
//#include "backlight.h"
void matrix_init_kb(void) { void matrix_init_kb(void) {
// put your keyboard start-up code here // put your keyboard start-up code here
@@ -7,19 +8,49 @@ void matrix_init_kb(void) {
led_init_ports(); 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
//DDRD |= (1<<6); // Esc
//DDRB |= (1<<7); // Page Up
//DDRD |= (1<<4); // Arrows
// Set our LED pins low
//PORTD &= ~(1<<6); // Esc
//PORTB &= ~(1<<7); // Page Up
//PORTD &= ~(1<<4); // Arrows
}
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
}
*/
}
void led_init_ports() { void led_init_ports() {
// Set our LED pins as output // Set our LED pins as output
setPinOutput(B13); // LED1 palSetPadMode(GPIOB, 13, PAL_MODE_OUTPUT_PUSHPULL); // LED1
writePinLow(B13); palClearPad(GPIOB, 13);
palSetPadMode(GPIOB, 14, PAL_MODE_OUTPUT_PUSHPULL); // LED2
setPinOutput(B14); // LED2 palClearPad(GPIOB, 14);
writePinLow(B14); palSetPadMode(GPIOA, 8, PAL_MODE_OUTPUT_PUSHPULL); // LED3
palClearPad(GPIOA, 8);
setPinOutput(B8); // LED3 palSetPadMode(GPIOA, 0, PAL_MODE_OUTPUT_PUSHPULL); // Capslock LED
writePinLow(B8); palClearPad(GPIOA, 0);
setPinOutput(B0); // Capslock LED
writePinLow(B0);
} }
void led_set_kb(uint8_t usb_led) { void led_set_kb(uint8_t usb_led) {
+8 -7
View File
@@ -4,17 +4,18 @@ MCU = STM32F303
# Build Options # Build Options
# comment out to disable the options. # comment out to disable the options.
# #
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration BACKLIGHT_ENABLE = yes
MOUSEKEY_ENABLE = yes # Mouse keys BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
EXTRAKEY_ENABLE = yes # Audio control and System control MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
CONSOLE_ENABLE = yes # Console for debug EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
COMMAND_ENABLE = yes # Commands for debug and configuration 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 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 RGBLIGHT_ENABLE = no # Enable keyboard underlight functionality
BACKLIGHT_ENABLE = no
MIDI_ENABLE = no # MIDI controls MIDI_ENABLE = no # MIDI controls
UNICODE_ENABLE = no # Unicode UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = yes
LAYOUTS = 66_ansi 66_iso LAYOUTS = 66_ansi 66_iso
@@ -16,6 +16,5 @@
*/ */
#include "hal.h" #include "hal.h"
#include "backlight.h"
#include "led.h" #include "led.h"
#include "printf.h" #include "printf.h"
@@ -5,7 +5,6 @@
#include "timer.h" #include "timer.h"
#include "wait.h" #include "wait.h"
#include "printf.h" #include "printf.h"
#include "backlight.h"
#include "matrix.h" #include "matrix.h"
#include "action.h" #include "action.h"
#include "keycode.h" #include "keycode.h"
@@ -7,7 +7,6 @@ LED_MATRIX_ENABLE = IS31FL3731
# Build Options # Build Options
# comment out to disable the options. # comment out to disable the options.
# #
BACKLIGHT_ENABLE = yes
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) ## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.)
MOUSEKEY_ENABLE = yes # Mouse keys MOUSEKEY_ENABLE = yes # Mouse keys
+57 -42
View File
@@ -52,49 +52,64 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif #endif
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
//# define RGB_MATRIX_KEYPRESSES // reacts to keypresses //# define RGB_MATRIX_KEYPRESSES // reacts to keypresses
// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of 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_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_DISABLE_WHEN_USB_SUSPENDED true // turn off effects when suspended
# define RGB_MATRIX_FRAMEBUFFER_EFFECTS #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_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_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_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_HUE_STEP 4
# define RGB_MATRIX_SAT_STEP 8 #define RGB_MATRIX_SAT_STEP 4
# define RGB_MATRIX_VAL_STEP 8 #define RGB_MATRIX_VAL_STEP 4
# define RGB_MATRIX_SPD_STEP 10 #define RGB_MATRIX_SPD_STEP 10
/* Disable the animations you don&#39;t want/need. You will need to disable a good number of these * /* Disable the animations you don&#39;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. */ * 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_ALPHAS_MODS
# define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN #define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
// # define DISABLE_RGB_MATRIX_BREATHING #define DISABLE_RGB_MATRIX_BREATHING
# define DISABLE_RGB_MATRIX_CYCLE_ALL #define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT
# define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT #define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL
# define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN #define DISABLE_RGB_MATRIX_BAND_SAT
# define DISABLE_RGB_MATRIX_CYCLE_OUT_IN #define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT
# define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL #define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL
# define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON #define DISABLE_RGB_MATRIX_BAND_VAL
# define DISABLE_RGB_MATRIX_DUAL_BEACON #define DISABLE_RGB_MATRIX_CYCLE_ALL
# define DISABLE_RGB_MATRIX_RAINBOW_BEACON #define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
# define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS #define DISABLE_RGB_MATRIX_CYCLE_OUT_IN
# define DISABLE_RGB_MATRIX_RAINDROPS #define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
# define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS #define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
# define DISABLE_RGB_MATRIX_TYPING_HEATMAP #define DISABLE_RGB_MATRIX_CYCLE_SPIRAL
# define DISABLE_RGB_MATRIX_DIGITAL_RAIN #define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE #define DISABLE_RGB_MATRIX_DUAL_BEACON
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE #define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE #define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE #define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS #define DISABLE_RGB_MATRIX_SOLID_REACTIVE
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS
# define DISABLE_RGB_MATRIX_SPLASH #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS
# define DISABLE_RGB_MATRIX_MULTISPLASH #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS
# define DISABLE_RGB_MATRIX_SOLID_SPLASH #define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS
# define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH #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 #endif
// Custom Font path
#define OLED_FONT_H "keyboards/crkbd/keymaps/kidbrazil/glcdfont.c" #define OLED_FONT_H "keyboards/crkbd/keymaps/kidbrazil/glcdfont.c"
#define OLED_DISABLE_TIMEOUT #define OLED_DISABLE_TIMEOUT
+10
View File
@@ -0,0 +1,10 @@
// [CRKBD layers Init] -------------------------------------------------------//
typedef enum {
_QWERTY,
_NUM,
_SYM,
_GAME,
_WEAPON
}CRKBD_LAYERS;
extern enum CRKBD_LAYERS crkbd_layers;
+57 -92
View File
@@ -1,4 +1,6 @@
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
#include "enums.h"
#include "layer.h"
// [Init Variables] ----------------------------------------------------------// // [Init Variables] ----------------------------------------------------------//
extern uint8_t is_master; 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. // Boolean to store the master LED clear so it only runs once.
bool master_oled_cleared = false; bool master_oled_cleared = false;
// [CRKBD layers Init] -------------------------------------------------------//
enum crkbd_layers {
_QWERTY,
_NUM,
_SYM,
_GAME,
_WEAPON
};
// [Keymaps] -----------------------------------------------------------------// // [Keymaps] -----------------------------------------------------------------//
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT( [_QWERTY] = LAYOUT(
@@ -36,8 +29,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_SYM] = LAYOUT( [_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, 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, 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, RGB_VAD, RGB_RMOD, RGB_HUD, RGB_SAD, TG(_GAME), KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_BSLS, KC_TILD, 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) 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( [_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_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_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 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 // Set RGB to known state
rgb_matrix_enable_noeeprom(); rgb_matrix_enable_noeeprom();
rgb_matrix_set_color_all(RGB_GREEN); rgb_matrix_set_color_all(RGB_GREEN);
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
user_led_enabled = true; user_led_enabled = true;
} }
// [Process User Input] ------------------------------------------------------// // [Process User Input] ------------------------------------------------------//
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) { switch (keycode) {
// Handle RGB Changes sans eeprom - necessary due to the layer dependent RGB color
// changes in marrix_scan_user
case RGB_TOG: case RGB_TOG:
if (record->event.pressed) { if (record->event.pressed) {
// Toggle matrix on key press // Toggle matrix on key press
user_led_enabled ? rgb_matrix_disable_noeeprom() : rgb_matrix_enable_noeeprom(); user_led_enabled ? rgb_matrix_disable_noeeprom() : rgb_matrix_enable_noeeprom();
} else { // Toggle boolean flag
// Flip User_led_enabled variable on key release user_led_enabled = !user_led_enabled;
user_led_enabled = !user_led_enabled; }
} return false;
return false; // Skip all further processing of this key
default: 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) { if (record->event.pressed) {
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_DRIVER_ENABLE
oled_timer = timer_read32(); 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] ------------------------------------------------------// // [OLED Configuration] ------------------------------------------------------//
#ifdef OLED_DRIVER_ENABLE #ifdef OLED_DRIVER_ENABLE
// Init Oled and Rotate.... // Init Oled and Rotate....
oled_rotation_t oled_init_user(oled_rotation_t rotation) { oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (!has_usb()) if (!has_usb())
@@ -105,74 +137,6 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
const char *read_logo(void); const char *read_logo(void);
// {OLED helpers} -----------------------------------------------// // {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 // Render Logo
void render_logo(void) { void render_logo(void) {
oled_write(read_logo(), false); oled_write(read_logo(), false);
@@ -209,7 +173,8 @@ void render_slave_oled(void) {
// {OLED Task} -----------------------------------------------// // {OLED Task} -----------------------------------------------//
void oled_task_user(void) { 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 // Render logo on both halves before full timeout
if (is_master && !master_oled_cleared) { if (is_master && !master_oled_cleared) {
// Clear master OLED once so the logo renders properly // Clear master OLED once so the logo renders properly
+69
View File
@@ -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);
}
}
@@ -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);
+2 -7
View File
@@ -8,10 +8,5 @@ RGB_MATRIX_ENABLE = WS2812
OLED_DRIVER_ENABLE = yes OLED_DRIVER_ENABLE = yes
# If you want to change the display of OLED, you need to change here # If you want to change the display of OLED, you need to change here
SRC += ./keyboards/crkbd/keymaps/kidbrazil/logo_reader.c \ SRC += logo_reader.c \
#./lib/rgb_state_reader.c \ layer.c
#./lib/logo_reader.c \
#./lib/keylogger.c \
# ./lib/mode_icon_reader.c \
# ./lib/host_led_state_reader.c \
# ./lib/timelogger.c \
-2
View File
@@ -132,9 +132,7 @@ void matrix_init_user(void) {
#ifdef BOOTLOADER_CATERINA #ifdef BOOTLOADER_CATERINA
// This will disable the red LEDs on the ProMicros // This will disable the red LEDs on the ProMicros
setPinInput(D5); setPinInput(D5);
writePinLow(D5);
setPinInput(B0); setPinInput(B0);
writePinLow(B0);
#endif #endif
}; };
+1
View File
@@ -79,6 +79,7 @@ SERIAL_LINK_ENABLE = yes
VISUALIZER_ENABLE = yes VISUALIZER_ENABLE = yes
LCD_ENABLE = yes LCD_ENABLE = yes
BACKLIGHT_ENABLE = yes BACKLIGHT_ENABLE = yes
BACKLIGHT_DRIVER = custom
LCD_BACKLIGHT_ENABLE = yes LCD_BACKLIGHT_ENABLE = yes
MIDI_ENABLE = no MIDI_ENABLE = no
RGBLIGHT_ENABLE = no RGBLIGHT_ENABLE = no
+5 -5
View File
@@ -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_esc_led_on(void) { setPinOutput(F6); writePinLow(F6); }
inline void gh60_wasd_leds_on(void) { setPinOutput(F7); writePinLow(F7); } 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_caps_led_off(void) { setPinInput(B2); }
inline void gh60_poker_leds_off(void) { setPinInput(F4); writePinLow(F4); } inline void gh60_poker_leds_off(void) { setPinInput(F4); }
inline void gh60_fn_led_off(void) { setPinInput(F5); writePinLow(F5); } inline void gh60_fn_led_off(void) { setPinInput(F5); }
inline void gh60_esc_led_off(void) { setPinInput(F6); writePinLow(F6); } inline void gh60_esc_led_off(void) { setPinInput(F6); }
inline void gh60_wasd_leds_off(void) { setPinInput(F7); writePinLow(F7); } inline void gh60_wasd_leds_off(void) { setPinInput(F7); }
/* GH60 keymap definition macro /* GH60 keymap definition macro
* K2C, K31 and K3C are extra keys for ISO * K2C, K31 and K3C are extra keys for ISO
+1 -1
View File
@@ -150,7 +150,7 @@ static void unselect_row(uint8_t row)
static void unselect_rows(void) static void unselect_rows(void)
{ {
for(uint8_t x = 0; x < MATRIX_ROWS; x++) { for(uint8_t x = 0; x < MATRIX_ROWS; x++) {
setPinInput(row_pins[x]); setPinInputHigh(row_pins[x]);
} }
} }
+1 -4
View File
@@ -215,10 +215,7 @@ void matrix_init(void) {
matrix_init_quantum(); matrix_init_quantum();
setPinInput(D5); setPinInput(D5);
writePinLow(D5); setPinInput(B0);
setPinInput(B0);
writePinLow(B0);
} }
// modified for per col read matrix scan // modified for per col read matrix scan
@@ -59,7 +59,6 @@ void led_set_user(uint8_t usb_led) {
writePinLow(D5); writePinLow(D5);
} else { } else {
setPinInput(D5); setPinInput(D5);
writePinLow(D5);
} }
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) { if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
@@ -67,7 +66,6 @@ void led_set_user(uint8_t usb_led) {
writePinLow(E6); writePinLow(E6);
} else { } else {
setPinInput(E6); setPinInput(E6);
writePinLow(E6);
} }
} }
-2
View File
@@ -54,7 +54,6 @@ void led_set_user(uint8_t usb_led) {
writePinLow(D5); writePinLow(D5);
} else { } else {
setPinInput(D5); setPinInput(D5);
writePinLow(D5);
} }
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) { if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
@@ -62,7 +61,6 @@ void led_set_user(uint8_t usb_led) {
writePinLow(E6); writePinLow(E6);
} else { } else {
setPinInput(E6); setPinInput(E6);
writePinLow(E6);
} }
} }
@@ -85,6 +85,5 @@ void led_set_user(uint8_t usb_led) {
writePinLow(B2); writePinLow(B2);
} else { } else {
setPinInput(B2); setPinInput(B2);
writePinLow(B2);
} }
} }
+1 -1
View File
@@ -140,7 +140,7 @@ static void select_col(uint8_t col) {
static void init_pins(void) { static void init_pins(void) {
unselect_cols(); unselect_cols();
for (uint8_t x = 0; x < MATRIX_ROWS; x++) { for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
setPinInput(row_pins[x]); setPinInputHigh(row_pins[x]);
} }
setPinInputHigh(E2); setPinInputHigh(E2);
+104
View File
@@ -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
+12
View File
@@ -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}]
}
}
}
+50
View File
@@ -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),
};
@@ -0,0 +1,5 @@
# The default keymap for MC-76K
![DEFAULT](https://i.imgur.com/GzUITtG.png)
![FN1](https://i.imgur.com/ytnKmxg.png)
+50
View File
@@ -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),
};
+1
View File
@@ -0,0 +1 @@
# Compile with this keymap to use VIA
+1
View File
@@ -0,0 +1 @@
VIA_ENABLE = yes
+34
View File
@@ -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;
}
+46
View File
@@ -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 } \
}
+15
View File
@@ -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).
+32
View File
@@ -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
@@ -169,9 +169,7 @@ void matrix_init_user(void) {
#ifdef BOOTLOADER_CATERINA #ifdef BOOTLOADER_CATERINA
// This will disable the red LEDs on the ProMicros // This will disable the red LEDs on the ProMicros
setPinInput(D5); setPinInput(D5);
writePinLow(D5);
setPinInput(B0); setPinInput(B0);
writePinLow(B0);
#endif #endif
}; };
+10 -3
View File
@@ -21,12 +21,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config_common.h" #include "config_common.h"
/* USB Device descriptor parameter */ /* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED #define VENDOR_ID 0x4D78 // "Mx" -> MxBlue
#define PRODUCT_ID 0x6060 #define PRODUCT_ID 0x5353 // "SS" -> MxSS
#define DEVICE_VER 0x0001 #define DEVICE_VER 0x0001
#define MANUFACTURER MxBlue #define MANUFACTURER MxBlue
#define PRODUCT MxSS #define PRODUCT MxSS
#define DESCRIPTION Custom Polycarb Keyboard #define DESCRIPTION MxSS Polycarb Keyboard
/* key matrix size */ /* key matrix size */
#define MATRIX_ROWS 5 #define MATRIX_ROWS 5
@@ -56,6 +56,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Locking resynchronize hack */ /* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE #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. /* 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). * This is userful for the Windows task manager shortcut (ctrl+shift+esc).
*/ */
+8 -7
View File
@@ -15,24 +15,25 @@
*/ */
#include QMK_KEYBOARD_H #include QMK_KEYBOARD_H
hs_set caps_color = { .hue = 0, .sat = 255 };
// Colors for layers // Colors for layers
// Format: {hue, saturation} // Format: {hue, saturation}
// {0, 0} to turn off the LED // {0, 0} to turn off the LED
// Add additional rows to handle more layers // Add additional rows to handle more layers
const hs_set layer_colors[] = { hs_set layer_colors[4] = {
[0] = {0, 0}, // Color for Layer 0 [0] = {.hue = 0, .sat = 0}, // Color for Layer 0
[1] = {86, 255}, // Color for Layer 1 [1] = {.hue = 86, .sat = 255}, // Color for Layer 1
[2] = {36, 255}, // Color for Layer 2 [2] = {.hue = 36, .sat = 255}, // Color for Layer 2
[3] = {185, 255}, // Color for Layer 3 [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 // Use NEW_SAFE_RANGE to define new custom keycodes in order to not overwrite the ones used for front LED control
enum custom_keycodes { enum custom_keycodes {
MY_KEYCODE = NEW_SAFE_RANGE, MY_KEYCODE = NEW_SAFE_RANGE,
}; };
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LAYOUT( /* Base */ 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_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,
+19
View File
@@ -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
+33
View File
@@ -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
)
};
+1
View File
@@ -0,0 +1 @@
VIA_ENABLE = yes
+36 -167
View File
@@ -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 * 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 * 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 * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * 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 QMK_KEYBOARD_H
#include "tmk_core/common/eeprom.h" #include "tmk_core/common/eeprom.h"
#include "tmk_core/common/action_layer.h" #include "tmk_core/common/action_layer.h"
#include "rgblight.h" #include "rgblight.h"
#include "via.h"
#include "version.h" // for QMK_BUILDDATE used in EEPROM magic
// Variables for controlling front LED application void via_init_kb(void) {
uint8_t fled_mode; // Mode for front LEDs fled_init();
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 matrix_init_kb(void) { void matrix_init_kb(void) {
// If EEPROM config exists, load it // If VIA is disabled, we still need to load settings
if (eeprom_is_valid()) { // Call via_init_kb() the same way as via_init(), with setting
fled_config fled_conf; // EEPROM valid afterwards.
fled_conf.raw = eeprom_read_byte(EEPROM_FRONTLED_ADDR); #ifndef VIA_ENABLE
fled_mode = fled_conf.mode; fled_init();
fled_val = fled_conf.val * FLED_VAL_STEP; via_eeprom_set_valid(true);
// Else, default config #endif // VIA_ENABLE
} 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]);
}
matrix_init_user(); matrix_init_user();
} }
@@ -82,132 +48,35 @@ void matrix_scan_kb(void) {
bool process_record_kb(uint16_t keycode, keyrecord_t *record) { bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
// Handle custom keycodes for front LED operation // Handle custom keycodes for front LED operation
switch (keycode) { process_record_fled(keycode, record);
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 process_record_user(keycode, record); return process_record_user(keycode, record);
} }
void led_set_kb(uint8_t usb_led) { bool led_update_kb(led_t led_state) {
// Set indicator LED appropriately, whether it is used or not fled_lock_update(led_state);
if (usb_led & (1 << USB_LED_CAPS_LOCK)) { return led_update_user(led_state);
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) { layer_state_t layer_state_set_kb(layer_state_t state) {
// Determine and set colour of layer LED according to current layer fled_layer_update(state);
// if hue = sat = 0, leave LED off return layer_state_set_user(state);
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 // Fallback eeprom functions if VIA is not enabled
#ifndef VIA_ENABLE
// Test if magic value is present at expected location // Sets VIA/keyboard level usage of EEPROM to valid/invalid
bool eeprom_is_valid(void) // Keyboard level code (eg. via_init_kb()) should not call this
void via_eeprom_set_valid(bool valid)
{ {
return (eeprom_read_word(EEPROM_MAGIC_ADDR) == EEPROM_MAGIC); 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);
} }
// Set magic value at expected location #endif
void eeprom_set_valid(bool valid)
{
eeprom_update_word(EEPROM_MAGIC_ADDR, valid ? EEPROM_MAGIC : 0xFFFF);
}
// 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);
}
// Custom keycode functions
void fled_mode_cycle(void)
{
// 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();
}
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();
}
+16 -3
View File
@@ -13,8 +13,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef MXSS_H #pragma once
#define MXSS_H
#include "quantum.h" #include "quantum.h"
#include "mxss_frontled.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 }, \ { 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 }, \
}
+264
View File
@@ -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
+31 -24
View File
@@ -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 * 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 * it under the terms of the GNU General Public License as published by
@@ -17,10 +17,11 @@
// EEPROM management code taken from Wilba6582 // EEPROM management code taken from Wilba6582
// https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/zeal_eeprom.h // https://github.com/Wilba6582/qmk_firmware/blob/zeal60/keyboards/zeal60/zeal_eeprom.h
#ifndef MXSS_FRONTLED_H #pragma once
#define MXSS_FRONTLED_H
#include "quantum.h"
#include "quantum_keycodes.h" #include "quantum_keycodes.h"
#include "via.h"
// RGBLED index for front LEDs // RGBLED index for front LEDs
#define RGBLIGHT_FLED1 14 #define RGBLIGHT_FLED1 14
@@ -29,13 +30,13 @@
// Brightness increase step for front LEDs // Brightness increase step for front LEDs
#define FLED_VAL_STEP 8 #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 // 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 // Modes for front LEDs
#define FLED_OFF 0b00 #define FLED_OFF 0b00
@@ -43,10 +44,6 @@
#define FLED_RGB 0b10 #define FLED_RGB 0b10
#define FLED_UNDEF 0b11 #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 // Config storage format for EEPROM
typedef union { typedef union {
uint8_t raw; uint8_t raw;
@@ -57,25 +54,35 @@ typedef union {
} fled_config; } fled_config;
// Structure to store hue and saturation values // Structure to store hue and saturation values
typedef struct _hs_set { typedef union {
uint16_t hue; uint16_t raw;
uint8_t sat; struct {
uint8_t hue;
uint8_t sat;
};
} hs_set; } hs_set;
// Custom keycodes for front LED control // Custom keycodes for front LED control
enum fled_keycodes { enum fled_keycodes {
FLED_MOD = SAFE_RANGE, FLED_MOD = USER00, // USER00 = VIA custom keycode start
FLED_VAI, FLED_VAI,
FLED_VAD, FLED_VAD,
NEW_SAFE_RANGE // define a new safe range NEW_SAFE_RANGE // define a new safe range
}; };
bool eeprom_is_valid(void); // Check if EEPROM has been set up void fled_init(void); // Run init functions for front LEDs
void eeprom_set_valid(bool valid); // Change validity state of EEPROM void process_record_fled(uint16_t keycode, keyrecord_t* record); // Process keycodes for front LEDs
void eeprom_update_conf(void); // Store current front LED config to EEPROM 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_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_increase(void); // Increase the brightness of the front LEDs
void fled_val_decrease(void); // Decrease the brightness of the front LEDs void fled_val_decrease(void); // Decrease the brightness of the front LEDs
#endif //MXSS_FRONTLED_H 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
+5
View File
@@ -2,6 +2,11 @@
![MxSS - Polycarb 65% Kit for MX/SMK](https://i.imgur.com/WDTWcmU.jpg) ![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: ### Information:
- Case: Frosted Polycarbonate, CNC milled - Case: Frosted Polycarbonate, CNC milled
+982 -630
View File
File diff suppressed because it is too large. Load diff
+245 -97
View File
@@ -16,137 +16,245 @@
#ifndef RGBLIGHT_H #ifndef RGBLIGHT_H
#define RGBLIGHT_H #define RGBLIGHT_H
#ifdef RGBLIGHT_ANIMATIONS #include "rgblight_reconfig.h"
#define RGBLIGHT_MODES 35
#else
#define RGBLIGHT_MODES 1
#endif
#ifndef RGBLIGHT_EFFECT_BREATHE_CENTER /***** rgblight_mode(mode)/rgblight_mode_noeeprom(mode) ****
#define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1-2.7
#endif
#ifndef RGBLIGHT_EFFECT_BREATHE_MAX old mode number (before 0.6.117) to new mode name table
#define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0-255
#endif
#ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH |-----------------|-----------------------------------|
#define RGBLIGHT_EFFECT_SNAKE_LENGTH 4 | old mode number | new mode name |
#endif |-----------------|-----------------------------------|
| 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 |
|-----------------|-----------------------------------|
*****/
#ifndef RGBLIGHT_EFFECT_KNIGHT_LENGTH #define _RGBM_SINGLE_STATIC(sym) RGBLIGHT_MODE_##sym,
#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3 #define _RGBM_SINGLE_DYNAMIC(sym) RGBLIGHT_MODE_##sym,
#endif #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_EFFECT_KNIGHT_OFFSET #ifndef RGBLIGHT_H_DUMMY_DEFINE
#define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0
#endif
#ifndef RGBLIGHT_EFFECT_KNIGHT_LED_NUM # define RGBLIGHT_MODES (RGBLIGHT_MODE_last - 1)
#define RGBLIGHT_EFFECT_KNIGHT_LED_NUM RGBLED_NUM
#endif
#ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL // sample: #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85
#define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 1000
#endif
#ifndef RGBLIGHT_EFFECT_CHRISTMAS_STEP # ifndef RGBLIGHT_EFFECT_BREATHE_MAX
#define RGBLIGHT_EFFECT_CHRISTMAS_STEP 2 # define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0-255
#endif # endif
#ifndef RGBLIGHT_HUE_STEP # ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH
#define RGBLIGHT_HUE_STEP 10 # define RGBLIGHT_EFFECT_SNAKE_LENGTH 4
#endif # 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) # 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 // #define RGBLED_TIMER_TOP 0xFF10
#include <stdint.h> # include <stdint.h>
#include <stdbool.h> # include <stdbool.h>
#include "eeconfig.h" # include "eeconfig.h"
#ifndef RGBLIGHT_CUSTOM_DRIVER # ifndef RGBLIGHT_CUSTOM_DRIVER
#include "ws2812.h" # include "ws2812.h"
#endif # endif
#include "color.h" # include "color.h"
#include "rgblight_list.h" # include "rgblight_list.h"
# if defined(__AVR__)
# include <avr/pgmspace.h>
# endif
extern LED_TYPE led[RGBLED_NUM]; extern LED_TYPE led[RGBLED_NUM];
extern const uint8_t RGBLED_BREATHING_INTERVALS[4] 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_MOOD_INTERVALS[3] PROGMEM;
extern const uint8_t RGBLED_RAINBOW_SWIRL_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_SNAKE_INTERVALS[3] PROGMEM;
extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM; extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM;
extern const uint16_t RGBLED_RGBTEST_INTERVALS[1] 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 { typedef union {
uint32_t raw; uint32_t raw;
struct { struct {
bool enable :1; bool enable : 1;
uint8_t mode :6; uint8_t mode : 7;
uint16_t hue :9; uint8_t hue : 8;
uint8_t sat :8; uint8_t sat : 8;
uint8_t val :8; uint8_t val : 8;
uint8_t speed :8;//EECONFIG needs to be increased to support this uint8_t speed : 8; // EECONFIG needs to be increased to support this
}; };
} rgblight_config_t; } 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_increase(void);
void rgblight_decrease(void); void rgblight_decrease(void);
void rgblight_toggle(void);
void rgblight_enable(void);
void rgblight_disable(void);
void rgblight_step(void); void rgblight_step(void);
void rgblight_step_noeeprom(void);
void rgblight_step_reverse(void); void rgblight_step_reverse(void);
uint8_t rgblight_get_mode(void); void rgblight_step_reverse_noeeprom(void);
void rgblight_mode(uint8_t mode);
void rgblight_set(void); /* effects mode disable/enable */
void rgblight_update_dword(uint32_t dword); void rgblight_toggle(void);
void rgblight_toggle_noeeprom(void);
void rgblight_enable(void);
void rgblight_enable_noeeprom(void);
void rgblight_disable(void);
void rgblight_disable_noeeprom(void);
/* hue, sat, val change */
void rgblight_increase_hue(void); void rgblight_increase_hue(void);
void rgblight_increase_hue_noeeprom(void);
void rgblight_decrease_hue(void); void rgblight_decrease_hue(void);
void rgblight_decrease_hue_noeeprom(void);
void rgblight_increase_sat(void); void rgblight_increase_sat(void);
void rgblight_increase_sat_noeeprom(void);
void rgblight_decrease_sat(void); void rgblight_decrease_sat(void);
void rgblight_decrease_sat_noeeprom(void);
void rgblight_increase_val(void); void rgblight_increase_val(void);
void rgblight_increase_val_noeeprom(void);
void rgblight_decrease_val(void); void rgblight_decrease_val(void);
void rgblight_decrease_val_noeeprom(void);
void rgblight_increase_speed(void); void rgblight_increase_speed(void);
void rgblight_decrease_speed(void); void rgblight_decrease_speed(void);
void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val); void rgblight_sethsv(uint8_t hue, uint8_t sat, uint8_t val);
uint16_t rgblight_get_hue(void); 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_sat(void);
uint8_t rgblight_get_val(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); uint32_t eeconfig_read_rgblight(void);
void eeconfig_update_rgblight(uint32_t val); void eeconfig_update_rgblight(uint32_t val);
void eeconfig_update_rgblight_default(void); void eeconfig_update_rgblight_default(void);
void eeconfig_debug_rgblight(void); void eeconfig_debug_rgblight(void);
void rgb_matrix_increase(void); void rgb_matrix_increase(void);
void rgb_matrix_decrease(void); void rgb_matrix_decrease(void);
void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom);
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_mode_eeprom_helper(uint8_t mode, 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_show_solid_color(uint8_t r, uint8_t g, uint8_t b);
void rgblight_task(void); void rgblight_task(void);
@@ -155,12 +263,52 @@ void rgblight_timer_init(void);
void rgblight_timer_enable(void); void rgblight_timer_enable(void);
void rgblight_timer_disable(void); void rgblight_timer_disable(void);
void rgblight_timer_toggle(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
+4 -2
View File
@@ -14,7 +14,7 @@ BOOTLOADER = atmel-dfu
# Build Options # Build Options
# change yes to no to disable # 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) MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450) EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400) 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 AUDIO_ENABLE = no # Audio output on port C6
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
SRC += mxss_frontled.c
# Remove the common RGB light code and use my iteration instead # Remove the common RGB light code and use my iteration instead
OPT_DEFS += -DRGBLIGHT_ENABLE OPT_DEFS += -DRGBLIGHT_ENABLE
SRC += $(QUANTUM_DIR)/process_keycode/process_rgb.c SRC += $(QUANTUM_DIR)/process_keycode/process_rgb.c
SRC += rgblight.c SRC += rgblight.c
SRC += color.c
SRC += ws2812.c SRC += ws2812.c
CIE1931_CURVE = yes CIE1931_CURVE = yes
LED_BREATHING_TABLE = yes
+9 -8
View File
@@ -14,19 +14,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include QMK_KEYBOARD_H #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} // Format: {hue, saturation}
// {0, 0} to turn off the LED // {0, 0} to turn off the LED
// Add additional rows to handle more layers // Add additional rows to handle more layers
hs_set layer_colors[] = { hs_set layer_colors[4] = {
[0] = {0, 0}, // Color for Layer 0 [0] = {.hue = 0, .sat = 0}, // Color for Layer 0
[1] = {86, 255}, // Color for Layer 1 [1] = {.hue = 86, .sat = 255}, // Color for Layer 1
[2] = {36, 255}, // Color for Layer 2 [2] = {.hue = 36, .sat = 255}, // Color for Layer 2
[3] = {185, 255}, // Color for Layer 3 [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 // Use NEW_SAFE_RANGE to define new custom keycodes in order to not overwrite the ones used for front LED control
enum custom_keycodes { enum custom_keycodes {
-1
View File
@@ -21,7 +21,6 @@ void led_set_kb(uint8_t usb_led) {
writePinHigh(B0); writePinHigh(B0);
} else { } else {
setPinInput(B0); setPinInput(B0);
writePinLow(B0);
} }
led_set_user(usb_led); led_set_user(usb_led);
+52
View File
@@ -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
+17
View File
@@ -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"
+39
View File
@@ -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 }, \
}
@@ -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, _______
),
};
@@ -0,0 +1 @@
# The default keymap for ergo_split
+15
View File
@@ -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).
+33
View File
@@ -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
@@ -63,9 +63,7 @@ void matrix_init_user(void) {
#ifdef BOOTLOADER_CATERINA #ifdef BOOTLOADER_CATERINA
// This will disable the red LEDs on the ProMicros // This will disable the red LEDs on the ProMicros
setPinInput(D5); setPinInput(D5);
writePinLow(D5);
setPinInput(B0); setPinInput(B0);
writePinLow(B0);
#endif #endif
}; };
+1
View File
@@ -72,6 +72,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # USB Nkey Rollover NKRO_ENABLE = yes # USB Nkey Rollover
CUSTOM_MATRIX = yes # Custom matrix file CUSTOM_MATRIX = yes # Custom matrix file
BACKLIGHT_ENABLE = yes BACKLIGHT_ENABLE = yes
BACKLIGHT_DRIVER = custom
VISUALIZER_ENABLE = yes VISUALIZER_ENABLE = yes
LED_DRIVER = is31fl3731c LED_DRIVER = is31fl3731c
-1
View File
@@ -6,7 +6,6 @@ void led_set_kb(uint8_t usb_led) {
writePinLow(F4); writePinLow(F4);
} else { } else {
setPinInput(F4); setPinInput(F4);
writePinLow(F4);
} }
led_set_user(usb_led); led_set_user(usb_led);
@@ -132,9 +132,7 @@ void matrix_init_user(void) {
#ifdef BOOTLOADER_CATERINA #ifdef BOOTLOADER_CATERINA
// This will disable the red LEDs on the ProMicros // This will disable the red LEDs on the ProMicros
setPinInput(D5); setPinInput(D5);
writePinLow(D5);
setPinInput(B0); setPinInput(B0);
writePinLow(B0);
#endif #endif
}; };
@@ -151,9 +151,7 @@ void matrix_init_user(void) {
#ifdef BOOTLOADER_CATERINA #ifdef BOOTLOADER_CATERINA
// This will disable the red LEDs on the ProMicros // This will disable the red LEDs on the ProMicros
setPinInput(D5); setPinInput(D5);
writePinLow(D5);
setPinInput(B0); setPinInput(B0);
writePinLow(B0);
#endif #endif
}; };
+1 -1
View File
@@ -132,7 +132,7 @@
# endif # endif
# ifndef __ASSEMBLER__ # 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 // Port X Input Pins Address
# define PINx_ADDRESS(p) _PIN_ADDRESS(p, 0) # define PINx_ADDRESS(p) _PIN_ADDRESS(p, 0)
// Port X Data Direction Register, 0:input 1:output // Port X Data Direction Register, 0:input 1:output
+2 -1
View File
@@ -174,7 +174,7 @@ extern layer_state_t layer_state;
#if defined(__AVR__) #if defined(__AVR__)
typedef uint8_t pin_t; 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 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 setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low")
# define setPinOutput(pin) (DDRx_ADDRESS(pin) |= _BV((pin)&0xF)) # 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 writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin))
# define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin)&0xF))) # define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin)&0xF)))
#elif defined(PROTOCOL_CHIBIOS) #elif defined(PROTOCOL_CHIBIOS)
typedef ioline_t pin_t; typedef ioline_t pin_t;
+63
View File
@@ -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
+47
View File
@@ -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;
}
}
+2
View File
@@ -0,0 +1,2 @@
#include QMK_KEYBOARD_H
bool process_record_cdeq(uint16_t keycode, keyrecord_t *record);
@@ -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;
}
@@ -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);