Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f50c7eba1 | ||
|
|
2ba54690e6 | ||
|
|
222380c636 | ||
|
|
9b3f397ab2 | ||
|
|
ecdf14bb62 | ||
|
|
642f6cf14f | ||
|
|
f3bdd436a3 | ||
|
|
d04485e32c |
No files matched your search
@@ -146,7 +146,7 @@ Additionally, hitting keys five times in a short period will lock that key. This
|
|||||||
You can control the behavior of one shot keys by defining these in `config.h`:
|
You can control the behavior of one shot keys by defining these in `config.h`:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
#define ONESHOT_TAP_TOGGLE 5 /* Tapping this number of times holds the key until tapped this number of times again. */
|
#define ONESHOT_TAP_TOGGLE 5 /* Tapping this number of times holds the key until tapped once again. */
|
||||||
#define ONESHOT_TIMEOUT 5000 /* Time (in ms) before the one shot key is released */
|
#define ONESHOT_TIMEOUT 5000 /* Time (in ms) before the one shot key is released */
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,11 @@ If you're using a 60% keyboard, or any other layout with no F-row, you will have
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Replace the `KC_GRAVE` key in your keymap (usually to the left of the `1` key) with `KC_GESC`. When pressed it will behave like `KC_ESC`, but with Shift or GUI held it will send `KC_GRAVE`.
|
Replace the `KC_GRAVE` key in your keymap (usually to the left of the `1` key) with `KC_GESC`. Most of the time this key will output `KC_ESC` when pressed. However, when Shift or GUI are held down it will output `KC_GRV` instead.
|
||||||
|
|
||||||
|
## What Your OS Sees
|
||||||
|
|
||||||
|
If Mary presses GESC on her keyboard, the OS will see an KC_ESC character. Now if Mary holds Shift down and presses GESC it will output `~`, or a shifted backtick. Now if she holds GUI/CMD/WIN, it will output a simple <code>`</code> character.
|
||||||
|
|
||||||
## Keycodes
|
## Keycodes
|
||||||
|
|
||||||
@@ -12,6 +16,10 @@ Replace the `KC_GRAVE` key in your keymap (usually to the left of the `1` key) w
|
|||||||
|---------|-----------|------------------------------------------------------------------|
|
|---------|-----------|------------------------------------------------------------------|
|
||||||
|`KC_GESC`|`GRAVE_ESC`|Escape when pressed, <code>`</code> when Shift or GUI are held|
|
|`KC_GESC`|`GRAVE_ESC`|Escape when pressed, <code>`</code> when Shift or GUI are held|
|
||||||
|
|
||||||
|
### Caveats
|
||||||
|
|
||||||
|
* On macOS CMD/GUI + KC_GRV is actually mapped to a hot key so it will not output a backtick.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
There are several possible key combinations this will break, among them Control+Shift+Escape on Windows and Command+Option+Escape on macOS. To work around this, you can `#define` these options in your `config.h`:
|
There are several possible key combinations this will break, among them Control+Shift+Escape on Windows and Command+Option+Escape on macOS. To work around this, you can `#define` these options in your `config.h`:
|
||||||
|
|||||||
+37
-31
@@ -148,37 +148,43 @@ const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90};
|
|||||||
|
|
||||||
If you need to change your RGB lighting in code, for example in a macro to change the color whenever you switch layers, QMK provides a set of functions to assist you. See [`rgblight.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight.h) for the full list, but the most commonly used functions include:
|
If you need to change your RGB lighting in code, for example in a macro to change the color whenever you switch layers, QMK provides a set of functions to assist you. See [`rgblight.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight.h) for the full list, but the most commonly used functions include:
|
||||||
|
|
||||||
|Function |Description |
|
|Function |Description |
|
||||||
|-----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|--------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|`rgblight_enable()` |Turn LEDs on, based on their previous state |
|
|`rgblight_enable()` |Turn LEDs on, based on their previous state |
|
||||||
|`rgblight_enable_noeeprom()` |Turn LEDs on, based on their previous state (not written to EEPROM) |
|
|`rgblight_enable_noeeprom()` |Turn LEDs on, based on their previous state (not written to EEPROM) |
|
||||||
|`rgblight_disable()` |Turn LEDs off |
|
|`rgblight_disable()` |Turn LEDs off |
|
||||||
|`rgblight_disable_noeeprom()` |Turn LEDs off (not written to EEPROM) |
|
|`rgblight_disable_noeeprom()` |Turn LEDs off (not written to EEPROM) |
|
||||||
|`rgblight_mode(x)` |Set the mode, if RGB animations are enabled |
|
|`rgblight_mode(x)` |Set the mode, if RGB animations are enabled |
|
||||||
|`rgblight_mode_noeeprom(x)` |Set the mode, if RGB animations are enabled (not written to EEPROM) |
|
|`rgblight_mode_noeeprom(x)` |Set the mode, if RGB animations are enabled (not written to EEPROM) |
|
||||||
|`rgblight_setrgb(r, g, b)` |Set all LEDs to the given RGB value where `r`/`g`/`b` are between 0 and 255 (not written to EEPROM) |
|
|`rgblight_setrgb(r, g, b)` |Set all LEDs to the given RGB value where `r`/`g`/`b` are between 0 and 255 (not written to EEPROM) |
|
||||||
|`rgblight_setrgb_at(r, g, b, led)` |Set a single LED to the given RGB value, where `r`/`g`/`b` are between 0 and 255 and `led` is between 0 and `RGBLED_NUM` (not written to EEPROM) |
|
|`rgblight_setrgb_at(r, g, b, led)` |Set a single LED to the given RGB value, where `r`/`g`/`b` are between 0 and 255 and `led` is between 0 and `RGBLED_NUM` (not written to EEPROM) |
|
||||||
|`rgblight_sethsv(h, s, v)` |Set all LEDs to the given HSV value where `h` is between 0 and 360 and `s`/`v` are between 0 and 255 |
|
|`rgblight_setrgb_range(r, g, b, start, end)`|Set a continuous range of LEDs to the given RGB value, where `r`/`g`/`b` are between 0 and 255 and `start`(included) and `stop`(excluded) are between 0 and `RGBLED_NUM` (not written to EEPROM)|
|
||||||
|`rgblight_sethsv_noeeprom(h, s, v)`|Set all LEDs to the given HSV value where `h` is between 0 and 360 and `s`/`v` are between 0 and 255 (not written to EEPROM) |
|
|`rgblight_setrgb_master(r, g, b)` |Set the LEDs on the master side to the given RGB value, where `r`/`g`/`b` are between 0 and 255 (not written to EEPROM) |
|
||||||
|`rgblight_sethsv_at(h, s, v, led)` |Set a single LED to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255, and `led` is between 0 and `RGBLED_NUM` (not written to EEPROM)|
|
|`rgblight_setrgb_slave(r, g, b)` |Set the LEDs on the slave side to the given RGB value, where `r`/`g`/`b` are between 0 and 255 (not written to EEPROM) |
|
||||||
|`rgblight_toggle()` |Toggle all LEDs between on and off |
|
|`rgblight_sethsv(h, s, v)` |Set all LEDs to the given HSV value where `h` is between 0 and 360 and `s`/`v` are between 0 and 255 |
|
||||||
|`rgblight_toggle_noeeprom()` |Toggle all LEDs between on and off (not written to EEPROM) |
|
|`rgblight_sethsv_noeeprom(h, s, v)` |Set all LEDs to the given HSV value where `h` is between 0 and 360 and `s`/`v` are between 0 and 255 (not written to EEPROM) |
|
||||||
|`rgblight_step()` |Change the mode to the next RGB animation in the list of enabled RGB animations |
|
|`rgblight_sethsv_at(h, s, v, led)` |Set a single LED to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255, and `led` is between 0 and `RGBLED_NUM` (not written to EEPROM)|
|
||||||
|`rgblight_step_noeeprom()` |Change the mode to the next RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|
|`rgblight_sethsv_range(h, s, v, start, end)`|Set a continuous range of LEDs to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255, and `start`(included) and `stop`(excluded) are between 0 and `RGBLED_NUM` (not written to EEPROM)|
|
||||||
|`rgblight_step_reverse()` |Change the mode to the previous RGB animation in the list of enabled RGB animations |
|
|`rgblight_sethsv_master(h, s, v)` |Set the LEDs on the master side to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255 (not written to EEPROM) |
|
||||||
|`rgblight_step_reverse_noeeprom()` |Change the mode to the previous RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|
|`rgblight_sethsv_slave(h, s, v)` |Set the LEDs on the slave side to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255 (not written to EEPROM) |
|
||||||
|`rgblight_increase_hue()` |Increase the hue for all LEDs. This wraps around at maximum hue |
|
|`rgblight_toggle()` |Toggle all LEDs between on and off |
|
||||||
|`rgblight_increase_hue_noeeprom()` |Increase the hue for all LEDs. This wraps around at maximum hue (not written to EEPROM) |
|
|`rgblight_toggle_noeeprom()` |Toggle all LEDs between on and off (not written to EEPROM) |
|
||||||
|`rgblight_decrease_hue()` |Decrease the hue for all LEDs. This wraps around at minimum hue |
|
|`rgblight_step()` |Change the mode to the next RGB animation in the list of enabled RGB animations |
|
||||||
|`rgblight_decrease_hue_noeeprom()` |Decrease the hue for all LEDs. This wraps around at minimum hue (not written to EEPROM) |
|
|`rgblight_step_noeeprom()` |Change the mode to the next RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|
||||||
|`rgblight_increase_sat()` |Increase the saturation for all LEDs. This wraps around at maximum saturation |
|
|`rgblight_step_reverse()` |Change the mode to the previous RGB animation in the list of enabled RGB animations |
|
||||||
|`rgblight_increase_sat_noeeprom()` |Increase the saturation for all LEDs. This wraps around at maximum saturation (not written to EEPROM) |
|
|`rgblight_step_reverse_noeeprom()` |Change the mode to the previous RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|
||||||
|`rgblight_decrease_sat()` |Decrease the saturation for all LEDs. This wraps around at minimum saturation |
|
|`rgblight_increase_hue()` |Increase the hue for all LEDs. This wraps around at maximum hue |
|
||||||
|`rgblight_decrease_sat_noeeprom()` |Decrease the saturation for all LEDs. This wraps around at minimum saturation (not written to EEPROM) |
|
|`rgblight_increase_hue_noeeprom()` |Increase the hue for all LEDs. This wraps around at maximum hue (not written to EEPROM) |
|
||||||
|`rgblight_increase_val()` |Increase the value for all LEDs. This wraps around at maximum value |
|
|`rgblight_decrease_hue()` |Decrease the hue for all LEDs. This wraps around at minimum hue |
|
||||||
|`rgblight_increase_val_noeeprom()` |Increase the value for all LEDs. This wraps around at maximum value (not written to EEPROM) |
|
|`rgblight_decrease_hue_noeeprom()` |Decrease the hue for all LEDs. This wraps around at minimum hue (not written to EEPROM) |
|
||||||
|`rgblight_decrease_val()` |Decrease the value for all LEDs. This wraps around at minimum value |
|
|`rgblight_increase_sat()` |Increase the saturation for all LEDs. This wraps around at maximum saturation |
|
||||||
|`rgblight_decrease_val_noeeprom()` |Decrease the value for all LEDs. This wraps around at minimum value (not written to EEPROM) |
|
|`rgblight_increase_sat_noeeprom()` |Increase the saturation for all LEDs. This wraps around at maximum saturation (not written to EEPROM) |
|
||||||
|
|`rgblight_decrease_sat()` |Decrease the saturation for all LEDs. This wraps around at minimum saturation |
|
||||||
|
|`rgblight_decrease_sat_noeeprom()` |Decrease the saturation for all LEDs. This wraps around at minimum saturation (not written to EEPROM) |
|
||||||
|
|`rgblight_increase_val()` |Increase the value for all LEDs. This wraps around at maximum value |
|
||||||
|
|`rgblight_increase_val_noeeprom()` |Increase the value for all LEDs. This wraps around at maximum value (not written to EEPROM) |
|
||||||
|
|`rgblight_decrease_val()` |Decrease the value for all LEDs. This wraps around at minimum value |
|
||||||
|
|`rgblight_decrease_val_noeeprom()` |Decrease the value for all LEDs. This wraps around at minimum value (not written to EEPROM) |
|
||||||
|
|
||||||
Additionally, [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h) defines several predefined shortcuts for various colors. Feel free to add to this list!
|
Additionally, [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h) defines several predefined shortcuts for various colors. Feel free to add to this list!
|
||||||
|
|
||||||
|
|||||||
Executable
+101
@@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* APA102 lib V1.0a
|
||||||
|
*
|
||||||
|
* Controls APA102 RGB-LEDs
|
||||||
|
* Author: Mikkel (Duckle29 on github)
|
||||||
|
*
|
||||||
|
* Dec 22th, 2017 v1.0a Initial Version
|
||||||
|
*
|
||||||
|
* 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 "apa102.h"
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
// Setleds for standard RGB
|
||||||
|
void inline apa102_setleds(LED_TYPE *ledarray, uint16_t leds){
|
||||||
|
apa102_setleds_pin(ledarray,leds, _BV(RGB_DI_PIN & 0xF), _BV(RGB_CLK_PIN & 0xF));
|
||||||
|
}
|
||||||
|
|
||||||
|
void static inline apa102_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask_DI, uint8_t pinmask_CLK){
|
||||||
|
pinMode(RGB_DI_PIN, PinDirectionOutput);
|
||||||
|
pinMode(RGB_CLK_PIN, PinDirectionOutput);
|
||||||
|
|
||||||
|
apa102_send_array((uint8_t*)ledarray,leds)
|
||||||
|
}
|
||||||
|
|
||||||
|
void apa102_send_array(uint8_t *data, uint16_t leds){ // Data is struct of 3 bytes. RGB - leds is number of leds in data
|
||||||
|
apa102_start_frame();
|
||||||
|
while(leds--){
|
||||||
|
apa102_send_frame(0xFF000000 | (data->b << 16) | (data->g << 8) | data->r);
|
||||||
|
data++;
|
||||||
|
}
|
||||||
|
apa102_end_frame(leds);
|
||||||
|
}
|
||||||
|
|
||||||
|
void apa102_send_frame(uint32_t frame){
|
||||||
|
for(uint32_t i=0xFF; i>0;){
|
||||||
|
apa102_send_byte(frame & i);
|
||||||
|
i = i << 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void apa102_start_frame(){
|
||||||
|
apa102_send_frame(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void apa102_end_frame(uint16_t leds)
|
||||||
|
{
|
||||||
|
// This function has been taken from: https://github.com/pololu/apa102-arduino/blob/master/APA102.h
|
||||||
|
// and adapted. The code is MIT licensed. I think thats compatible?
|
||||||
|
|
||||||
|
// We need to send some more bytes to ensure that all the LEDs in the
|
||||||
|
// chain see their new color and start displaying it.
|
||||||
|
//
|
||||||
|
// The data stream seen by the last LED in the chain will be delayed by
|
||||||
|
// (count - 1) clock edges, because each LED before it inverts the clock
|
||||||
|
// line and delays the data by one clock edge. Therefore, to make sure
|
||||||
|
// the last LED actually receives the data we wrote, the number of extra
|
||||||
|
// edges we send at the end of the frame must be at least (count - 1).
|
||||||
|
// For the APA102C, that is sufficient.
|
||||||
|
//
|
||||||
|
// The SK9822 only updates after it sees 32 zero bits followed by one more
|
||||||
|
// rising edge. To avoid having the update time depend on the color of
|
||||||
|
// the last LED, we send a dummy 0xFF byte. (Unfortunately, this means
|
||||||
|
// that partial updates of the beginning of an LED strip are not possible;
|
||||||
|
// the LED after the last one you are trying to update will be black.)
|
||||||
|
// After that, to ensure that the last LED in the chain sees 32 zero bits
|
||||||
|
// and a rising edge, we need to send at least 65 + (count - 1) edges. It
|
||||||
|
// is sufficent and simpler to just send (5 + count/16) bytes of zeros.
|
||||||
|
//
|
||||||
|
// We are ignoring the specification for the end frame in the APA102/SK9822
|
||||||
|
// datasheets because it does not actually ensure that all the LEDs will
|
||||||
|
// start displaying their new colors right away.
|
||||||
|
|
||||||
|
apa102_send_byte(0xFF);
|
||||||
|
for (uint16_t i = 0; i < 5 + leds / 16; i++){
|
||||||
|
apa102_send_byte(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void apa102_send_byte(uint8_t byte){
|
||||||
|
uint8_t i;
|
||||||
|
for (i = 0; i < 8; i++){
|
||||||
|
digitalWrite(RGB_DI_PIN, !!(byte & (1 << (7-i)));
|
||||||
|
digitalWrite(RGB_CLK_PIN, PinLevelHigh);
|
||||||
|
}
|
||||||
|
}
|
||||||
Executable
+46
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* light weight WS2812 lib include
|
||||||
|
*
|
||||||
|
* Version 2.3 - Nev 29th 2015
|
||||||
|
* Author: Tim ([email protected])
|
||||||
|
*
|
||||||
|
* Please do not change this file! All configuration is handled in "ws2812_config.h"
|
||||||
|
*
|
||||||
|
* 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 <avr/io.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
|
||||||
|
#include "rgblight_types.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* User Interface
|
||||||
|
*
|
||||||
|
* Input:
|
||||||
|
* ledarray: An array of GRB data describing the LED colors
|
||||||
|
* number_of_leds: The number of LEDs to write
|
||||||
|
* pinmask (optional): Bitmask describing the output bin. e.g. _BV(PB0)
|
||||||
|
*
|
||||||
|
* The functions will perform the following actions:
|
||||||
|
* - Set the data-out pin as output
|
||||||
|
* - Send out the LED data
|
||||||
|
* - Wait 50�s to reset the LEDs
|
||||||
|
*/
|
||||||
|
|
||||||
|
void apa102_setleds (LED_TYPE *ledarray, uint16_t number_of_leds);
|
||||||
|
void apa102_setleds_pin (LED_TYPE *ledarray, uint16_t number_of_leds,uint8_t pinmask);
|
||||||
|
void apa102_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds);
|
||||||
@@ -10,4 +10,4 @@
|
|||||||

|

|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
To build the default keymap, simply run `make kbd75/rev2:edulpn`.
|
To build the default keymap, simply run `make kbdfans/kbd75/rev2:edulpn`.
|
||||||
@@ -26,7 +26,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
),
|
),
|
||||||
|
|
||||||
[MAC_LAYER] = LAYOUT(
|
[MAC_LAYER] = LAYOUT(
|
||||||
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_PSCR, TG(MAC_LAYER), KC_DEL,
|
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_PSCR, TG(WINDOWS_LAYER), KC_DEL,
|
||||||
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_BSPC, KC_BSPC, KC_HOME,
|
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_BSPC, KC_BSPC, KC_HOME,
|
||||||
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_END,
|
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_END,
|
||||||
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP,
|
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP,
|
||||||
|
|||||||
@@ -0,0 +1,431 @@
|
|||||||
|
#+Title: Samuel's Literate QMK Config
|
||||||
|
#+PROPERTY: header-args :tangle ~/qmk_firmware/keyboards/planck/keymaps/samuel/keymap.c
|
||||||
|
|
||||||
|
This is my qmk firmware for my keyboard. I grew tired of organizing the keycode
|
||||||
|
array in plain text so I made it a literate .org file. I've never done this
|
||||||
|
before, so bear with me.
|
||||||
|
|
||||||
|
* Keymap
|
||||||
|
|
||||||
|
#+BEGIN_COMMENT
|
||||||
|
#+NAME: empty-layer
|
||||||
|
| <6> | <6> | <6> | <6> | <6> | <6> | <6> | <6> | <6> | <6> | <6> | <6> |
|
||||||
|
|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
||||||
|
| - | - | - | - | - | - | - | - | - | - | - | - |
|
||||||
|
| - | - | - | - | - | - | - | - | - | - | - | - |
|
||||||
|
| - | - | - | - | - | - | - | - | - | - | - | - |
|
||||||
|
| - | - | - | - | - | - | - | - | - | - | - | - |
|
||||||
|
|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
||||||
|
#+END_COMMENT
|
||||||
|
|
||||||
|
This is my "pretty" org mode organized table for my main dvorak layer. If you
|
||||||
|
don't use org mode, it won't be that exiting, but if you enjoy working in org
|
||||||
|
mode, you can edit this table directly, and this file is tangled to the actual
|
||||||
|
keymap. No more organizing spaces or converting to and from comments.
|
||||||
|
|
||||||
|
#+NAME: home-layer
|
||||||
|
|--------+--------+------+------+------+-----+-----+-----+------+-------+--------+--------|
|
||||||
|
| T_LRSE | QUOT | COMM | DOT | P | Y | F | G | C | R | L | T_RRSE |
|
||||||
|
| T_LSFT | A | O | E | U | I | D | H | T | N | S | T_RSFT |
|
||||||
|
| T_LCTL | SCLN | Q | J | K | X | B | M | W | V | Z | T_RCTL |
|
||||||
|
| T_LGUI | T_LALT | UP | DOWN | BSPC | TAB | ENT | SPC | LEFT | RIGHT | T_RALT | T_RGUI |
|
||||||
|
|--------+--------+------+------+------+-----+-----+-----+------+-------+--------+--------|
|
||||||
|
|
||||||
|
I tried to keep my layout bare bones, just what would be available on a normal
|
||||||
|
keyboard, minus some keys I never used. The bottom left copies a normal
|
||||||
|
keyboards symbols from shifted numbers, and the rest is placed where convenient,
|
||||||
|
with some considerations for one handed use, hence the shortcuts in the top
|
||||||
|
left.
|
||||||
|
|
||||||
|
#+TODO: qwerty layer for ma friends
|
||||||
|
|
||||||
|
#+NAME: secondary-layer
|
||||||
|
|----+--------+--------+--------+--------+------+------+----+--------+--------+-----+----|
|
||||||
|
| -- | EZUNDO | EZCOPY | EZCUT | EZPSTE | INS | EQL | 7 | 8 | 9 | F11 | -- |
|
||||||
|
| -- | ESC | CAPS | PGUP | PGDN | F4 | ASTR | 4 | 5 | 6 | 0 | -- |
|
||||||
|
| -- | EXLM | AT | HASH | DLR | PERC | CIRC | 1 | 2 | 3 | F12 | -- |
|
||||||
|
| -- | -- | EZUP | EZDOWN | -- | AMPR | PIPE | -- | EZLEFT | EZRGHT | -- | -- |
|
||||||
|
|----+--------+--------+--------+--------+------+------+----+--------+--------+-----+----|
|
||||||
|
|
||||||
|
But wait, we are missing several important keys!? yes, well, the modifier keys
|
||||||
|
all do other keys when tapped. More about that in the keymap section.
|
||||||
|
|
||||||
|
* Keymap Conversion in Python
|
||||||
|
|
||||||
|
This python can convert that table into the array needed for the keymap file. It
|
||||||
|
simply prepends every key with "KC_". I used to use a dictionary to convert some
|
||||||
|
keys from the table into qmk keycodes, but the double convertion was
|
||||||
|
unneccessary so I simply prepended all my macros with KC and moved all the
|
||||||
|
implementation to the `process-user-input` function.
|
||||||
|
|
||||||
|
#+NAME:layer-to-array
|
||||||
|
#+BEGIN_SRC python :var keys=secondary-layer :tangle no
|
||||||
|
results = "{"
|
||||||
|
row = 0
|
||||||
|
while row < len(keys):
|
||||||
|
results += '{ '
|
||||||
|
key = 0
|
||||||
|
while key < len(keys[row]):
|
||||||
|
keyName = str(keys[row][key])
|
||||||
|
if keyName == '--':
|
||||||
|
keyName = 'TRANSPARENT'
|
||||||
|
results += 'KC_' + keyName
|
||||||
|
if key != 11:
|
||||||
|
results += ', '
|
||||||
|
key+=1
|
||||||
|
results += '}'
|
||||||
|
if row != 3:
|
||||||
|
results += ','
|
||||||
|
results += '\n'
|
||||||
|
row+=1
|
||||||
|
results += '},\n'
|
||||||
|
return results
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* keymap.c
|
||||||
|
|
||||||
|
Now that we have done all the hard work, lets layout our keymap file then define
|
||||||
|
our macros.
|
||||||
|
|
||||||
|
** Headers And Layer Declaration
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
extern keymap_config_t keymap_config;
|
||||||
|
|
||||||
|
static uint16_t tap_timers[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
char last_mod = -1;
|
||||||
|
|
||||||
|
enum planck_layers {
|
||||||
|
_DVORAK,
|
||||||
|
_RISE
|
||||||
|
};
|
||||||
|
|
||||||
|
// where the 'T_' communicates how the key does something different when tapped.
|
||||||
|
enum planck_keycodes {
|
||||||
|
DVORAK = SAFE_RANGE,
|
||||||
|
KC_T_LALT,
|
||||||
|
KC_T_RALT,
|
||||||
|
KC_T_LGUI,
|
||||||
|
KC_T_RGUI,
|
||||||
|
KC_T_LCTL,
|
||||||
|
KC_T_RCTL,
|
||||||
|
KC_T_LSFT,
|
||||||
|
KC_T_RSFT,
|
||||||
|
KC_T_LRSE,
|
||||||
|
KC_T_RRSE,
|
||||||
|
KC_EZRGHT,
|
||||||
|
KC_EZLEFT,
|
||||||
|
KC_EZUP,
|
||||||
|
KC_EZDOWN,
|
||||||
|
KC_EZUNDO,
|
||||||
|
KC_EZCOPY,
|
||||||
|
KC_EZCUT,
|
||||||
|
KC_EZPSTE
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Import Key table
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
[_DVORAK] =
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
<<layer-to-array(home-layer)>>
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
[_RISE] =
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
<<layer-to-array(secondary-layer)>>
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Process User Input
|
||||||
|
*** Tap Key Functionality
|
||||||
|
|
||||||
|
These methods define how I implemented the tap mechanic. Basically, I believe
|
||||||
|
that /pressing/ any other key should be grounds for the hold functionality to be
|
||||||
|
assumed. My natuaral typing style experiences no delays from my method.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
};
|
||||||
|
|
||||||
|
void mod_press(uint16_t hold_code, int id) {
|
||||||
|
tap_timers[id] = timer_read();
|
||||||
|
last_mod = id;
|
||||||
|
register_code(hold_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mod_lift(uint16_t tap_code, uint16_t hold_code, int id) {
|
||||||
|
unregister_code(hold_code);
|
||||||
|
if (last_mod == id && timer_elapsed(tap_timers[id]) < TAPPING_TERM) {
|
||||||
|
tap_code16(tap_code);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Set DVORAK layout
|
||||||
|
|
||||||
|
The function that filter's user inputs and applies macros, the begginning is
|
||||||
|
pretty basic, setting our main layer and configuring our secondary layer.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
|
case DVORAK:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_single_persistent_default_layer(_DVORAK);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Alt and ()
|
||||||
|
|
||||||
|
Left and right alt are ( and ) when tapped. I put them on alt instead of a more
|
||||||
|
conveniant key like control because parentheses do not need to be shift modified
|
||||||
|
ever, unlike some other tap keys seen in the next sections.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
case KC_T_LALT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LALT, 0);
|
||||||
|
} else {
|
||||||
|
mod_lift(S(KC_9), KC_LALT, 0);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RALT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RALT, 1);
|
||||||
|
} else {
|
||||||
|
mod_lift(S(KC_0), KC_RALT, 1);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Gui and `\
|
||||||
|
|
||||||
|
I place gui in the bottom corner because I believe it is the hardest key to
|
||||||
|
reach, so gui seemed like a good fit for a dedicated key that I never want to
|
||||||
|
have to spam. For tap keys, I used equally unused keys that are not apart of the
|
||||||
|
number pad or shifted number keys.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
case KC_T_LGUI:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LGUI, 2);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_GRAVE, KC_LGUI, 2);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RGUI:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RGUI, 3);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_BSLASH, KC_RGUI, 3);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Ctrl and []
|
||||||
|
|
||||||
|
Left and right control are [] respectively when they are tapped, making { and }
|
||||||
|
also very convenient.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
case KC_T_LCTL:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LCTL, 4);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_LBRACKET, KC_LCTL, 4);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RCTL:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RCTL, 5);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_RBRACKET, KC_RCTL, 5);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Shft and =-
|
||||||
|
|
||||||
|
I place shift on the home row, so having '-' right of my pinkie is standard, and
|
||||||
|
it only felt natural to put its opposite, '=/+' on the other side. I put an
|
||||||
|
extra one on the right side in the secondary layer for the num pad.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
case KC_T_LSFT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LSFT, 6);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_EQUAL, KC_LSFT, 6);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RSFT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RSFT, 7);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_MINUS, KC_RSFT, 7);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Rise, DEL, and /
|
||||||
|
|
||||||
|
I use the top corners as rise because I decided that I do not like using layers
|
||||||
|
with my thumbs. It feels uncomfortable to hold keys down with the side of my
|
||||||
|
thumb, and backspace, tab, enter, and spacebar keep them satisfied. My pinky is
|
||||||
|
for holding modifiers, so it makes sense to put the layer key with the other
|
||||||
|
modifiers. Both my left and right layer keys activate the same layer which also
|
||||||
|
makes sense to me. You wouldn't want left and right shift to do different things
|
||||||
|
|
||||||
|
I used to have escape in the top left, but I use delete a lot more, and putting
|
||||||
|
escape under a layer has not been a problem at all. I put / in the top right
|
||||||
|
corner again mimicing a standard dvorak keyboard.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
case KC_T_LRSE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_timers[8] = timer_read();
|
||||||
|
last_mod = 8;
|
||||||
|
layer_on(_RISE);
|
||||||
|
} else {
|
||||||
|
layer_off(_RISE);
|
||||||
|
if (last_mod == 8 && timer_elapsed(tap_timers[8]) < TAPPING_TERM) {
|
||||||
|
tap_code16(KC_DELETE);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RRSE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_timers[9] = timer_read();
|
||||||
|
last_mod = 9;
|
||||||
|
layer_on(_RISE);
|
||||||
|
} else {
|
||||||
|
layer_off(_RISE);
|
||||||
|
if (last_mod == 9 && timer_elapsed(tap_timers[9]) < TAPPING_TERM) {
|
||||||
|
tap_code16(KC_SLASH);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** EZ keys
|
||||||
|
|
||||||
|
I use ctrl+shift+arrows keys a lot, so when the layer key is pressed they became
|
||||||
|
lazy versions of themselves with control and shift already pressed.
|
||||||
|
|
||||||
|
I also added undo, copy, paste, and cut to be easily available with only the
|
||||||
|
left hand like on a qwerty or colemek keyboard.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
case KC_EZRGHT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_RGHT));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZLEFT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_LEFT));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZDOWN:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_DOWN));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZUP:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_UP));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZUNDO:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_Z));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZCOPY:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_C));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZCUT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_X));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZPSTE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_P));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Standard inputs interupt tap
|
||||||
|
|
||||||
|
Finally, if just a standard key is tapped, set the interupted flag.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
}
|
||||||
|
last_mod = -1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#+END_SRC
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
#define TAPPING_TERM 250
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
extern keymap_config_t keymap_config;
|
||||||
|
|
||||||
|
static uint16_t tap_timers[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
char last_mod = -1;
|
||||||
|
|
||||||
|
enum planck_layers {
|
||||||
|
_DVORAK,
|
||||||
|
_RISE
|
||||||
|
};
|
||||||
|
|
||||||
|
// where the 'T_' communicates how the key does something different when tapped.
|
||||||
|
enum planck_keycodes {
|
||||||
|
DVORAK = SAFE_RANGE,
|
||||||
|
KC_T_LALT,
|
||||||
|
KC_T_RALT,
|
||||||
|
KC_T_LGUI,
|
||||||
|
KC_T_RGUI,
|
||||||
|
KC_T_LCTL,
|
||||||
|
KC_T_RCTL,
|
||||||
|
KC_T_LSFT,
|
||||||
|
KC_T_RSFT,
|
||||||
|
KC_T_LRSE,
|
||||||
|
KC_T_RRSE,
|
||||||
|
KC_EZRGHT,
|
||||||
|
KC_EZLEFT,
|
||||||
|
KC_EZUP,
|
||||||
|
KC_EZDOWN,
|
||||||
|
KC_EZUNDO,
|
||||||
|
KC_EZCOPY,
|
||||||
|
KC_EZCUT,
|
||||||
|
KC_EZPSTE
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
[_DVORAK] =
|
||||||
|
|
||||||
|
{{ KC_T_LRSE, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_T_RRSE},
|
||||||
|
{ KC_T_LSFT, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_T_RSFT},
|
||||||
|
{ KC_T_LCTL, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_T_RCTL},
|
||||||
|
{ KC_T_LGUI, KC_T_LALT, KC_UP, KC_DOWN, KC_BSPC, KC_TAB, KC_ENT, KC_SPC, KC_LEFT, KC_RIGHT, KC_T_RALT, KC_T_RGUI}
|
||||||
|
},
|
||||||
|
|
||||||
|
[_RISE] =
|
||||||
|
|
||||||
|
{{ KC_TRANSPARENT, KC_EZUNDO, KC_EZCOPY, KC_EZCUT, KC_EZPSTE, KC_INS, KC_EQL, KC_7, KC_8, KC_9, KC_F11, KC_TRANSPARENT},
|
||||||
|
{ KC_TRANSPARENT, KC_ESC, KC_CAPS, KC_PGUP, KC_PGDN, KC_F4, KC_ASTR, KC_4, KC_5, KC_6, KC_0, KC_TRANSPARENT},
|
||||||
|
{ KC_TRANSPARENT, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_1, KC_2, KC_3, KC_F12, KC_TRANSPARENT},
|
||||||
|
{ KC_TRANSPARENT, KC_TRANSPARENT, KC_EZUP, KC_EZDOWN, KC_TRANSPARENT, KC_AMPR, KC_PIPE, KC_TRANSPARENT, KC_EZLEFT, KC_EZRGHT, KC_TRANSPARENT, KC_TRANSPARENT}
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
void mod_press(uint16_t hold_code, int id) {
|
||||||
|
tap_timers[id] = timer_read();
|
||||||
|
last_mod = id;
|
||||||
|
register_code(hold_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mod_lift(uint16_t tap_code, uint16_t hold_code, int id) {
|
||||||
|
unregister_code(hold_code);
|
||||||
|
if (last_mod == id && timer_elapsed(tap_timers[id]) < TAPPING_TERM) {
|
||||||
|
tap_code16(tap_code);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
|
case DVORAK:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_single_persistent_default_layer(_DVORAK);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KC_T_LALT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LALT, 0);
|
||||||
|
} else {
|
||||||
|
mod_lift(S(KC_9), KC_LALT, 0);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RALT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RALT, 1);
|
||||||
|
} else {
|
||||||
|
mod_lift(S(KC_0), KC_RALT, 1);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KC_T_LGUI:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LGUI, 2);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_GRAVE, KC_LGUI, 2);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RGUI:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RGUI, 3);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_BSLASH, KC_RGUI, 3);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KC_T_LCTL:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LCTL, 4);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_LBRACKET, KC_LCTL, 4);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RCTL:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RCTL, 5);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_RBRACKET, KC_RCTL, 5);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KC_T_LSFT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LSFT, 6);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_EQUAL, KC_LSFT, 6);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RSFT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RSFT, 7);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_MINUS, KC_RSFT, 7);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KC_T_LRSE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_timers[8] = timer_read();
|
||||||
|
last_mod = 8;
|
||||||
|
layer_on(_RISE);
|
||||||
|
} else {
|
||||||
|
layer_off(_RISE);
|
||||||
|
if (last_mod == 8 && timer_elapsed(tap_timers[8]) < TAPPING_TERM) {
|
||||||
|
tap_code16(KC_DELETE);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RRSE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_timers[9] = timer_read();
|
||||||
|
last_mod = 9;
|
||||||
|
layer_on(_RISE);
|
||||||
|
} else {
|
||||||
|
layer_off(_RISE);
|
||||||
|
if (last_mod == 9 && timer_elapsed(tap_timers[9]) < TAPPING_TERM) {
|
||||||
|
tap_code16(KC_SLASH);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KC_EZRGHT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_RGHT));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZLEFT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_LEFT));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZDOWN:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_DOWN));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZUP:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_UP));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZUNDO:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_Z));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZCOPY:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_C));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZCUT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_X));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZPSTE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_P));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
last_mod = -1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -139,12 +139,12 @@
|
|||||||
{"label":"Left", "x":13.5, "y":4},
|
{"label":"Left", "x":13.5, "y":4},
|
||||||
{"label":"Down", "x":14.5, "y":4},
|
{"label":"Down", "x":14.5, "y":4},
|
||||||
{"label":"Right", "x":15.5, "y":4},
|
{"label":"Right", "x":15.5, "y":4},
|
||||||
{"label":"Space", "x":5.5, "y":5, "H":2},
|
{"label":"Space", "x":5.5, "y":5, "h":2},
|
||||||
{"label":"Ins", "x":6.5, "y":5},
|
{"label":"Ins", "x":6.5, "y":5},
|
||||||
{"label":"Del", "x":6.5, "y":6},
|
{"label":"Del", "x":6.5, "y":6},
|
||||||
{"label":"Home", "x":9.5, "y":5},
|
{"label":"Home", "x":9.5, "y":5},
|
||||||
{"label":"End", "x":9.5, "y":6},
|
{"label":"End", "x":9.5, "y":6},
|
||||||
{"label":"Space", "x":10.5, "y":5, "H":2}
|
{"label":"Space", "x":10.5, "y":5, "h":2}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -611,6 +611,42 @@ void rgblight_sethsv_at(uint16_t hue, uint8_t sat, uint8_t val, uint8_t index) {
|
|||||||
rgblight_setrgb_at(tmp_led.r, tmp_led.g, tmp_led.b, index);
|
rgblight_setrgb_at(tmp_led.r, tmp_led.g, tmp_led.b, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8_t end) {
|
||||||
|
if (!rgblight_config.enable || start < 0 || start >= end || end > RGBLED_NUM) { return; }
|
||||||
|
|
||||||
|
for (uint8_t i = start; i < end; i++) {
|
||||||
|
led[i].r = r;
|
||||||
|
led[i].g = g;
|
||||||
|
led[i].b = b;
|
||||||
|
}
|
||||||
|
rgblight_set();
|
||||||
|
wait_ms(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_sethsv_range(uint16_t hue, uint8_t sat, uint8_t val, uint8_t start, uint8_t end) {
|
||||||
|
if (!rgblight_config.enable) { return; }
|
||||||
|
|
||||||
|
LED_TYPE tmp_led;
|
||||||
|
sethsv(hue, sat, val, &tmp_led);
|
||||||
|
rgblight_setrgb_range(tmp_led.r, tmp_led.g, tmp_led.b, start, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b) {
|
||||||
|
rgblight_setrgb_range(r, g, b, 0 , (uint8_t) RGBLED_NUM/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b) {
|
||||||
|
rgblight_setrgb_range(r, g, b, (uint8_t) RGBLED_NUM/2, (uint8_t) RGBLED_NUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_sethsv_master(uint16_t hue, uint8_t sat, uint8_t val) {
|
||||||
|
rgblight_sethsv_range(hue, sat, val, 0, (uint8_t) RGBLED_NUM/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_sethsv_slave(uint16_t hue, uint8_t sat, uint8_t val) {
|
||||||
|
rgblight_sethsv_range(hue, sat, val, (uint8_t) RGBLED_NUM/2, (uint8_t) RGBLED_NUM);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef RGBLIGHT_CUSTOM_DRIVER
|
#ifndef RGBLIGHT_CUSTOM_DRIVER
|
||||||
void rgblight_set(void) {
|
void rgblight_set(void) {
|
||||||
if (rgblight_config.enable) {
|
if (rgblight_config.enable) {
|
||||||
|
|||||||
@@ -187,6 +187,12 @@ uint8_t rgblight_get_val(void);
|
|||||||
void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b);
|
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_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);
|
void rgblight_sethsv_at(uint16_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(uint16_t hue, uint8_t sat, uint8_t val, uint8_t start, uint8_t end);
|
||||||
|
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(uint16_t hue, uint8_t sat, uint8_t val);
|
||||||
|
void rgblight_sethsv_slave(uint16_t hue, uint8_t sat, uint8_t val);
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
Reference in new issue
Block a user