This commit is contained in:
Stephan Bösebeck 2016-05-11 22:05:19 +02:00
commit d09d2da1c2
51 changed files with 4081 additions and 2722 deletions

View File

@ -47,8 +47,8 @@ If you have any problems building the firmware, you can try using a tool called
Note: Some keyboard folders have non-standard organizations, and may not even support specifying alternate keymaps. Until these get reorganized, you will need to edit their default keymaps directly.
1. Running the `make` command from your keyboard's folder will generate a .hex file based on the default keymap. All keymaps for a particular keyboard live in the `keymaps` folder in that keyboard's folder. To create your own keymap, copy `keymaps/default/keymap.c` to the `keymaps` folder, and rename it with your name, for example jack.c. Or, if you don't care about the ability to share your keymap with the community via GitHub, you can just modify the default keymap itself. Details on how to program keymap files can be found in other guides.
2. To build a keymap other than the default, type `KEYMAP=<name>` after `make`. So if I've named my keymap jack.c, the full command would be `make KEYMAP=jack`.
1. Running the `make` command from your keyboard's folder will generate a .hex file based on the default keymap. All keymaps for a particular keyboard live in the `keymaps` folder in that keyboard's folder. To create your own keymap, duplicate the folder `keymaps/default`, and rename it with your name, for example `jack`. Or, if you don't care about the ability to share your keymap with the community via GitHub, you can just modify the default keymap itself. Details on how to program keymap files can be found in other guides.
2. To build a keymap other than the default, type `KEYMAP=<name>` after `make`. So if I've named my keymap `jack`, the full command would be `make KEYMAP=jack`.
3. How you deploy the firmware will depend on whether you are using a PCB or a Teensy. In both cases, you'll need to put the keyboard in bootloader mode, either by pressing a button on the PCB/Teensy or pressing the key with the `RESET` keycode. Then, if you're using a PCB, just run `make KEYMAP=<name> dfu` to both build and deploy the firmware. If you're using a Teensy, you'll probably need to take the <keyboardname>.hex file that make produces in the keyboard's folder, and deploy it using the [Teensy Loader.](https://www.pjrc.com/teensy/loader.html)
## Helpful Tips

View File

@ -33,6 +33,10 @@ If your keymap directory has a file called `makefile.mk` (note the lowercase fil
So let's say your keyboard's makefile has `CONSOLE_ENABLE = yes` (or maybe doesn't even list the `CONSOLE_ENABLE` option, which would cause it to revert to the global Quantum default). You want your particular keymap to not have the debug console, so you make a file called `makefile.mk` and specify `CONSOLE_ENABLE = no`.
### Customizing config.h on a per-keymap basis
If you use the ErgoDox EZ, you can make a `config_user.h` file in your keymap directory and use it to override any `config.h` settings you don't like. Anything you set there will take precedence over the global `config.h` for the ErgoDox EZ. To see an example of this, check out `keymaps/erez_experimental`.
## Quick aliases to common actions
Your keymap can include shortcuts to common operations (called "function actions" in tmk).
@ -41,10 +45,13 @@ Your keymap can include shortcuts to common operations (called "function actions
`MO(layer)` - momentary switch to *layer*. As soon as you let go of the key, the layer is deactivated and you pop back out to the previous layer. When you apply this to a key, that same key must be set as `KC_TRNS` on the destination layer. Otherwise, you won't make it back to the original layer when you release the key (and you'll get a keycode sent). You can only switch to layers *above* your current layer. If you're on layer 0 and you use `MO(1)`, that will switch to layer 1 just fine. But if you include `MO(3)` on layer 5, that won't do anything for you -- because layer 3 is lower than layer 5 on the stack.
`OSL(layer)` - momentary switch to *layer*, as a one-shot operation. So if you have a key that's defined as `OSL(1)`, and you tap that key, then only the very next keystroke would come from layer 1. You would drop back to layer zero immediately after that one keystroke. That's handy if you have a layer full of custom shortcuts -- for example, a dedicated key for closing a window. So you tap your one-shot layer mod, then tap that magic 'close window' key, and keep typing like a boss. Layer 1 would remain active as long as you hold that key down, too (so you can use it like a momentary toggle-layer key with extra powers).
`LT(layer, kc)` - momentary switch to *layer* when held, and *kc* when tapped. Like `MO()`, this only works upwards in the layer stack (`layer` must be higher than the current layer).
`TG(layer)` - toggles a layer on or off. As with `MO()`, you should set this key as `KC_TRNS` in the destination layer so that tapping it again actually toggles back to the original layer. Only works upwards in the layer stack.
### Fun with modifier keys
* `LSFT(kc)` - applies left Shift to *kc* (keycode) - `S(kc)` is an alias
@ -80,17 +87,24 @@ The following shortcuts automatically add `LSFT()` to keycodes to get commonly u
KC_PLUS +
KC_LCBR {
KC_RCBR }
KC_LABK <
KC_RABK >
KC_PIPE |
KC_COLN :
`OSM(mod)` - this is a "one shot" modifier. So let's say you have your left Shift key defined as `OSM(MOD_LSFT)`. Tap it, let go, and Shift is "on" -- but only for the next character you'll type. So to write "The", you don't need to hold down Shift -- you tap it, tap t, and move on with life. And if you hold down the left Shift key, it just works as a left Shift key, as you would expect (so you could type THE). There's also a magical, secret way to "lock" a modifier by tapping it multiple times. If you want to learn more about that, open an issue. :)
`MT(mod, kc)` - is *mod* (modifier key - MOD_LCTL, MOD_LSFT) when held, and *kc* when tapped. In other words, you can have a key that sends Esc (or the letter O or whatever) when you tap it, but works as a Control key or a Shift key when you hold it down.
These are the values you can use for the `mod` in `MT()` (right-hand modifiers are not available):
These are the values you can use for the `mod` in `MT()` and `OSM()` (right-hand modifiers are not available for `MT()`):
* MOD_LCTL
* MOD_LSFT
* MOD_LALT
* MOD_LGUI
* MOD_HYPR
* MOD_MEH
These can also be combined like `MOD_LCTL | MOD_LSFT` e.g. `MT(MOD_LCTL | MOD_LSFT, KC_ESC)` which would activate Control and Shift when held, and send Escape when tapped.
@ -363,6 +377,55 @@ You can currently send 4 hex digits with your OS-specific modifier key (RALT for
Enable the backlight from the Makefile.
## Driving a speaker - audio support
Your keyboard can make sounds! If you've got a Planck, Preonic, or basically any keyboard that allows access to the C6 port, you can hook up a simple speaker and have it beep. You can use those beeps to indicate layer transitions, modifiers, special keys, or just to play some funky 8bit tunes.
The audio code lives in [quantum/audio/audio.h](/quantum/audio/audio.h) and in the other files in the audio directory. It's enabled by default on the Planck [stock keymap](/keyboard/planck/keymaps/default/keymap.c). Here are the important bits:
```
#include "audio.h"
```
Then, lower down the file:
```
float tone_startup[][2] = {
ED_NOTE(_E7 ),
E__NOTE(_CS7),
E__NOTE(_E6 ),
E__NOTE(_A6 ),
M__NOTE(_CS7, 20)
};
```
This is how you write a song. Each of these lines is a note, so we have a little ditty composed of five notes here.
Then, we have this chunk:
```
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
float tone_plover[][2] = SONG(PLOVER_SOUND);
float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
float goodbye[][2] = SONG(GOODBYE_SOUND);
```
Wherein we bind predefined songs (from [audio/song_list.h](/audio/song_list.h)) into named variables. This is one optimization that helps save on memory: These songs only take up memory when you reference them in your keymap, because they're essentially all preprocessor directives.
So now you have something called `tone_plover` for example. How do you make it play the Plover tune, then? If you look further down the keymap, you'll see this:
```
PLAY_NOTE_ARRAY(tone_plover, false, 0); // Signature is: Song name, repeat, rest style
```
This is inside one of the macros. So when that macro executes, your keyboard plays that particular chime.
"Rest style" in the method signature above (the last parameter) specifies if there's a rest (a moment of silence) between the notes.
## MIDI functionalty
This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happening. Enable from the Makefile.

View File

@ -2,27 +2,27 @@
__attribute__ ((weak))
void matrix_init_user(void) {
// leave this function blank - it can be defined in a keymap file
// leave this function blank - it can be defined in a keymap file
};
__attribute__ ((weak))
void matrix_scan_user(void) {
// leave this function blank - it can be defined in a keymap file
// leave this function blank - it can be defined in a keymap file
}
__attribute__ ((weak))
void process_action_user(keyrecord_t *record) {
// leave this function blank - it can be defined in a keymap file
// leave this function blank - it can be defined in a keymap file
}
__attribute__ ((weak))
void led_set_user(uint8_t usb_led) {
// leave this function blank - it can be defined in a keymap file
// leave this function blank - it can be defined in a keymap file
}
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
// put your keyboard start-up code here
// runs once when the firmware starts up
MCUCR |= (1<<JTD);
MCUCR |= (1<<JTD);
@ -35,31 +35,39 @@ void matrix_init_kb(void) {
DDRE |= (1<<6);
PORTE |= (1<<6);
matrix_init_user();
matrix_init_user();
}
void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)
// put your looping keyboard code here
// runs every cycle (a lot)
matrix_scan_user();
matrix_scan_user();
}
void process_action_kb(keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
process_action_user(record);
process_action_user(record);
}
void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
led_set_user(usb_led);
led_set_user(usb_led);
}
#ifdef BACKLIGHT_ENABLE
#define CHANNEL OCR1C
#define BREATHING_NO_HALT 0
#define BREATHING_HALT_OFF 1
#define BREATHING_HALT_ON 2
static uint8_t breath_intensity;
static uint8_t breath_speed;
static uint16_t breathing_index;
static uint8_t breathing_halt;
void backlight_init_ports()
{
@ -67,54 +75,250 @@ void backlight_init_ports()
// Setup PB7 as output and output low.
DDRB |= (1<<7);
PORTB &= ~(1<<7);
// Use full 16-bit resolution.
// Use full 16-bit resolution.
ICR1 = 0xFFFF;
// I could write a wall of text here to explain... but TL;DW
// Go read the ATmega32u4 datasheet.
// And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on
// Pin PB7 = OCR1C (Timer 1, Channel C)
// Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0
// (i.e. start high, go low when counter matches.)
// WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0
// Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1
TCCR1A = _BV(COM1C1) | _BV(WGM11); // = 0b00001010;
TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001;
backlight_init();
breathing_defaults();
}
void backlight_set(uint8_t level)
{
// Prevent backlight blink on lowest level
PORTB &= ~(_BV(PORTB7));
if ( level == 0 )
{
// Turn off PWM control on PB7, revert to output low.
TCCR1A &= ~(_BV(COM1C1));
// Set the brightness to 0
CHANNEL = 0x0;
// Prevent backlight blink on lowest level
PORTB &= ~(_BV(PORTB7));
}
else if ( level == BACKLIGHT_LEVELS )
else if ( level >= BACKLIGHT_LEVELS )
{
// Prevent backlight blink on lowest level
PORTB &= ~(_BV(PORTB7));
// Turn on PWM control of PB7
TCCR1A |= _BV(COM1C1);
// Set the brightness
// Set the brightness to max
CHANNEL = 0xFFFF;
}
else
else
{
// Prevent backlight blink on lowest level
PORTB &= ~(_BV(PORTB7));
// Turn on PWM control of PB7
TCCR1A |= _BV(COM1C1);
// Set the brightness
CHANNEL = 0xFFFF >> ((BACKLIGHT_LEVELS - level) * ((BACKLIGHT_LEVELS + 1) / 2));
}
breathing_intensity_default();
}
void breathing_enable(void)
{
if (get_backlight_level() == 0)
{
breathing_index = 0;
}
else
{
// Set breathing_index to be at the midpoint (brightest point)
breathing_index = 0x20 << breath_speed;
}
breathing_halt = BREATHING_NO_HALT;
// Enable breathing interrupt
TIMSK1 |= _BV(OCIE1A);
}
void breathing_pulse(void)
{
if (get_backlight_level() == 0)
{
breathing_index = 0;
}
else
{
// Set breathing_index to be at the midpoint + 1 (brightest point)
breathing_index = 0x21 << breath_speed;
}
breathing_halt = BREATHING_HALT_ON;
// Enable breathing interrupt
TIMSK1 |= _BV(OCIE1A);
}
void breathing_disable(void)
{
// Disable breathing interrupt
TIMSK1 &= ~_BV(OCIE1A);
backlight_set(get_backlight_level());
}
void breathing_self_disable(void)
{
if (get_backlight_level() == 0)
{
breathing_halt = BREATHING_HALT_OFF;
}
else
{
breathing_halt = BREATHING_HALT_ON;
}
//backlight_set(get_backlight_level());
}
void breathing_toggle(void)
{
if (!is_breathing())
{
if (get_backlight_level() == 0)
{
breathing_index = 0;
}
else
{
// Set breathing_index to be at the midpoint + 1 (brightest point)
breathing_index = 0x21 << breath_speed;
}
breathing_halt = BREATHING_NO_HALT;
}
// Toggle breathing interrupt
TIMSK1 ^= _BV(OCIE1A);
// Restore backlight level
if (!is_breathing())
{
backlight_set(get_backlight_level());
}
}
bool is_breathing(void)
{
return (TIMSK1 && _BV(OCIE1A));
}
void breathing_intensity_default(void)
{
//breath_intensity = (uint8_t)((uint16_t)100 * (uint16_t)get_backlight_level() / (uint16_t)BACKLIGHT_LEVELS);
breath_intensity = ((BACKLIGHT_LEVELS - get_backlight_level()) * ((BACKLIGHT_LEVELS + 1) / 2));
}
void breathing_intensity_set(uint8_t value)
{
breath_intensity = value;
}
void breathing_speed_default(void)
{
breath_speed = 4;
}
void breathing_speed_set(uint8_t value)
{
bool is_breathing_now = is_breathing();
uint8_t old_breath_speed = breath_speed;
if (is_breathing_now)
{
// Disable breathing interrupt
TIMSK1 &= ~_BV(OCIE1A);
}
breath_speed = value;
if (is_breathing_now)
{
// Adjust index to account for new speed
breathing_index = (( (uint8_t)( (breathing_index) >> old_breath_speed ) ) & 0x3F) << breath_speed;
// Enable breathing interrupt
TIMSK1 |= _BV(OCIE1A);
}
}
void breathing_speed_inc(uint8_t value)
{
if ((uint16_t)(breath_speed - value) > 10 )
{
breathing_speed_set(0);
}
else
{
breathing_speed_set(breath_speed - value);
}
}
void breathing_speed_dec(uint8_t value)
{
if ((uint16_t)(breath_speed + value) > 10 )
{
breathing_speed_set(10);
}
else
{
breathing_speed_set(breath_speed + value);
}
}
void breathing_defaults(void)
{
breathing_intensity_default();
breathing_speed_default();
breathing_halt = BREATHING_NO_HALT;
}
/* Breathing Sleep LED brighness(PWM On period) table
* (64[steps] * 4[duration]) / 64[PWM periods/s] = 4 second breath cycle
*
* http://www.wolframalpha.com/input/?i=%28sin%28+x%2F64*pi%29**8+*+255%2C+x%3D0+to+63
* (0..63).each {|x| p ((sin(x/64.0*PI)**8)*255).to_i }
*/
static const uint8_t breathing_table[64] PROGMEM = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 6, 10,
15, 23, 32, 44, 58, 74, 93, 113, 135, 157, 179, 199, 218, 233, 245, 252,
255, 252, 245, 233, 218, 199, 179, 157, 135, 113, 93, 74, 58, 44, 32, 23,
15, 10, 6, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
ISR(TIMER1_COMPA_vect)
{
// CHANNEL = (pgm_read_byte(&breathing_table[ ( (uint8_t)( (breathing_index++) >> breath_speed ) ) & 0x3F ] )) * breath_intensity;
uint8_t local_index = ( (uint8_t)( (breathing_index++) >> breath_speed ) ) & 0x3F;
if (((breathing_halt == BREATHING_HALT_ON) && (local_index == 0x20)) || ((breathing_halt == BREATHING_HALT_OFF) && (local_index == 0x3F)))
{
// Disable breathing interrupt
TIMSK1 &= ~_BV(OCIE1A);
}
CHANNEL = (uint16_t)(((uint16_t)pgm_read_byte(&breathing_table[local_index]) * 257)) >> breath_intensity;
}
#endif

View File

@ -33,4 +33,20 @@ void process_action_user(keyrecord_t *record);
void led_set_user(uint8_t usb_led);
void backlight_init_ports(void);
void breathing_enable(void);
void breathing_pulse(void);
void breathing_disable(void);
void breathing_self_disable(void);
void breathing_toggle(void);
bool is_breathing(void);
void breathing_defaults(void);
void breathing_intensity_default(void);
void breathing_speed_default(void);
void breathing_speed_set(uint8_t value);
void breathing_speed_inc(uint8_t value);
void breathing_speed_dec(uint8_t value);
#endif

View File

@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define PRODUCT_ID 0x0419
#define DEVICE_VER 0x0001
#define MANUFACTURER Ortholinear Keyboards
#define PRODUCT The Atomic Keyboard
@ -162,5 +162,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define VIBRATO_ENABLE
//#define VIBRATO_STRENGTH_ENABLE
#endif

View File

@ -8,41 +8,44 @@
#include "song_list.h"
#endif
#define LAYER_QWERTY 0
#define LAYER_COLEMAK 1
#define LAYER_DVORAK 2
#define LAYER_RAISE 3
#define LAYER_LOWER 4
#define LAYER_FUNCTION 5
#define LAYER_MOUSE 6
#define LAYER_MUSIC 7
#define LAYER_ADJUST 8
#define LAYER_QWERTY 0
#define LAYER_COLEMAK 1
#define LAYER_DVORAK 2
#define LAYER_UPPER 3
#define LAYER_LOWER 4
#define LAYER_FUNCTION 5
#define LAYER_MOUSE 6
#define LAYER_MUSIC 7
#define LAYER_ADJUST 8
#define MACRO_QWERTY 0
#define MACRO_COLEMAK 1
#define MACRO_DVORAK 2
#define MACRO_RAISE 3
#define MACRO_LOWER 4
#define MACRO_FUNCTION 5
#define MACRO_MOUSE 6
#define MACRO_TIMBRE_1 7
#define MACRO_TIMBRE_2 8
#define MACRO_TIMBRE_3 9
#define MACRO_TIMBRE_4 10
#define MACRO_TEMPO_U 11
#define MACRO_TEMPO_D 12
#define MACRO_TONE_DEFAULT 13
#define MACRO_MUSIC_ON 14
#define MACRO_MUSIC_OFF 15
#define MACRO_AUDIO_ON 16
#define MACRO_AUDIO_OFF 17
#define MACRO_INC_VOICE 18
#define MACRO_DEC_VOICE 19
#define MACRO_QWERTY 0
#define MACRO_COLEMAK 1
#define MACRO_DVORAK 2
#define MACRO_UPPER 3
#define MACRO_LOWER 4
#define MACRO_FUNCTION 5
#define MACRO_MOUSE 6
#define MACRO_TIMBRE_1 7
#define MACRO_TIMBRE_2 8
#define MACRO_TIMBRE_3 9
#define MACRO_TIMBRE_4 10
#define MACRO_TEMPO_U 11
#define MACRO_TEMPO_D 12
#define MACRO_TONE_DEFAULT 13
#define MACRO_MUSIC_TOGGLE 14
#define MACRO_AUDIO_TOGGLE 16
#define MACRO_INC_VOICE 18
#define MACRO_DEC_VOICE 19
#define MACRO_BACKLIGHT 20
#define MACRO_BREATH_TOGGLE 21
#define MACRO_BREATH_SPEED_INC 23
#define MACRO_BREATH_SPEED_DEC 24
#define MACRO_BREATH_DEFAULT 25
#define M_QWRTY M(MACRO_QWERTY)
#define M_COLMK M(MACRO_COLEMAK)
#define M_DVORK M(MACRO_DVORAK)
#define M_RAISE M(MACRO_RAISE)
#define M_UPPER M(MACRO_UPPER)
#define M_LOWER M(MACRO_LOWER)
#define M_FUNCT M(MACRO_FUNCTION)
#define M_MOUSE M(MACRO_MOUSE)
@ -53,12 +56,15 @@
#define TMPO_UP M(MACRO_TEMPO_U)
#define TMPO_DN M(MACRO_TEMPO_D)
#define TMPO_DF M(MACRO_TONE_DEFAULT)
#define M_BACKL M(MACRO_BACKLIGHT)
#define M_BRTOG M(MACRO_BREATH_TOGGLE)
#define M_BSPDU M(MACRO_BREATH_SPEED_INC)
#define M_BSPDD M(MACRO_BREATH_SPEED_DEC)
#define M_BDFLT M(MACRO_BREATH_DEFAULT)
#define MUS_ON M(MACRO_MUSIC_ON)
#define MUS_OFF M(MACRO_MUSIC_OFF)
#define AUD_OFF M(MACRO_AUDIO_OFF)
#define AUD_ON M(MACRO_AUDIO_ON)
#define MUS_TOG M(MACRO_MUSIC_TOGGLE)
#define AUD_TOG M(MACRO_AUDIO_TOGGLE)
#define VC_UP M(MACRO_INC_VOICE)
#define VC_DOWN M(MACRO_DEC_VOICE)
@ -74,6 +80,7 @@
#define SC_ACLS LALT(KC_F4)
#define SC_CCLS LCTL(KC_F4)
#define OS_SHFT KC_FN0
#define _______ KC_TRNS
#define XXXXXXX KC_NO
@ -92,16 +99,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------|
* | LSHIFT | Z | X | C | V | B | N | M | , | . | / | XXXXXX . RSHIFT | UP | PG DN |
* |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------|
* | LCTRL | LWIN | FN | LALT | RAISE | XXXXXX . SPACE | LOWER | RALT | RWIN | MENU | RCTRL | LEFT | DOWN | RIGHT |
* | LCTRL | LWIN | FN | LALT | UPPER | XXXXXX . SPACE | LOWER | SHIFT | RALT | APP | RCTRL | LEFT | DOWN | RIGHT |
* '--------------------------------------------------------------------------------------------------------------------------------------'
*/
[LAYER_QWERTY] = { /* QWERTY */
[LAYER_QWERTY] = { // QWERTY
{ KC_ESC, 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_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_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_ENT, KC_PGUP },
{ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_UP, KC_PGDN },
{ KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_RAISE, KC_SPC, KC_SPC, M_LOWER, KC_RALT, KC_RGUI, KC_MENU, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT },
{ KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_UPPER, KC_SPC, KC_SPC, M_LOWER, OS_SHFT, KC_RALT, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT },
},
/* COLEMAK
@ -114,17 +121,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------|
* | LSHIFT | Z | X | C | V | B | K | M | , | . | / | XXXXXX . RSHIFT | UP | PG DN |
* |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------|
* | LCTRL | LWIN | FN | LALT | RAISE | XXXXXX . SPACE | LOWER | RALT | RWIN | MENU | RCTRL | LEFT | DOWN | RIGHT |
* | LCTRL | LWIN | FN | LALT | UPPER | XXXXXX . SPACE | LOWER | SHIFT | RALT | APP | RCTRL | LEFT | DOWN | RIGHT |
* '--------------------------------------------------------------------------------------------------------------------------------------'
*/
[LAYER_COLEMAK] = { /* COLEMAK */
[LAYER_COLEMAK] = { // COLEMAK
{ KC_ESC, 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_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL },
{ KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, KC_ENT, KC_PGUP },
{ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_UP, KC_PGDN },
{ KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_RAISE, KC_SPC, KC_SPC, M_LOWER, KC_RALT, KC_RGUI, KC_MENU, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT },
},
{ KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_UPPER, KC_SPC, KC_SPC, M_LOWER, OS_SHFT, KC_RALT, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT },
},
/* DVORAK
* .---------------------------------------------------------------------------------------------------------------------- 2u ------------.
@ -136,35 +143,63 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------|
* | LSHIFT | ; | Q | J | K | X | B | M | W | V | Z | XXXXXX . RSHIFT | UP | PG DN |
* |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------|
* | LCTRL | LWIN | FN | LALT | RAISE | XXXXXX . SPACE | LOWER | RALT | RWIN | MENU | RCTRL | LEFT | DOWN | RIGHT |
* | LCTRL | LWIN | FN | LALT | UPPER | XXXXXX . SPACE | LOWER | SHIFT | RALT | APP | RCTRL | LEFT | DOWN | RIGHT |
* '--------------------------------------------------------------------------------------------------------------------------------------'
*/
[LAYER_DVORAK] = { /* DVORAK */
[LAYER_DVORAK] = { // DVORAK
{ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_BSPC, KC_BSPC },
{ KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSLS, KC_DEL },
{ KC_CAPS, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_ENT, KC_ENT, KC_PGUP },
{ KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_RSFT, KC_UP, KC_PGDN },
{ KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_RAISE, KC_SPC, KC_SPC, M_LOWER, KC_RALT, KC_RGUI, KC_MENU, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT },
{ KC_LCTL, KC_LGUI, M_FUNCT, KC_LALT, M_UPPER, KC_SPC, KC_SPC, M_LOWER, OS_SHFT, KC_RALT, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT },
},
[LAYER_RAISE] = { /* RAISED */
{ KC_TILD, KC_PSCR, KC_PAUS, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ________________ },
{ _______, KC_F1, KC_F2, KC_F3, KC_F4, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS },
{ _______, KC_F5, KC_F6, KC_F7, KC_F8, _______, _______, _______, _______, _______, _______, _______, ________________, KC_HOME },
{ _______, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______, _______, ________________, _______, KC_END },
/* UPPER
* .---------------------------------------------------------------------------------------------------------------------- 2u ------------.
* | PRINT | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | XXXXXX | NUM LK | / | * | - | NUM LK | SCR LK | XXXXXX . PAUSE |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
* | | F1 | F2 | F3 | F4 | | | 7 | 8 | 9 | + | ~ | | | INS |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------|
* | CAP LK | F5 | F6 | F7 | F8 | | | 4 | 5 | 6 | + | ` | XXXXXX . | HOME |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------|
* | | F9 | F10 | F11 | F12 | | | 1 | 2 | 3 | ENTER | XXXXXX . | | END |
* |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------|
* | | | | | | 0 | | RALT | . | ENTER | | | | |
* '--------------------------------------------------------------------------------------------------------------------------------------'
*/
[LAYER_UPPER] = { // UPPER
{ KC_PSCR, M_BRTOG, M_BSPDU, M_BSPDD, M_BDFLT, XXXXXXX, XXXXXXX, KC_NLCK, KC_PSLS, KC_PAST, XXXXXXX, XXXXXXX, KC_SLCK, KC_PAUS, KC_PAUS },
{ _______, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, XXXXXXX, KC_KP_7, KC_KP_8, KC_KP_9, KC_PMNS, _______, _______, _______, KC_INS },
{ KC_CAPS, KC_F5, KC_F6, KC_F7, KC_F8, XXXXXXX, XXXXXXX, KC_KP_4, KC_KP_5, KC_KP_6, KC_PPLS, _______, ________________, KC_HOME },
{ _______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, KC_KP_1, KC_KP_2, KC_KP_3, KC_PENT, ________________, _______, KC_END },
{ _______, _______, _______, _______, _______, KC_KP_0, KC_KP_0, _______, KC_RALT, KC_PDOT, KC_PENT, _______, _______, _______, _______ },
},
/* LOWER
* .---------------------------------------------------------------------------------------------------------------------- 2u ------------.
* | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | XXXXXX . BACKSP |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
* | | $ | { | [ | ( | % | # | ) | ] | } | @ | | | | INS |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------|
* | | ^ | * | + | - | ; | : | _ | ' | " | ` | | XXXXXX . | HOME |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------|
* | | | | & | ! | ~ | / | \ | = | < | > | ? | XXXXXX . | | END |
* |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------|
* | | | | | | | | | | | | | | |
* '--------------------------------------------------------------------------------------------------------------------------------------'
*/
[LAYER_LOWER] = { // LOWER
{ _______, 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_DLR, KC_LCBR, KC_LBRC, KC_LPRN, KC_PERC, KC_HASH, KC_RPRN, KC_RBRC, KC_RCBR, KC_AT, _______, _______, _______, KC_INS },
{ _______, KC_CIRC, KC_ASTR, KC_PPLS, KC_PMNS, KC_SCLN, KC_COLN, KC_UNDS, KC_QUOT, KC_DQT, KC_GRV, _______, ________________, KC_HOME },
{ _______, KC_PIPE, KC_AMPR, KC_EXLM, KC_TILD, KC_SLSH, KC_BSLS, KC_EQL, KC_LT, KC_GT, KC_QUES, ________________, _______, KC_END },
{ _______, _______, _______, _______, _______, ________________, _______, _______, _______, _______, _______, _______, _______, _______ },
},
[LAYER_LOWER] = { /* LOWERED */
{ 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_F13, KC_F14, KC_F15, KC_F16, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS },
{ _______, KC_F17, KC_F18, KC_F19, KC_F20, _______, _______, _______, _______, _______, _______, _______, ________________, KC_HOME },
{ _______, KC_F21, KC_F22, KC_F23, KC_F24, _______, _______, _______, _______, _______, _______, ________________, _______, KC_END },
{ _______, _______, _______, _______, _______, KC_BSPC, KC_BSPC, _______, _______, _______, _______, _______, _______, _______, _______ },
},
[LAYER_FUNCTION] = { /* FUNCTION */
[LAYER_FUNCTION] = { // FUNCTION
{ KC_NLCK, 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_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, _______, KC_PAUS },
{ KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________, KC_PSCR },
@ -174,7 +209,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef MOUSEKEY_ENABLE
[LAYER_MOUSE] = { /* MOUSE */
[LAYER_MOUSE] = { // MOUSE
{ _______, KC_ACL0, KC_ACL1, KC_ACL2, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXXXXXXXXXXX },
{ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX },
{ XXXXXXX, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXXXXXXXXXXX, KC_WH_U },
@ -184,25 +219,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#endif
[LAYER_MUSIC] = { /* MUSIC */
[LAYER_MUSIC] = { // MUSIC
{ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX },
{ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX },
{ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX },
{ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX },
{ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, M_RAISE, XXXXXXX, XXXXXXX, M_LOWER, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX },
{ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, M_UPPER, XXXXXXX, XXXXXXX, M_LOWER, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX },
},
[LAYER_ADJUST] = { /* ADJUST */
{ _______, TIMBR_1, TIMBR_2, TIMBR_3, TIMBR_4, TMPO_UP, TMPO_DN, TMPO_DF, _______, MUS_ON, MUS_OFF, AUD_ON, AUD_OFF, ________________ },
[LAYER_ADJUST] = { // ADJUST
{ _______, TIMBR_1, TIMBR_2, TIMBR_3, TIMBR_4, TMPO_UP, TMPO_DN, TMPO_DF, _______, _______, _______, MUS_TOG, AUD_TOG, ________________ },
{ _______, M_QWRTY, M_COLMK, M_DVORK, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________, _______ },
{ _______, _______, _______, _______, _______, RESET, _______, M_MOUSE, _______, _______, _______, ________________, VC_UP, _______ },
{ _______, _______, _______, _______, M_BACKL, RESET, _______, M_MOUSE, _______, _______, _______, ________________, VC_UP, _______ },
{ _______, _______, _______, _______, _______, ________________, _______, _______, _______, _______, _______, _______, VC_DOWN, _______ },
},
/*
[LAYER_EMPTY] = {
[LAYER_EMPTY] = { // LAYER
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ________________, _______ },
@ -241,6 +276,7 @@ void persistant_default_layer_set(uint16_t default_layer)
}
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_MODS_ONESHOT(MOD_LSFT),
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
@ -250,13 +286,41 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
switch(id)
{
case MACRO_BREATH_TOGGLE:
if (record->event.pressed)
{
breathing_toggle();
}
break;
case MACRO_BREATH_SPEED_INC:
if (record->event.pressed)
{
breathing_speed_inc(1);
}
break;
case MACRO_BREATH_SPEED_DEC:
if (record->event.pressed)
{
breathing_speed_dec(1);
}
break;
case MACRO_BREATH_DEFAULT:
if (record->event.pressed)
{
breathing_defaults();
}
break;
case MACRO_QWERTY:
if (record->event.pressed)
{
persistant_default_layer_set(1UL<<LAYER_QWERTY);
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, STACCATO);
#endif /* AUDIO_ENABLE */
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, STACCATO);
#endif /* AUDIO_ENABLE */
}
break;
@ -264,9 +328,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
if (record->event.pressed)
{
persistant_default_layer_set(1UL<<LAYER_COLEMAK);
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, STACCATO);
#endif /* AUDIO_ENABLE */
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, STACCATO);
#endif /* AUDIO_ENABLE */
}
break;
@ -274,22 +338,24 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
if (record->event.pressed)
{
persistant_default_layer_set(1UL<<LAYER_DVORAK);
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, STACCATO);
#endif /* AUDIO_ENABLE */
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, STACCATO);
#endif /* AUDIO_ENABLE */
}
break;
case MACRO_RAISE:
case MACRO_UPPER:
if (record->event.pressed)
{
layer_on(LAYER_RAISE);
update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST);
layer_on(LAYER_UPPER);
breathing_speed_set(2);
breathing_pulse();
update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
}
else
{
layer_off(LAYER_RAISE);
update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST);
layer_off(LAYER_UPPER);
update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
}
break;
@ -297,22 +363,28 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
if (record->event.pressed)
{
layer_on(LAYER_LOWER);
update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST);
breathing_speed_set(2);
breathing_pulse();
update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
}
else
{
layer_off(LAYER_LOWER);
update_tri_layer(LAYER_LOWER, LAYER_RAISE, LAYER_ADJUST);
update_tri_layer(LAYER_LOWER, LAYER_UPPER, LAYER_ADJUST);
}
break;
case MACRO_FUNCTION:
if (record->event.pressed)
{
breathing_speed_set(3);
breathing_enable();
layer_on(LAYER_FUNCTION);
}
else
{
breathing_speed_set(1);
breathing_self_disable();
layer_off(LAYER_FUNCTION);
}
break;
@ -362,42 +434,34 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
}
break;
case MACRO_AUDIO_OFF:
case MACRO_AUDIO_TOGGLE:
if (record->event.pressed)
{
#ifdef AUDIO_ENABLE
audio_off();
#endif
if (is_audio_on())
{
audio_off();
}
else
{
audio_on();
PLAY_NOTE_ARRAY(tone_audio_on, false, STACCATO);
}
}
break;
case MACRO_AUDIO_ON:
case MACRO_MUSIC_TOGGLE:
if (record->event.pressed)
{
#ifdef AUDIO_ENABLE
audio_on();
PLAY_NOTE_ARRAY(tone_audio_on, false, STACCATO);
#endif
}
break;
case MACRO_MUSIC_ON:
if (record->event.pressed)
{
#ifdef AUDIO_ENABLE
if (IS_LAYER_ON(LAYER_MUSIC))
{
layer_off(LAYER_MUSIC);
stop_all_notes();
}
else
{
PLAY_NOTE_ARRAY(tone_music_on, false, STACCATO);
layer_on(LAYER_MUSIC);
#endif
}
break;
case MACRO_MUSIC_OFF:
if (record->event.pressed)
{
#ifdef AUDIO_ENABLE
layer_off(LAYER_MUSIC);
stop_all_notes();
#endif
}
}
break;
@ -423,6 +487,14 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
#endif /* AUDIO_ENABLE */
#ifdef BACKLIGHT_ENABLE
case MACRO_BACKLIGHT:
if (record->event.pressed)
{
backlight_step();
}
#endif
default:
break;
@ -467,39 +539,39 @@ void led_set_user(uint8_t usb_led)
_delay_ms(10); // gets rid of tick
if (!is_playing_notes())
{
if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK)))
{
// If CAPS LK LED is turning on...
PLAY_NOTE_ARRAY(tone_caps_on, false, LEGATO);
}
else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK)))
{
// If CAPS LK LED is turning off...
PLAY_NOTE_ARRAY(tone_caps_off, false, LEGATO);
}
else if ((usb_led & (1<<USB_LED_NUM_LOCK)) && !(old_usb_led & (1<<USB_LED_NUM_LOCK)))
{
// If NUM LK LED is turning on...
PLAY_NOTE_ARRAY(tone_numlk_on, false, LEGATO);
}
else if (!(usb_led & (1<<USB_LED_NUM_LOCK)) && (old_usb_led & (1<<USB_LED_NUM_LOCK)))
{
// If NUM LED is turning off...
PLAY_NOTE_ARRAY(tone_numlk_off, false, LEGATO);
}
else if ((usb_led & (1<<USB_LED_SCROLL_LOCK)) && !(old_usb_led & (1<<USB_LED_SCROLL_LOCK)))
{
// If SCROLL LK LED is turning on...
PLAY_NOTE_ARRAY(tone_scroll_on, false, LEGATO);
}
else if (!(usb_led & (1<<USB_LED_SCROLL_LOCK)) && (old_usb_led & (1<<USB_LED_SCROLL_LOCK)))
{
// If SCROLL LED is turning off...
PLAY_NOTE_ARRAY(tone_scroll_off, false, LEGATO);
}
}
if (!is_playing_notes())
{
if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK)))
{
// If CAPS LK LED is turning on...
PLAY_NOTE_ARRAY(tone_caps_on, false, LEGATO);
}
else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK)))
{
// If CAPS LK LED is turning off...
PLAY_NOTE_ARRAY(tone_caps_off, false, LEGATO);
}
else if ((usb_led & (1<<USB_LED_NUM_LOCK)) && !(old_usb_led & (1<<USB_LED_NUM_LOCK)))
{
// If NUM LK LED is turning on...
PLAY_NOTE_ARRAY(tone_numlk_on, false, LEGATO);
}
else if (!(usb_led & (1<<USB_LED_NUM_LOCK)) && (old_usb_led & (1<<USB_LED_NUM_LOCK)))
{
// If NUM LED is turning off...
PLAY_NOTE_ARRAY(tone_numlk_off, false, LEGATO);
}
else if ((usb_led & (1<<USB_LED_SCROLL_LOCK)) && !(old_usb_led & (1<<USB_LED_SCROLL_LOCK)))
{
// If SCROLL LK LED is turning on...
PLAY_NOTE_ARRAY(tone_scroll_on, false, LEGATO);
}
else if (!(usb_led & (1<<USB_LED_SCROLL_LOCK)) && (old_usb_led & (1<<USB_LED_SCROLL_LOCK)))
{
// If SCROLL LED is turning off...
PLAY_NOTE_ARRAY(tone_scroll_off, false, LEGATO);
}
}
old_usb_led = usb_led;
}
@ -514,7 +586,8 @@ void play_startup_tone()
void play_goodbye_tone()
{
PLAY_NOTE_ARRAY(tone_my_goodbye, false, STACCATO);
_delay_ms(1000);
_delay_ms(2000);
stop_all_notes();
}
#endif /* AUDIO_ENABLE */

View File

@ -4,7 +4,7 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = yes # Audio output on port C6
UNICODE_ENABLE = no # Unicode

View File

@ -36,7 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Change this to how you wired your keyboard
// COLS: Left to right, ROWS: Top to bottom
#if defined(ATREUS_ASTAR)
#define COLS (int []){ B7, D6, F7, F6, B6, D4, E6, B4, B5, C6, D7 }
#define COLS (int []){ D7, C6, B5, B4, E6, D4, B6, F6, F7, D6, B7 }
#define ROWS (int []){ D0, D1, D3, D2 }
#elif defined(ATREUS_TEENSY2)
#define COLS (int []){ F6, F5, F4, B7, B6, B5, B4, B3, B2, B1, B0}

View File

@ -101,6 +101,22 @@ NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: ht
# MIDI_ENABLE = yes # MIDI controls
# UNICODE_ENABLE = yes # Unicode
# If you want to have your own config_user.h, you can just put it in
# your keymap directory. Anything you set there will take precedence
# over the global config.h.
ifneq ("$(wildcard keymaps/$(KEYMAP)/config_user.h)","")
CONFIG_USER_H = keymaps/$(KEYMAP)/config_user.h
endif
ifdef KEYMAP
ifeq ("$(wildcard keymaps/$(KEYMAP).c)","")
ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","")
include keymaps/$(KEYMAP)/makefile.mk
endif
endif
endif
# Optimize size but this may cause error "relocation truncated to fit"
#EXTRALDFLAGS = -Wl,--relax

View File

@ -0,0 +1,8 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "config.h"
#define ONESHOT_TAP_TOGGLE 2
#define ONESHOT_TIMEOUT 3000
#endif

View File

@ -22,7 +22,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
* |LShift/(|Z/Ctrl| X | C | V | B | [ | | ] | N | M | , | . |//Ctrl|RShift/)|
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | - |
* |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | -/L1 |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | App | LGui | | Alt |Ctrl/Esc|
@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
TG(SYMB), KC_Y,KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_H,ALT_T(KC_J),KC_K, KC_L, LT(MDIA,KC_SCLN),GUI_T(KC_QUOT),
MEH_T(KC_RBRC),KC_N,KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), RSFTC,
KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_MINS,
KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, LT(SYMB,KC_MINS),
KC_LALT, CTL_T(KC_ESC),
KC_PGUP,
KC_PGDN,LT(SYMB, KC_TAB), KC_ENT
@ -59,13 +59,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | 1 | 2 | 3 | 4 | | | | | | % | = | @ | | F12 |
* | | | | | | | | | | | | | | | F12 |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | 5 | 6 | 7 | 8 | 9 |------| |------| & | _ | - | ; | + | |
* | | 1 | 2 | 3 | 4 | 5 |------| |------| & | _ | - | ; | + | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | ( | ) | [ | ] | 0 | | | | | | ( | ) | | | |
* | | 6 | 7 | 8 | 9 | 0 | | | | | | @ | = | % | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | | | | | |
* | | | |NxtTab|PrvTab| | | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
@ -79,19 +79,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[SYMB] = KEYMAP(
// left hand
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_TRNS, KC_TRNS,
KC_TRNS, KC_5, KC_6, KC_7, KC_8, KC_9,
KC_TRNS, KC_LPRN,KC_RPRN,KC_LBRC, KC_RBRC, KC_0, KC_TRNS,
KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5,
KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS,
KC_TRNS, KC_TRNS,KC_TRNS,LCTL(KC_PGUP), LCTL(KC_PGDN),
KC_TRNS,KC_TRNS,
KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,
// right hand
KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
KC_TRNS, KC_TRNS, KC_PERC,KC_EQL, KC_AT, KC_TRNS, KC_F12,
KC_AMPR, KC_UNDS,KC_MINS, CM_SCLN, KC_PLUS, KC_TRNS,
KC_TRNS, KC_PIPE, KC_LPRN,KC_RPRN, KC_3, KC_TRNS, KC_TRNS,
KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_F12,
KC_AMPR, KC_UNDS, KC_MINS, CM_SCLN, KC_PLUS, KC_TRNS,
KC_TRNS, KC_PIPE, KC_AT, KC_EQL, KC_PERC, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
@ -101,13 +101,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | MsUp | | | | | | | | | | | |
* | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play |
* | | PgUp | Home | End | PgDn | |------| |------| | | | | | Play |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | | | Prev | Next | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | |
* | | | | | | |VolUp |VolDn | Mute | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
@ -120,10 +120,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// MEDIA AND MOUSE
[MDIA] = KEYMAP(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
KC_TRNS, KC_PGUP, KC_HOME, KC_END, KC_PGDN, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS,
@ -140,7 +140,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols)
[1] = ACTION_LAYER_TAP_TOGGLE(SYMB), // FN1 - Momentary Layer 1 (Symbols)
[2] = ACTION_MACRO_TAP(0), // Eric Tang's Famous Macro!
[3] = ACTION_MACRO_TAP(1) // Eric Tang's Famous Macro!
};
static uint16_t key_timer;
@ -148,33 +150,46 @@ static uint16_t key_timer;
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch(id) {
case 0: {
if (record->event.pressed) {
key_timer = timer_read(); // if the key is being pressed, we start the timer.
register_code(KC_LSFT); // we're now holding down Shift.
} else { // this means the key was just released, so we can figure out how long it was pressed for (tap or "held down").
if (timer_elapsed(key_timer) < 70) { // the threshhold we pick for counting something as a tap.
register_code(KC_9); // sending 9 while Shift is held down gives us an opening paren
unregister_code(KC_9); // now let's let go of that key
}
unregister_code(KC_LSFT); // let's release the Shift key now.
}
break;
case 0:
if (record->event.pressed) {
register_mods(MOD_BIT(KC_LSFT));
if (record->tap.count && !record->tap.interrupted) {
register_code(KC_9);
}
else {
record->tap.count = 0;
}
}
else {
if (record->tap.count) {
unregister_code(KC_9);
}
else {
}
unregister_mods(MOD_BIT(KC_LSFT));
}
break;
case 1:
if (record->event.pressed) {
register_mods(MOD_BIT(KC_LSFT));
if (record->tap.count && !record->tap.interrupted) {
register_code(KC_0);
}
else {
record->tap.count = 0;
}
}
else {
if (record->tap.count) {
unregister_code(KC_0);
}
else {
}
unregister_mods(MOD_BIT(KC_LSFT));
}
break;
}
case 1: {
if (record->event.pressed) {
key_timer = timer_read(); // Now we're doing the same thing, only for the right shift/close paren key
register_code(KC_RSFT);
} else {
if (timer_elapsed(key_timer) < 70) {
register_code(KC_0);
unregister_code(KC_0);
}
unregister_code(KC_RSFT);
}
break;
}
}
return MACRO_NONE;
};

View File

@ -0,0 +1,5 @@
# Having a file like this allows you to override Makefile definitions
# for your own particular keymap
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

View File

@ -4,6 +4,14 @@ This is my personal layout which I use to test out ideas which may or may not ma
Changelog:
## May 8, 2016:
* Makes bottom-right key send minus/underscore when tapped, L1 temporary toggle when held
* Tweaked the positions of the numbers on the symbol layer. Basically, 12345 are now directly under their number-row counterparts in layer 0. You can imagine pulling the number row down to the home row. And 67890 are directly under 12345 - so it's a matter of just adding 5 and going to the next row (1+5 = 6, 2+5 = 7 and so on).
* Tweaks media/nav layer
* Removes mouse control, as I don't use it
* Makes left home row keys PgUp, Home, End, PgDn
## Apr 29, 2016:
* Tweaks the Hyper and Meh key to send brackets when tapped

View File

@ -4,27 +4,32 @@
#include "action_layer.h"
#include "action_util.h"
#define BASE 0 // default layer
#define SYMB 1 // symbols layer
#define MDIA 2 // media layer
#define LOCK 3 // shift-lock layer
#define BASE 0 // default layer
#define SYMB 1 // symbols layer
#define MDIA 2 // media layer
#define SPEC 3 // special layer
#define LSymb 0 // left symbol-shift key
#define LMdia 1 // left media-shift key
#define LLock 2 // left shift-lock key
#define RSymb 3 // right symbol-shift key
#define RMdia 4 // right media-shift key
#define RLock 5 // right shift-lock key
#define LCaps 10 // left caps-shift key
#define LSymb 11 // left symbol-shift key
#define LMdia 12 // left media-shift key
#define LSpec 13 // left special-shift key
#define RCaps 14 // right caps-shift key
#define RSymb 15 // right symbol-shift key
#define RMdia 16 // right media-shift key
#define RSpec 17 // right special-shift key
#define MUL 6 // mouse up left
#define MUR 7 // mouse up right
#define MDL 8 // mouse down left
#define MDR 9 // mouse down right
#define MUL 20 // mouse up left
#define MUR 21 // mouse up right
#define MDL 22 // mouse down left
#define MDR 23 // mouse down right
/*
* The Ordinary Layout for the Ergodox EZ keyboard, v3.14
* The Ordinary Layout for the Ergodox EZ keyboard, v4
*
* Modifications from default by Nicholas Keene ergodoxez@nicholaskeene.com
*
* No rights reserved. This software is in the public domain.
* Credit me if you are friendly but if you're a jerk don't bother.
*
* Details: readme.md
* https://github.com/nrrkeene/qmk_firmware/tree/master/keyboard/ergodox_ez/keymaps/ordinary
@ -34,40 +39,40 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/******* Base Layer ********************************************************************************************************
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | Lock `~ | 1 | 2 | 3 | 4 | 5 | ESC | | - | 6 | 7 | 8 | 9 | 0 | =+ Lock |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | Media Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \| Media |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | Symbol | A | S | D | F | G |------| |------| H | J | K | L | ; | '" Symbol |
* |-----------+------+------+------+------+------|Shift | | Tab |------+------+------+------+------+-----------|
* | LShift | Z | X | C | V | B | -Tab | | | N | M | , | . | / | RShift |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | LCtrl | Meh |Hyper | LAlt | LGui | | RGui | RAlt | Hyper| Meh | RCtrl |
* `-----------------------------------' `-----------------------------------'
* ,-------------. ,-------------.
* | Home | End | | Left | Right|
* ,------|------|------| |------+------+------.
* | | | PgUp | | Up | | |
* |Backsp| Del |------| |------| Enter| Space|
* | | | PgDn | | Down | | |
* `--------------------' `--------------------'
* ,------------------------------------------------------. ,------------------------------------------------------.
* | Special `~ | 1 | 2 | 3 | 4 | 5 | ESC | | - | 6 | 7 | 8 | 9 | 0 | =+ Special |
* |------------+------+------+------+------+-------------| |------+------+------+------+------+------+------------|
* | Media Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \| Media |
* |------------+------+------+------+------+------| | | |------+------+------+------+------+------------|
* | Symbol | A | S | D | F | G |------| |------| H | J | K | L | ; | '" Symbol |
* |------------+------+------+------+------+------|Shift | | Tab |------+------+------+------+------+------------|
* | Capitals | Z | X | C | V | B | -Tab | | | N | M | , | . | / | Capitals |
* `------------+------+------+------+------+-------------' `-------------+------+------+------+------+------------'
* | LCtrl | Meh |Hyper | LAlt | LGui | | RGui | RAlt | Hyper| Meh | RCtrl |
* `-----------------------------------' `-----------------------------------'
* ,-------------. ,-------------.
* | Home | End | | Left | Right|
* ,------|------|------| |------+------+------.
* | | | PgUp | | Up | | |
* |Backsp| Del |------| |------| Enter| Space|
* | | | PgDn | | Down | | |
* `--------------------' `--------------------'
*/
[BASE] = KEYMAP(
// left hand
F(LLock) ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_ESC
F(LSpec),KC_1,KC_2,KC_3 ,KC_4 ,KC_5 ,KC_ESC
,F(LMdia) ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC
,M(LSymb) ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G
,KC_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,LSFT(KC_TAB)
,M(LCaps) ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,LSFT(KC_TAB)
,KC_LCTL ,KC_MEH ,KC_HYPR,KC_LALT,KC_LGUI
,KC_HOME,KC_END
,KC_PGUP
,KC_BSPC,KC_DEL ,KC_PGDN
// right hand
,KC_MINS ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,F(RLock)
,KC_MINS ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,F(RSpec)
,KC_RBRC ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,F(RMdia)
,KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN ,F(RSymb)
,KC_TAB ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,KC_RSFT
,KC_TAB ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,M(RCaps)
,KC_RGUI,KC_RALT,KC_HYPR ,KC_MEH ,KC_RCTL
,KC_LEFT ,KC_RGHT
,KC_UP
@ -158,7 +163,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
,KC_VOLD ,KC_MSTP ,KC_MPLY
),
/******* Lock Layer ********************************************************************************************************
/******* Special Layer *****************************************************************************************************
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | | Esc | | | | | | | | | | | | Bspc | |
@ -167,7 +172,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | | | | | |------| |------| | | | | | |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | Caps LOCK | | | | | | | | | | | | | | Caps LOCK |
* | | | | | | | | | | | | | | | RShift |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | | | | | | | | | | | |
* `----------------------------------' `----------------------------------'
@ -179,12 +184,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | | | | | |
* `--------------------' `--------------------'
*/
[LOCK] = KEYMAP(
[SPEC] = KEYMAP(
// left hand
KC_TRNS ,KC_ESC ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_CAPS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS
@ -194,7 +199,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_BSPC ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_CAPS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_RSFT
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS
@ -204,91 +209,118 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
const uint16_t PROGMEM fn_actions[] = {
// the six faux shift keys are implemented as macro taps
[LSymb] = ACTION_MACRO_TAP(LSymb)
// the faux shift keys are implemented as macro taps
[LCaps] = ACTION_MACRO_TAP(LCaps)
,[LSymb] = ACTION_MACRO_TAP(LSymb)
,[LMdia] = ACTION_MACRO_TAP(LMdia)
,[LLock] = ACTION_MACRO_TAP(LLock)
,[LSpec] = ACTION_MACRO_TAP(LSpec)
,[RCaps] = ACTION_MACRO_TAP(RCaps)
,[RSymb] = ACTION_MACRO_TAP(RSymb)
,[RMdia] = ACTION_MACRO_TAP(RMdia)
,[RLock] = ACTION_MACRO_TAP(RLock)
,[RSpec] = ACTION_MACRO_TAP(RSpec)
};
uint16_t symb_shift = 0; // there are two shift keys for each layer, and two lock
uint16_t mdia_shift = 0; // keys; we increment a counter for each key pressed and
uint16_t shift_lock = 0; // decrement when released.
uint16_t caps_shift = 0;
uint16_t symb_shift = 0;
uint16_t mdia_shift = 0;
bool symb_lock = false; // when shift-lock is used in conjunction with a shift
bool mdia_lock = false; // key the lock flag is toggled
bool symb_lock = false;
bool mdia_lock = false;
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch(id) {
// shift and lock between layers
// There are two shift keys for each layer so we increment a layer_shift var when one
// is pressed and decrement when one is released. If both are pressed at the same time
// then the layer is locked (or unlocked). The shift counts are bound between 0 and 2
// only because sometimes rapid pressing led to irregular events; this way the states
// are self healing during use.
case LCaps: // both caps-shift keys trigger Left Shift
case RCaps: // so they don't interfere with the magic combo
if (record->event.pressed && !record->tap.count) {
if(++caps_shift > 2) caps_shift = 2;
if(caps_shift == 2) {
register_code(KC_CAPS);
unregister_code(KC_CAPS);
} else if(caps_shift == 1) {
register_code(KC_LSFT);
}
} else {
if(--caps_shift < 0) caps_shift = 0;
if(caps_shift == 0) unregister_code(KC_LSFT);
}
break;
case LSymb:
if (record->event.pressed) {
symb_shift++;
if(shift_lock) symb_lock = !symb_lock;
layer_on(SYMB);
if(++symb_shift > 2) symb_shift = 2;
if(symb_shift == 2) {
symb_lock = !symb_lock;
} else if(symb_shift == 1) {
layer_on(SYMB);
}
} else {
symb_shift--;
if((!symb_shift) && (!symb_lock)) layer_off(SYMB);
if(--symb_shift < 0) symb_shift = 0;
if((symb_shift == 0) && (!symb_lock)) layer_off(SYMB);
}
break;
case LMdia:
if (record->event.pressed) {
if (record->tap.count && !shift_lock) {
if (record->tap.count && (!mdia_shift) && (!mdia_lock)) {
register_code(KC_TAB);
} else {
mdia_shift++;
if(shift_lock) mdia_lock = !mdia_lock;
layer_on(MDIA);
if(++mdia_shift > 2) mdia_shift = 2;
if(mdia_shift == 2) {
mdia_lock = !mdia_lock;
} else if(mdia_shift == 1) {
layer_on(MDIA);
}
}
} else {
if(record->tap.count && !shift_lock) {
if(record->tap.count && (!mdia_shift) && (!mdia_lock)) {
unregister_code(KC_TAB);
} else {
mdia_shift--;
if(--mdia_shift < 0) mdia_shift = 0;
if((!mdia_shift) && (!mdia_lock)) layer_off(MDIA);
}
}
break;
case LLock:
case LSpec:
if (record->event.pressed) {
shift_lock++;
if(symb_shift) symb_lock = !symb_lock;
if(mdia_shift) mdia_lock = !mdia_lock;
if(!record->tap.count && (keyboard_report->mods & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)))) {
register_code(KC_CAPS);
unregister_code(KC_CAPS);
}
layer_on(LOCK);
} else {
if(record->tap.count && !record->tap.interrupted && !symb_shift && !mdia_shift) {
if (record->tap.count && !record->tap.interrupted) {
register_code(KC_GRV);
unregister_code(KC_GRV);
} else {
layer_on(SPEC);
}
} else {
if(record->tap.count && !record->tap.interrupted) {
unregister_code(KC_GRV);
} else {
layer_off(SPEC);
}
shift_lock--;
if(!shift_lock) layer_off(LOCK);
}
break;
case RSymb:
if (record->event.pressed) {
if (record->tap.count && !shift_lock) {
if (record->tap.count && (!symb_shift) && (!symb_lock)) {
register_code(KC_QUOT);
} else {
symb_shift++;
if(shift_lock) symb_lock = !symb_lock;
layer_on(SYMB);
if(++symb_shift > 2) symb_shift = 2;
if(symb_shift == 2) {
symb_lock = !symb_lock;
} else if(symb_shift == 1) {
layer_on(SYMB);
}
}
} else {
if(record->tap.count && !shift_lock) {
if(record->tap.count && symb_shift == 0) {
unregister_code(KC_QUOT);
} else {
symb_shift--;
if(--symb_shift < 0) symb_shift = 0;
if((!symb_shift) && (!symb_lock)) layer_off(SYMB);
}
}
@ -296,40 +328,39 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
case RMdia:
if (record->event.pressed) {
if (record->tap.count && !shift_lock) {
if (record->tap.count && (!mdia_shift) && (!mdia_lock)) {
register_code(KC_BSLS);
} else {
mdia_shift++;
if(shift_lock) mdia_lock = !mdia_lock;
layer_on(MDIA);
if(++mdia_shift > 2) mdia_shift = 2;
if(mdia_shift == 2) {
mdia_lock = !mdia_lock;
} else if(mdia_shift == 1) {
layer_on(MDIA);
}
}
} else {
if(record->tap.count && !shift_lock) {
if(record->tap.count && (!mdia_shift) && (!mdia_lock)) {
unregister_code(KC_BSLS);
} else {
mdia_shift--;
if(--mdia_shift < 0) mdia_shift = 0;
if((!mdia_shift) && (!mdia_lock)) layer_off(MDIA);
}
}
break;
case RLock:
case RSpec:
if (record->event.pressed) {
shift_lock++;
if(symb_shift) symb_lock = !symb_lock;
if(mdia_shift) mdia_lock = !mdia_lock;
if(!record->tap.count && (keyboard_report->mods & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)))) {
register_code(KC_CAPS);
unregister_code(KC_CAPS);
}
layer_on(LOCK);
} else {
if (record->tap.count && !record->tap.interrupted && !symb_shift && !mdia_shift) {
if (record->tap.count && !record->tap.interrupted) {
register_code(KC_EQL);
unregister_code(KC_EQL);
} else {
layer_on(SPEC);
}
} else {
if(record->tap.count && !record->tap.interrupted) {
unregister_code(KC_EQL);
} else {
layer_off(SPEC);
}
shift_lock--;
if(!shift_lock) layer_off(LOCK);
}
break;
@ -399,7 +430,7 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
// shift or caps lock turns on red light
if((keyboard_report->mods & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT))) || (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) {
if(caps_shift || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) {
ergodox_right_led_1_on();
} else {
ergodox_right_led_1_off();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View File

@ -1,7 +1,7 @@
[{x:3.5},"#\n3",{x:10.5},"*\n8"],
[{y:-0.875,x:2.5},"@\n2",{x:1},"$\n4",{x:8.5},"&\n7",{x:1},"(\n9"],
[{y:-0.875,x:5.5},"%\n5",{c:"#ff4444"},"Esc",{x:4.5,c:"#cccccc"},"_\n\n\n\n\n\n-","^\n6"],
[{y:-0.875,c:"#2277ff",w:1.5},"Shift\n\n~\n\n\n\nLock\n`",{c:"#cccccc"},"!\n1",{x:14.5},")\n0",{c:"#2277ff",w:1.5},"+\n\nShift\n\n\n\n=\nLock"],
[{y:-0.875,c:"#2277ff",w:1.5},"Special\n\n~\n\n\n\nShift\n`",{c:"#cccccc"},"!\n1",{x:14.5},")\n0",{c:"#2277ff",w:1.5},"+\n\nSpecial\n\n\n\n=\nShift"],
[{y:-0.375,x:3.5,c:"#cccccc"},"E",{x:10.5},"I"],
[{y:-0.875,x:2.5},"W",{x:1},"R",{x:8.5},"U",{x:1},"O"],
[{y:-0.875,x:5.5},"T",{h:1.5},"{\n\n\n\n\n\n[",{x:4.5,h:1.5},"}\n\n\n\n\n\n]","Y"],
@ -14,7 +14,7 @@
[{y:-0.75,x:3.5,c:"#cccccc"},"C",{x:10.5},"<\n,"],
[{y:-0.875,x:2.5},"X",{x:1},"V",{x:8.5},"M",{x:1},">\n."],
[{y:-0.875,x:5.5},"B",{x:6.5},"N"],
[{y:-0.875,c:"#2277ff",fa:[0,1,0,1,0,0,0],w:1.5},"Capitals\nShift\n\n\n\n\nShift",{c:"#cccccc"},"Z",{x:14.5,f:3},"?\n/",{c:"#2277ff",w:1.5},"\n\nCapitals\nShift\n\n\n\nShift"],
[{y:-0.875,c:"#2277ff",w:1.5},"Capitals\n\n\n\n\n\nShift",{c:"#cccccc"},"Z",{x:14.5},"?\n/",{c:"#2277ff",w:1.5},"\n\nCapitals\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#77aaff"},"Option\n\n\nLAlt",{x:10.5},"Option\n\n\nRAlt"],
[{y:-0.875,x:2.5},"Hyper",{x:1},"Cmd\n\n\nSuper",{x:8.5},"Cmd\n\n\nSuper",{x:1},"Hyper"],
[{y:-0.75,x:0.5},"Ctrl\n\n\nLCtrl","Meh",{x:14.5},"Meh","Ctrl\n\n\nRCtrl"],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 121 KiB

View File

@ -1,7 +1,7 @@
[{x:3.5,c:"#99de2a"},"F13",{x:10.5},"F18"],
[{y:-0.875,x:2.5},"F12",{x:1},"F14",{x:8.5},"F17",{x:1},"F19"],
[{y:-0.875,x:5.5},"F15",{c:"#ff4444"},"Esc",{x:4.5,c:"#cccccc",a:7},"",{c:"#99de2a",a:4},"F16"],
[{y:-0.875,c:"#2277ff",w:1.5},"Shift\n\n\n\n\n\nLock",{c:"#99de2a"},"F11",{x:14.5},"F20",{c:"#2277ff",w:1.5},"\n\nShift\n\n\n\n\nLock"],
[{y:-0.875,x:5.5},"F15",{c:"#ff4444"},"Esc",{x:4.5,c:"#737373",a:7},"",{c:"#99de2a",a:4},"F16"],
[{y:-0.875,c:"#2277ff",w:1.5},"Special\n\n\n\n\n\nShift",{c:"#99de2a"},"F11",{x:14.5},"F20",{c:"#2277ff",w:1.5},"\n\nSpecial\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#ff8500"},"Mouse\n\n\n\n\n\nUp",{x:10.5},"Cursor\n\n\n\n\n\nUp"],
[{y:-0.875,x:2.5},"Mouse\n\n\n\n\n\nUpLeft",{x:1},"Mouse\n\n\n\n\n\nUpRgt",{x:8.5,c:"#ffb063"},"Home",{x:1},"Page\n\n\n\n\n\nUp"],
[{y:-0.875,x:5.5,c:"#e6e067"},"Vol\n\n\n\n\n\nUp",{c:"#ffb063",h:1.5},"Scroll\n\n\n\n\n\nUp",{x:4.5,h:1.5},"Scroll\n\n\n\n\n\nUp",{c:"#e6e067"},"Print\n\n\n\n\n\nScreen"],
@ -13,9 +13,9 @@
[{y:-0.625,x:6.5,c:"#ffb063",h:1.5},"Scroll\n\n\n\n\n\nDown",{x:4.5,h:1.5},"Scroll\n\n\n\n\n\nDown"],
[{y:-0.75,x:3.5,c:"#ff8500"},"Mouse\n\n\n\n\n\nDown",{x:10.5},"Cursor\n\n\n\n\n\nDown"],
[{y:-0.875,x:2.5},"Mouse\n\n\n\n\n\nDnLeft",{x:1},"Mouse\n\n\n\n\n\nDnRgt",{x:8.5,c:"#ffb063"},"End",{x:1},"Page\n\n\n\n\n\nDown"],
[{y:-0.875,x:5.5,c:"#e6e067"},"Mute",{x:6.5,c:"#cccccc",a:7},""],
[{y:-0.875,c:"#2277ff",a:4,fa:[0,1,0,0,0,0,0],w:1.5},"Capitals\nShift\n\n\n\n\nShift",{c:"#cccccc",a:7},"",{x:14.5},"",{c:"#2277ff",a:4,fa:[0,1,0,1],w:1.5},"\n\nCapitals\nShift\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#ff8500"},"Middle\n\n\n\n\n\nClick",{x:10.5,c:"#ffb063"},"Delete\n\n\nOption"],
[{y:-0.875,x:5.5,c:"#e6e067"},"Mute",{x:6.5,c:"#737373",a:7},""],
[{y:-0.875,c:"#2277ff",a:4,w:1.5},"Capitals\n\n\n\n\n\nShift",{c:"#737373",a:7},"",{x:14.5},"",{c:"#2277ff",a:4,w:1.5},"\n\nCapitals\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#ff8500"},"Middle\n\n\n\n\n\nClick",{x:10.5,c:"#ffb063",fa:[0,0,0,1]},"Delete\n\n\nOption"],
[{y:-0.875,x:2.5,c:"#ff8500"},"Left\n\n\n\n\n\nClick",{x:1},"Right\n\n\n\n\n\nClick",{x:8.5,c:"#ffb063"},"Insert\n\n\nCmd",{x:1,c:"#77aaff"},"Hyper"],
[{y:-0.75,x:0.5},"Ctrl\n\n\nLCtrl","Meh",{x:14.5},"Meh","Crtl\n\n\nRCtrl"],
[{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#ccbb00"},"Stop\n\n\nBrowser","Reload\n\n\nBrowser"],

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -0,0 +1,27 @@
[{x:3.5,a:7},"",{x:10.5},""],
[{y:-0.875,x:2.5},"",{x:1},"",{x:8.5},"",{x:1},""],
[{y:-0.875,x:5.5},"",{c:"#ff4444",a:4},"Esc",{x:4.5,c:"#cccccc",a:7},"",""],
[{y:-0.875,c:"#000000",t:"#ff0000",a:4,w:1.5},"Special\n\n\n\n\n\nShift",{c:"#ff4444",t:"#000000"},"Esc",{x:14.5,c:"#54d6de"},"Back\n\n\n\n\n\nspace",{c:"#000000",t:"#ff0000",w:1.5},"\n\nSpecial\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#cccccc",t:"#000000",a:7},"",{x:10.5},""],
[{y:-0.875,x:2.5},"",{x:1},"",{x:8.5},"",{x:1},""],
[{y:-0.875,x:5.5},"",{h:1.5},"",{x:4.5,h:1.5},"",""],
[{y:-0.875,w:1.5},"","",{x:14.5},"",{w:1.5},""],
[{y:-0.375,x:3.5},"",{x:10.5},""],
[{y:-0.875,x:2.5},"",{x:1},"",{x:8.5},"",{x:1},""],
[{y:-0.875,x:5.5},"",{x:6.5},""],
[{y:-0.875,w:1.5},"","",{x:14.5},"",{w:1.5},""],
[{y:-0.625,x:6.5,h:1.5},"",{x:4.5,h:1.5},""],
[{y:-0.75,x:3.5},"",{x:10.5},""],
[{y:-0.875,x:2.5},"",{x:1},"",{x:8.5},"",{x:1},""],
[{y:-0.875,x:5.5},"",{x:6.5},""],
[{y:-0.875,w:1.5},"","",{x:14.5},"",{c:"#2277ff",w:1.5},"RShift"],
[{y:-0.375,x:3.5,c:"#cccccc"},"",{x:10.5},""],
[{y:-0.875,x:2.5},"",{x:1},"",{x:8.5},"",{x:1},""],
[{y:-0.75,x:0.5},"","",{x:14.5},"",""],
[{r:30,rx:6.5,ry:4.25,y:-1,x:1},"",""],
[{h:2},"",{h:2},"",""],
[{x:2},""],
[{r:-30,rx:13,y:-1,x:-3},"",""],
[{x:-3},"",{h:2},"",{h:2},""],
[{x:-3},""]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 101 KiB

View File

@ -1,7 +1,7 @@
[{x:3.5,c:"#99de2a"},"F3",{x:10.5},"F8"],
[{y:-0.875,x:2.5},"F2",{x:1},"F4",{x:8.5},"F7",{x:1},"F9"],
[{y:-0.875,x:5.5},"F5",{c:"#ff4444"},"Esc",{x:4.5,c:"#bbddbb"},"_\n\n\n\n\n\n-",{c:"#99de2a"},"F6"],
[{y:-0.875,c:"#2277ff",w:1.5},"Shift\n\n\n\n\n\nLock",{c:"#99de2a"},"F1",{x:14.5},"F10",{c:"#2277ff",w:1.5},"\n\nShift\n\n\n\n\nLock"],
[{y:-0.875,c:"#2277ff",w:1.5},"Special\n\n\n\n\n\nShift",{c:"#99de2a"},"F1",{x:14.5},"F10",{c:"#2277ff",w:1.5},"\n\nSpecial\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#bbddbb"},"{",{x:10.5,c:"#89b087"},"8"],
[{y:-0.875,x:2.5,c:"#bbddbb"},"@",{x:1},"}",{x:8.5,c:"#89b087"},"7",{x:1},"9"],
[{y:-0.875,x:5.5,c:"#bbddbb"},"&",{h:1.5},"<",{x:4.5,h:1.5},">","|"],
@ -14,7 +14,7 @@
[{y:-0.75,x:3.5,c:"#bbddbb"},"[",{x:10.5,c:"#89b087"},"2"],
[{y:-0.875,x:2.5,c:"#bbddbb"},"^",{x:1},"]",{x:8.5,c:"#89b087"},"1",{x:1},"3"],
[{y:-0.875,x:5.5,c:"#bbddbb"},"~",{x:6.5},"\\"],
[{y:-0.875,c:"#2277ff",f2:1,w:1.5},"Capitals\nShift\n\n\n\n\nShift",{c:"#bbddbb"},"%",{x:14.5,c:"#89b087"},"-",{c:"#2277ff",fa:[0,1,0,1],w:1.5},"\n\nCapitals\nShift\n\n\n\nShift"],
[{y:-0.875,c:"#2277ff",w:1.5},"Capitals\n\n\n\n\n\nShift",{c:"#bbddbb"},"%",{x:14.5,c:"#89b087"},"-",{c:"#2277ff",w:1.5},"\n\nCapitals\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#77aaff"},"Option\n\n\nLAlt",{x:10.5,c:"#89b087"},".\n\n\nOption"],
[{y:-0.875,x:2.5,c:"#77aaff"},"Hyper",{x:1},"Cmd\n\n\nSuper",{x:8.5,c:"#89b087"},"0\n\n\nCmd",{x:1},"=\n\n\nHyper"],
[{y:-0.75,x:0.5,c:"#77aaff"},"Ctrl\n\n\nLCtrl","Meh",{x:14.5,c:"#89b087"},"+\n\n\nMeh","Enter\n\n\nCtrl"],
@ -22,6 +22,6 @@
[{h:2},"Space",{h:2},"Enter","Up"],
[{x:2},"Down"],
[{r:-30,rx:13,y:-1,x:-3},"Home","End"],
[{x:-3},"Page\n\n\n\n\n\nUp",{f:3,h:2},"< Del\n\n\nBackspace",{f:3,h:2},"Del >\n\n\nDelete"],
[{x:-3},"Page\n\n\n\n\n\nUp",{h:2},"< Del\n\n\nBackspace",{h:2},"Del >\n\n\nDelete"],
[{x:-3},"Page\n\n\n\n\n\nDown"]

File diff suppressed because it is too large Load Diff

View File

@ -55,7 +55,7 @@ Finally, consider the turquoise text-nav keys. Here in the Symbols layer, these
* The bright green keys are more F-keys
* The dark yellow keys signal Web and Audio applications
* The light yellow keys signal the operating system
* The uncolored keys do nothing in case you bump them by accident
* The dark gray keys do nothing in case you bump them by accident
![Ordinary media layout](ordinary-media.png)
@ -67,16 +67,37 @@ Alas, the yellow keys have at best spotty success with common software. Good luc
## Switching Between Layers ##
In addition to Symbols and Media the Ordinary Layout treats the Capitals as a logical layer. Each layer is accessed by a shift key on each edge of the keyboard and corresponds to one of the three LEDs on the keyboard: Capitals (red), Symbols (green), Media (blue). The color of a layer illuminates when the layer is active.
In addition to Symbols and Media there is the Capitals layer which is exactly the same as pressing the shift key. Each layer is accessed by a shift key on each edge of the keyboard and corresponds to one of the three LEDs on the keyboard: Capitals (red), Symbols (green), Media (blue). The color of a layer illuminates when the layer is active.
Shift buttons work in the expected way: press them and all of the keys switch to that layer; release them and the keys switch back to the base layer. Lock layers using the Shift key in conjunction with the Shift Lock key. For instance, the widely and rightly loathed Caps Lock is engaged by pressing the Shift Lock button then Capitals Shift. Or, hold down the Shift key and press the Shift Lock key; it works either way. All the Shift keys work this way.
Shift buttons work in the expected way: press them and all of the keys switch to that layer; release them and the keys switch back to the base layer. If you press both of a pair of shift keys, the layer will lock on until you press both shift keys again. For instance, the widely and rightly loathed Caps Lock is engaged by pressing both Capitals Shift buttons. All the Shift keys work this way.
Multiple layers can be turned on at once but only one controls the keyboard. The order of the LEDs indicates the priority order: Media, Symbols, Capitals.
Multiple layers can be turned on at once. The Capitals layer will affect characters on other layers to capitalize. Other layers, however, don't 'mix': Symbols blankets the base layout; Media blankets Symbols.
## Special Escape & Backspace Sequences ##
## Special Sequences ##
In the Ordinary Layout, the most unsatisfying key location is the Escape key which rightly belongs segregated on its own way up on the top left of the keyboard. The Ergodox does not have a physical button in such a location and the nearest one, in the top left corner, is home to the tilde (er, grave) which is commonly found there. The Escape key is important so it features prominently on the other top corner on the left side of the keyboard, and is always there in all layers. Nevertheless, alas, it isn't Ordinary to put the escape in that different corner!
![Ordinary special layout](ordinary-special.png)
That tilde key has a second function as the Shift Lock key and that makes possible a special feature. To make this layout as Ordinary as possible, the Escape key can *also* be accessed by pressing Shift Lock then the 1 button right next to it. This easy gesture is a way to partially maintain the ease of flicking your wrist to the left and tapping Escape. This gesture works in all layers.
### Escape ###
Finally, because the special Escape sequence is so natural and useful, on the top right corner of the Ergodox EZ you can do the same gesture with the 0 key to produce a Backspace. Users of this keyboard and this layout are well advised to learn to use their thumbs for deleting text, but sometimes you are doing other computery things and just want to flick your digits up to the right and press backspace a bunch times. These special sequences should feel unremarkably mundane but might prove to be remarkably useful.
The One True Location for the Escape key is segregated way up on the top left of the keyboard. The Ergodox does not have a physical button in such a location and the nearest one is home to the tilde (er, grave) which is commonly found there. In the Ordinary layout the Escape key is found on all layers in the prominent location in the corner next to the 5, whnich is easy to remember, and yet it isn't natural for those of us with muscle memory flicking our wrists up and to the left looking for Escape.
The Ordinary layout offers as a consolation prize a Special sequence for Escape: Special Shift + 1. This is natural so you can tap the top left button, then the button next to it and get Escape. This gesture works in all layers.
### Backspace ###
At the top right corner of the Ergodox EZ you can a gesture similar to the special Escape sequence, using the 0 key, to produce a Backspace. Users of this keyboard and this layout are well advised to learn to use their thumbs for deleting text, but sometimes you are doing other computery things and just want to flick your digits up to the right and press backspace a bunch times.
### RShift ###
The Ordinary Layout locks layers by pressing both of a pair of shift keys. This interferes with the QMK firmware magic sequence, which is LShift+RShift. To work around this, both of the Capitals Shift keys produce a *Left Shift* keystroke. If for some reason a person needs *Right Shift* they can find it by pressing a Special Shift key, then the Capitals Shift key on the right side of the keyboard.
****
The Ordinary Layout for the Ergodox EZ keyboard, v4
Modifications from default by Nicholas Keene ergodoxez@nicholaskeene.com
No rights reserved. This software is in the public domain. Credit me if you are friendly but if you're a jerk don't bother.
Details: readme.md
https://github.com/nrrkeene/qmk_firmware/tree/master/keyboard/ergodox_ez/keymaps/ordinary

View File

@ -55,11 +55,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | ! | @ | { | } | | | | | | / | 7 | 8 | 9 | * | F12 |
* | | [ | ] | { | } | | | | | / | 7 | 8 | 9 | * | F12 |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | # | $ | ( | ) | ` |------| |------| - | 4 | 5 | 6 | + | |
* | | < | > | ( | ) | |------| |------| - | 4 | 5 | 6 | + | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | = | |
* | | | | | | | | | | & | 1 | 2 | 3 | = | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | 0 | . | | | |
* `----------------------------------' `----------------------------------'
@ -75,9 +75,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[SYMB] = KEYMAP(
// left hand
KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS,
KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV,
KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS,
KC_TRNS,KC_LBRC,KC_RBRC,KC_LCBR,KC_RCBR,KC_TRNS,KC_TRNS,
KC_TRNS,KC_LABK,KC_RABK,KC_LPRN,KC_RPRN,KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,
KC_TRNS,
@ -109,8 +109,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* | | |------| |------| C | V |
* | | | | | X | | |
* `--------------------' `--------------------'
*/
// MEDIA AND MOUSE
@ -129,9 +129,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LGUI(KC_LBRC), KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_MPLY,
KC_TRNS, LSFT(KC_SPC), KC_SPC , KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
LGUI(KC_X), LGUI(KC_C), LGUI(KC_V)
),
};

View File

@ -0,0 +1,2 @@
# The Default Planck Layout

View File

@ -0,0 +1,383 @@
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
// this is the style you want to emulate.
#include "planck.h"
#include "action_layer.h"
#ifdef AUDIO_ENABLE
#include "audio.h"
#endif
#include "eeconfig.h"
extern keymap_config_t keymap_config;
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
#define _QWERTY 0
#define _COLEMAK 1
#define _DVORAK 2
#define _LOWER 3
#define _RAISE 4
#define _MUSIC 5
#define _PLOVER 6
#define _ADJUST 16
// Macro name shortcuts
#define QWERTY M(_QWERTY)
#define COLEMAK M(_COLEMAK)
#define DVORAK M(_DVORAK)
#define LOWER M(_LOWER)
#define RAISE M(_RAISE)
#define M_BL 5
#define AUD_OFF M(6)
#define AUD_ON M(7)
#define MUS_OFF M(8)
#define MUS_ON M(9)
#define VC_IN M(10)
#define VC_DE M(11)
#define PLOVER M(12)
#define EXT_PLV M(13)
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | S | D | F | G | H | J | K | L | ; | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_QWERTY] = {
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
{M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
/* Colemak
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | R | S | T | D | H | N | E | I | O | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_COLEMAK] = {
{KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
{KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
{M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
/* Dvorak
* ,-----------------------------------------------------------------------------------.
* | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | O | E | U | I | D | H | T | N | S | / |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_DVORAK] = {
{KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
{KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
{KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
{M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
/* Lower
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_LOWER] = {
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
{KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
/* Raise
* ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_RAISE] = {
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
/* Music (reserved for process_action_user)
*
*/
[_MUSIC] = {
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, LOWER, XXXXXXX, XXXXXXX, RAISE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}
},
/* Plover layer (http://opensteno.org)
* ,-----------------------------------------------------------------------------------.
* | # | # | # | # | # | # | # | # | # | # | # | # |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | S | T | P | H | * | * | F | P | L | T | D |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | S | K | W | R | * | * | R | B | G | S | Z |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Exit | | | A | O | | E | U | | | |
* `-----------------------------------------------------------------------------------'
*/
[_PLOVER] = {
{KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 },
{XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC},
{XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
{EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX}
},
/* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------.
* | | Reset| | | | | | | | | | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | |Voice-|Voice+|Mus on|Musoff| | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_ADJUST] = {
{_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL},
{_______, _______, _______, AUD_ON, AUD_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______},
{_______, VC_DE, VC_IN, MUS_ON, MUS_OFF, _______, _______, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
}
};
const uint16_t PROGMEM fn_actions[] = {
};
#ifdef AUDIO_ENABLE
float tone_startup[][2] = {
{440.0*pow(2.0,(31)/12.0), 12},
{440.0*pow(2.0,(28)/12.0), 8},
{440.0*pow(2.0,(19)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8},
{440.0*pow(2.0,(28)/12.0), 20}
};
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
float tone_plover[][2] = SONG(PLOVER_SOUND);
float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
float goodbye[][2] = SONG(GOODBYE_SOUND);
#endif
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch(id) {
case _QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
#endif
persistant_default_layer_set(1UL<<_QWERTY);
}
break;
case _COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
#endif
persistant_default_layer_set(1UL<<_COLEMAK);
}
break;
case _DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
#endif
persistant_default_layer_set(1UL<<_DVORAK);
}
break;
case _LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
breathing_speed_set(2);
breathing_pulse();
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
break;
case _RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
breathing_speed_set(2);
breathing_pulse();
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
break;
case M_BL:
if (record->event.pressed) {
register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE
backlight_step();
#endif
} else {
unregister_code(KC_RSFT);
}
break;
case 6:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
audio_off();
#endif
}
break;
case 7:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
audio_on();
PLAY_NOTE_ARRAY(tone_startup, false, 0);
#endif
}
break;
case 8:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
layer_off(_MUSIC);
stop_all_notes();
#endif
}
break;
case 9:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(music_scale, false, 0);
layer_on(_MUSIC);
#endif
}
break;
case 10:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
voice_iterate();
PLAY_NOTE_ARRAY(music_scale, false, 0);
#endif
}
break;
case 11:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
voice_deiterate();
PLAY_NOTE_ARRAY(music_scale, false, 0);
#endif
}
break;
case 12:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
stop_all_notes();
PLAY_NOTE_ARRAY(tone_plover, false, 0);
#endif
layer_off(_RAISE);
layer_off(_LOWER);
layer_off(_ADJUST);
layer_off(_MUSIC);
layer_on(_PLOVER);
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
keymap_config.raw = eeconfig_read_keymap();
keymap_config.nkro = 1;
eeconfig_update_keymap(keymap_config.raw);
}
break;
case 13:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_plover_gb, false, 0);
#endif
layer_off(_PLOVER);
}
break;
}
return MACRO_NONE;
};
void matrix_init_user(void) {
#ifdef AUDIO_ENABLE
_delay_ms(20); // stops the tick
PLAY_NOTE_ARRAY(tone_startup, false, 0);
#endif
}
#ifdef AUDIO_ENABLE
void play_goodbye_tone()
{
PLAY_NOTE_ARRAY(goodbye, false, 0);
_delay_ms(150);
}
uint8_t starting_note = 0x0C;
int offset = 0;
void process_action_user(keyrecord_t *record) {
if (IS_LAYER_ON(_MUSIC)) {
if (record->event.pressed) {
play_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF);
} else {
stop_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)));
}
}
}
#endif

View File

@ -0,0 +1,2 @@
AUDIO_ENABLE = yes
NKRO_ENABLE = yes

View File

@ -38,6 +38,7 @@
#define MACRO_AUDIO_OFF 17
#define MACRO_INC_VOICE 18
#define MACRO_DEC_VOICE 19
#define MACRO_BACKLIGHT 20
#define M_QWRTY M(MACRO_QWERTY)
#define M_COLMK M(MACRO_COLEMAK)
@ -53,6 +54,7 @@
#define TMPO_UP M(MACRO_TEMPO_U)
#define TMPO_DN M(MACRO_TEMPO_D)
#define TMPO_DF M(MACRO_TONE_DEFAULT)
#define M_BACKL M(MACRO_BACKLIGHT)
#define MUS_ON M(MACRO_MUSIC_ON)
@ -217,7 +219,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[LAYER_ADJUST] = { /* ADJUST */
{ _______, TIMBR_1, TIMBR_2, TIMBR_3, TIMBR_4, TMPO_UP, TMPO_DN, TMPO_DF, MUS_ON, MUS_OFF, AUD_ON, AUD_OFF },
{ _______, M_QWRTY, M_COLMK, M_DVORK, _______, _______, _______, _______, _______, _______, _______, _______ },
{ _______, _______, _______, _______, _______, RESET, _______, M_MOUSE, _______, _______, _______, _______ },
{ _______, _______, _______, _______, M_BACKL, RESET, _______, M_MOUSE, _______, _______, _______, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, VC_UP, VC_DOWN, _______, _______ },
},
@ -337,6 +339,15 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
}
break;
#ifdef BACKLIGHT_ENABLE
case MACRO_BACKLIGHT:
if (record->event.pressed)
{
backlight_step();
}
#endif
#ifdef MOUSEKEY_ENABLE
case MACRO_MOUSE:

View File

@ -1,12 +1,12 @@
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = yes # Console for debug(+400)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
AUDIO_ENABLE = yes # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.

View File

@ -9,6 +9,9 @@ void matrix_scan_user(void) {}
__attribute__ ((weak))
void process_action_user(keyrecord_t *record) {}
__attribute__ ((weak))
void led_set_user(uint8_t usb_led) {}
void matrix_init_kb(void) {
#ifdef BACKLIGHT_ENABLE
backlight_init_ports();
@ -33,8 +36,22 @@ void process_action_kb(keyrecord_t *record) {
process_action_user(record);
}
void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
led_set_user(usb_led);
}
#ifdef BACKLIGHT_ENABLE
#define CHANNEL OCR1C
#define BREATHING_NO_HALT 0
#define BREATHING_HALT_OFF 1
#define BREATHING_HALT_ON 2
static uint8_t breath_intensity;
static uint8_t breath_speed;
static uint16_t breathing_index;
static uint8_t breathing_halt;
void backlight_init_ports()
{
@ -60,22 +77,22 @@ void backlight_init_ports()
TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001;
backlight_init();
breathing_defaults();
}
void backlight_set(uint8_t level)
{
// Prevent backlight blink on lowest level
PORTB &= ~(_BV(PORTB7));
if ( level == 0 )
{
// Turn off PWM control on PB7, revert to output low.
TCCR1A &= ~(_BV(COM1C1));
CHANNEL = 0x0;
// Prevent backlight blink on lowest level
PORTB &= ~(_BV(PORTB7));
}
else if ( level == BACKLIGHT_LEVELS )
{
// Prevent backlight blink on lowest level
PORTB &= ~(_BV(PORTB7));
// Turn on PWM control of PB7
TCCR1A |= _BV(COM1C1);
// Set the brightness
@ -83,13 +100,205 @@ void backlight_set(uint8_t level)
}
else
{
// Prevent backlight blink on lowest level
PORTB &= ~(_BV(PORTB7));
// Turn on PWM control of PB7
TCCR1A |= _BV(COM1C1);
// Set the brightness
CHANNEL = 0xFFFF >> ((BACKLIGHT_LEVELS - level) * ((BACKLIGHT_LEVELS + 1) / 2));
}
breathing_intensity_default();
}
void breathing_enable(void)
{
if (get_backlight_level() == 0)
{
breathing_index = 0;
}
else
{
// Set breathing_index to be at the midpoint (brightest point)
breathing_index = 0x20 << breath_speed;
}
breathing_halt = BREATHING_NO_HALT;
// Enable breathing interrupt
TIMSK1 |= _BV(OCIE1A);
}
void breathing_pulse(void)
{
if (get_backlight_level() == 0)
{
breathing_index = 0;
}
else
{
// Set breathing_index to be at the midpoint + 1 (brightest point)
breathing_index = 0x21 << breath_speed;
}
breathing_halt = BREATHING_HALT_ON;
// Enable breathing interrupt
TIMSK1 |= _BV(OCIE1A);
}
void breathing_disable(void)
{
// Disable breathing interrupt
TIMSK1 &= ~_BV(OCIE1A);
backlight_set(get_backlight_level());
}
void breathing_self_disable(void)
{
if (get_backlight_level() == 0)
{
breathing_halt = BREATHING_HALT_OFF;
}
else
{
breathing_halt = BREATHING_HALT_ON;
}
//backlight_set(get_backlight_level());
}
void breathing_toggle(void)
{
if (!is_breathing())
{
if (get_backlight_level() == 0)
{
breathing_index = 0;
}
else
{
// Set breathing_index to be at the midpoint + 1 (brightest point)
breathing_index = 0x21 << breath_speed;
}
breathing_halt = BREATHING_NO_HALT;
}
// Toggle breathing interrupt
TIMSK1 ^= _BV(OCIE1A);
// Restore backlight level
if (!is_breathing())
{
backlight_set(get_backlight_level());
}
}
bool is_breathing(void)
{
return (TIMSK1 && _BV(OCIE1A));
}
void breathing_intensity_default(void)
{
//breath_intensity = (uint8_t)((uint16_t)100 * (uint16_t)get_backlight_level() / (uint16_t)BACKLIGHT_LEVELS);
breath_intensity = ((BACKLIGHT_LEVELS - get_backlight_level()) * ((BACKLIGHT_LEVELS + 1) / 2));
}
void breathing_intensity_set(uint8_t value)
{
breath_intensity = value;
}
void breathing_speed_default(void)
{
breath_speed = 4;
}
void breathing_speed_set(uint8_t value)
{
bool is_breathing_now = is_breathing();
uint8_t old_breath_speed = breath_speed;
if (is_breathing_now)
{
// Disable breathing interrupt
TIMSK1 &= ~_BV(OCIE1A);
}
breath_speed = value;
if (is_breathing_now)
{
// Adjust index to account for new speed
breathing_index = (( (uint8_t)( (breathing_index) >> old_breath_speed ) ) & 0x3F) << breath_speed;
// Enable breathing interrupt
TIMSK1 |= _BV(OCIE1A);
}
}
void breathing_speed_inc(uint8_t value)
{
if ((uint16_t)(breath_speed - value) > 10 )
{
breathing_speed_set(0);
}
else
{
breathing_speed_set(breath_speed - value);
}
}
void breathing_speed_dec(uint8_t value)
{
if ((uint16_t)(breath_speed + value) > 10 )
{
breathing_speed_set(10);
}
else
{
breathing_speed_set(breath_speed + value);
}
}
void breathing_defaults(void)
{
breathing_intensity_default();
breathing_speed_default();
breathing_halt = BREATHING_NO_HALT;
}
/* Breathing Sleep LED brighness(PWM On period) table
* (64[steps] * 4[duration]) / 64[PWM periods/s] = 4 second breath cycle
*
* http://www.wolframalpha.com/input/?i=%28sin%28+x%2F64*pi%29**8+*+255%2C+x%3D0+to+63
* (0..63).each {|x| p ((sin(x/64.0*PI)**8)*255).to_i }
*/
static const uint8_t breathing_table[64] PROGMEM = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 6, 10,
15, 23, 32, 44, 58, 74, 93, 113, 135, 157, 179, 199, 218, 233, 245, 252,
255, 252, 245, 233, 218, 199, 179, 157, 135, 113, 93, 74, 58, 44, 32, 23,
15, 10, 6, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
ISR(TIMER1_COMPA_vect)
{
// CHANNEL = (pgm_read_byte(&breathing_table[ ( (uint8_t)( (breathing_index++) >> breath_speed ) ) & 0x3F ] )) * breath_intensity;
uint8_t local_index = ( (uint8_t)( (breathing_index++) >> breath_speed ) ) & 0x3F;
if (((breathing_halt == BREATHING_HALT_ON) && (local_index == 0x20)) || ((breathing_halt == BREATHING_HALT_OFF) && (local_index == 0x3F)))
{
// Disable breathing interrupt
TIMSK1 &= ~_BV(OCIE1A);
}
CHANNEL = (uint16_t)(((uint16_t)pgm_read_byte(&breathing_table[local_index]) * 257)) >> breath_intensity;
}
#endif

View File

@ -45,4 +45,22 @@ void matrix_init_user(void);
void matrix_scan_user(void);
void process_action_user(keyrecord_t *record);
void led_set_user(uint8_t usb_led);
void backlight_init_ports(void);
void breathing_enable(void);
void breathing_pulse(void);
void breathing_disable(void);
void breathing_self_disable(void);
void breathing_toggle(void);
bool is_breathing(void);
void breathing_defaults(void);
void breathing_intensity_default(void);
void breathing_speed_default(void);
void breathing_speed_set(uint8_t value);
void breathing_speed_inc(uint8_t value);
void breathing_speed_dec(uint8_t value);
#endif

View File

@ -374,6 +374,10 @@ bool is_playing_notes(void) {
return playing_notes;
}
bool is_audio_on(void) {
return (audio_config.enable != 0);
}
void audio_toggle(void) {
audio_config.enable ^= 1;
eeconfig_update_audio(audio_config.raw);

View File

@ -25,6 +25,7 @@ typedef union {
};
} audio_config_t;
bool is_audio_on(void);
void audio_toggle(void);
void audio_on(void);
void audio_off(void);
@ -71,11 +72,11 @@ void stop_note(float freq);
void stop_all_notes(void);
void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest);
#define SCALE (int []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \
0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \
0 + (12*2), 2 + (12*2), 4 + (12*2), 5 + (12*2), 7 + (12*2), 9 + (12*2), 11 + (12*2), \
0 + (12*3), 2 + (12*3), 4 + (12*3), 5 + (12*3), 7 + (12*3), 9 + (12*3), 11 + (12*3), \
0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), }
#define SCALE (int8_t []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \
0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \
0 + (12*2), 2 + (12*2), 4 + (12*2), 5 + (12*2), 7 + (12*2), 9 + (12*2), 11 + (12*2), \
0 + (12*3), 2 + (12*3), 4 + (12*3), 5 + (12*3), 7 + (12*3), 9 + (12*3), 11 + (12*3), \
0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), }
// These macros are used to allow play_notes to play an array of indeterminate
// length. This works around the limitation of C's sizeof operation on pointers.

View File

@ -272,6 +272,14 @@ static action_t keycode_to_action(uint16_t keycode)
// Set default layer
int layer = keycode & 0xFF;
action.code = ACTION_LAYER_TOGGLE(layer);
} else if (type == 0x5) {
// OSL(layer) - One-shot layer
int layer = keycode & 0xFF;
action.code = ACTION_LAYER_ONESHOT(layer);
} else if (type == 0x6) {
// OSM(mod) - One-shot mod
int mod = keycode & 0xFF;
action.code = ACTION_MODS_ONESHOT(mod);
}
break;
#ifdef MIDI_ENABLE

View File

@ -67,6 +67,9 @@ extern const uint16_t fn_actions[];
#define MEH(kc) kc | 0x0700
#define LCAG(kc) kc | 0x0D00 // Modifier Ctrl Alt and GUI
#define MOD_HYPR 0xf
#define MOD_MEH 0x7
#define RCTL(kc) kc | 0x1100
#define RSFT(kc) kc | 0x1200
#define RALT(kc) kc | 0x1400
@ -84,8 +87,11 @@ extern const uint16_t fn_actions[];
#define KC_EXCLAIM KC_EXLM
#define KC_AT LSFT(KC_2) // @
#define KC_HASH LSFT(KC_3) // #
#define KC_DLR LSFT(KC_4) // $
#define KC_DOLLAR KC_DLR
@ -107,22 +113,43 @@ extern const uint16_t fn_actions[];
#define KC_RPRN LSFT(KC_0) // )
#define KC_RIGHT_PAREN KC_RPRN
#define KC_UNDS LSFT(KC_MINS) // _
#define KC_UNDERSCORE KC_UNDS
#define KC_PLUS LSFT(KC_EQL) // +
#define KC_LCBR LSFT(KC_LBRC) // {
#define KC_LEFT_CURLY_BRACE KC_LCBR
#define KC_RCBR LSFT(KC_RBRC) // }
#define KC_RIGHT_CURLY_BRACE KC_RCBR
#define KC_LABK LSFT(KC_COMM) // <
#define KC_LEFT_ANGLE_BRACKET KC_LABK
#define KC_RABK LSFT(KC_DOT) // >
#define KC_RIGHT_ANGLE_BRACKET KC_RABK
#define KC_COLN LSFT(KC_SCLN) // :
#define KC_COLON KC_COLN
#define KC_PIPE LSFT(KC_BSLS) // |
#define KC_LT LSFT(KC_COMM) // <
#define KC_GT LSFT(KC_DOT) // >
#define KC_QUES LSFT(KC_SLSH) // ?
#define KC_QUESTION KC_QUES
#define KC_DQT LSFT(KC_QUOT) // "
#define KC_DOUBLE_QUOTE KC_DQT
#define KC_DELT KC_DELETE // Del key (four letter code)
// Alias for function layers than expand past FN31
@ -205,6 +232,12 @@ extern const uint16_t fn_actions[];
// Toggle to layer - 256 layer max
#define TG(layer) (layer | 0x5400)
// One-shot layer - 256 layer max
#define OSL(layer) (layer | 0x5500)
// One-shot mod
#define OSM(layer) (layer | 0x5600)
// M-od, T-ap - 256 keycode max
#define MT(mod, kc) (kc | 0x7000 | ((mod & 0xF) << 8))
#define CTL_T(kc) MT(0x1, kc)

View File

@ -25,11 +25,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define CHNL(note, channel) (note + (channel << 8))
#define SCALE (int []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \
0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \
0 + (12*2), 2 + (12*2), 4 + (12*2), 5 + (12*2), 7 + (12*2), 9 + (12*2), 11 + (12*2), \
0 + (12*3), 2 + (12*3), 4 + (12*3), 5 + (12*3), 7 + (12*3), 9 + (12*3), 11 + (12*3), \
0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), }
#define SCALE (int8_t []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \
0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \
0 + (12*2), 2 + (12*2), 4 + (12*2), 5 + (12*2), 7 + (12*2), 9 + (12*2), 11 + (12*2), \
0 + (12*3), 2 + (12*3), 4 + (12*3), 5 + (12*3), 7 + (12*3), 9 + (12*3), 11 + (12*3), \
0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), }
#define N_CN1 (0x600C + (12 * -1) + 0 )
#define N_CN1S (0x600C + (12 * -1) + 1 )

View File

@ -42,6 +42,13 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS];
static matrix_row_t matrix_reversed_debouncing[MATRIX_COLS];
#endif
#if MATRIX_COLS > 16
#define SHIFTER 1UL
#else
#define SHIFTER 1
#endif
static matrix_row_t read_cols(void);
static void init_cols(void);
static void unselect_rows(void);
@ -235,15 +242,15 @@ static matrix_row_t read_cols(void)
#endif
if ((col & 0xF0) == 0x20) {
result |= (PINB&(1<<(col & 0x0F)) ? 0 : (1<<x));
result |= (PINB&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x));
} else if ((col & 0xF0) == 0x30) {
result |= (PINC&(1<<(col & 0x0F)) ? 0 : (1<<x));
result |= (PINC&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x));
} else if ((col & 0xF0) == 0x40) {
result |= (PIND&(1<<(col & 0x0F)) ? 0 : (1<<x));
result |= (PIND&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x));
} else if ((col & 0xF0) == 0x50) {
result |= (PINE&(1<<(col & 0x0F)) ? 0 : (1<<x));
result |= (PINE&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x));
} else if ((col & 0xF0) == 0x60) {
result |= (PINF&(1<<(col & 0x0F)) ? 0 : (1<<x));
result |= (PINF&(1<<(col & 0x0F)) ? 0 : (SHIFTER<<x));
}
}
return result;

View File

@ -28,8 +28,9 @@ ifeq ($(strip $(MIDI_ENABLE)), yes)
endif
ifeq ($(strip $(AUDIO_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/audio/audio.c $(QUANTUM_DIR)/audio/voices.c
SRC += $(QUANTUM_DIR)/audio/audio.c $(QUANTUM_DIR)/audio/luts.c
SRC += $(QUANTUM_DIR)/audio/audio.c
SRC += $(QUANTUM_DIR)/audio/voices.c
SRC += $(QUANTUM_DIR)/audio/luts.c
endif
ifeq ($(strip $(UNICODE_ENABLE)), yes)

View File

@ -1,6 +1,6 @@
`eeprom_reset.hex` is to reset the eeprom on the Atmega32u4, like this:
dfu-programmer atmega32u4 erase
dfu-programmer atmega32u4 flash --eeprom eeprom-reset.bin
dfu-programmer atmega32u4 flash --eeprom eeprom_reset.hex
You'll need to reflash afterwards, because DFU requires the flash to be erased before messing with the eeprom.
You'll need to reflash afterwards, because DFU requires the flash to be erased before messing with the eeprom.

View File

@ -74,6 +74,7 @@ void process_action_kb(keyrecord_t *record) {}
void process_action(keyrecord_t *record)
{
bool do_release_oneshot = false;
keyevent_t event = record->event;
#ifndef NO_ACTION_TAPPING
uint8_t tap_count = record->tap.count;
@ -81,6 +82,13 @@ void process_action(keyrecord_t *record)
if (IS_NOEVENT(event)) { return; }
#if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
if (has_oneshot_layer_timed_out()) {
dprintf("Oneshot layer: timeout\n");
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
}
#endif
process_action_kb(record);
action_t action = store_or_get_action(event.pressed, event.key);
@ -95,6 +103,15 @@ void process_action(keyrecord_t *record)
// clear the potential weak mods left by previously pressed keys
clear_weak_mods();
}
#ifndef NO_ACTION_ONESHOT
// notice we only clear the one shot layer if the pressed key is not a modifier.
if (is_oneshot_layer_active() && event.pressed && !IS_MOD(action.key.code)) {
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
do_release_oneshot = !is_oneshot_layer_active();
}
#endif
switch (action.kind.id) {
/* Key and Mods */
case ACT_LMODS:
@ -139,24 +156,37 @@ void process_action(keyrecord_t *record)
// Oneshot modifier
if (event.pressed) {
if (tap_count == 0) {
dprint("MODS_TAP: Oneshot: 0\n");
register_mods(mods);
}
else if (tap_count == 1) {
} else if (tap_count == 1) {
dprint("MODS_TAP: Oneshot: start\n");
set_oneshot_mods(mods);
}
else {
#if defined(ONESHOT_TAP_TOGGLE) && ONESHOT_TAP_TOGGLE > 1
} else if (tap_count == ONESHOT_TAP_TOGGLE) {
dprint("MODS_TAP: Toggling oneshot");
clear_oneshot_mods();
set_oneshot_locked_mods(mods);
register_mods(mods);
#endif
} else {
register_mods(mods);
}
} else {
if (tap_count == 0) {
clear_oneshot_mods();
unregister_mods(mods);
}
else if (tap_count == 1) {
} else if (tap_count == 1) {
// Retain Oneshot mods
}
else {
#if defined(ONESHOT_TAP_TOGGLE) && ONESHOT_TAP_TOGGLE > 1
if (mods & get_mods()) {
clear_oneshot_locked_mods();
clear_oneshot_mods();
unregister_mods(mods);
}
} else if (tap_count == ONESHOT_TAP_TOGGLE) {
// Toggle Oneshot Layer
#endif
} else {
clear_oneshot_mods();
unregister_mods(mods);
}
@ -309,6 +339,44 @@ void process_action(keyrecord_t *record)
event.pressed ? layer_move(action.layer_tap.val) :
layer_clear();
break;
#ifndef NO_ACTION_ONESHOT
case OP_ONESHOT:
// Oneshot modifier
#if defined(ONESHOT_TAP_TOGGLE) && ONESHOT_TAP_TOGGLE > 1
do_release_oneshot = false;
if (event.pressed) {
del_mods(get_oneshot_locked_mods());
if (get_oneshot_layer_state() == ONESHOT_TOGGLED) {
reset_oneshot_layer();
layer_off(action.layer_tap.val);
break;
} else if (tap_count < ONESHOT_TAP_TOGGLE) {
layer_on(action.layer_tap.val);
set_oneshot_layer(action.layer_tap.val, ONESHOT_START);
}
} else {
add_mods(get_oneshot_locked_mods());
if (tap_count >= ONESHOT_TAP_TOGGLE) {
reset_oneshot_layer();
clear_oneshot_locked_mods();
set_oneshot_layer(action.layer_tap.val, ONESHOT_TOGGLED);
} else {
clear_oneshot_layer_state(ONESHOT_PRESSED);
}
}
#else
if (event.pressed) {
layer_on(action.layer_tap.val);
set_oneshot_layer(action.layer_tap.val, ONESHOT_START);
} else {
clear_oneshot_layer_state(ONESHOT_PRESSED);
if (tap_count > 1) {
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
}
}
#endif
break;
#endif
default:
/* tap key */
if (event.pressed) {
@ -372,6 +440,18 @@ void process_action(keyrecord_t *record)
default:
break;
}
#ifndef NO_ACTION_ONESHOT
/* Because we switch layers after a oneshot event, we need to release the
* key before we leave the layer or no key up event will be generated.
*/
if (do_release_oneshot && !(get_oneshot_layer_state() & ONESHOT_PRESSED ) ) {
record->event.pressed = false;
layer_on(get_oneshot_layer());
process_action(record);
layer_off(get_oneshot_layer());
}
#endif
}
@ -560,6 +640,7 @@ bool is_tap_key(keypos_t key)
switch (action.layer_tap.code) {
case 0x00 ... 0xdf:
case OP_TAP_TOGGLE:
case OP_ONESHOT:
return true;
}
return false;

View File

@ -76,7 +76,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* 101E|LLLL|1111 0001 On/Off (0xF1) [NOT TAP]
* 101E|LLLL|1111 0010 Off/On (0xF2) [NOT TAP]
* 101E|LLLL|1111 0011 Set/Clear (0xF3) [NOT TAP]
* 101E|LLLL|1111 xxxx Reserved (0xF4-FF)
* 101E|LLLL|1111 0100 One Shot Layer (0xF4) [TAP]
* 101E|LLLL|1111 xxxx Reserved (0xF5-FF)
* ELLLL: layer 0-31(E: extra bit for layer 16-31)
*
*
@ -250,6 +251,7 @@ enum layer_pram_tap_op {
OP_ON_OFF,
OP_OFF_ON,
OP_SET_CLEAR,
OP_ONESHOT,
};
#define ACTION_LAYER_BITOP(op, part, bits, on) (ACT_LAYER<<12 | (op)<<10 | (on)<<8 | (part)<<5 | ((bits)&0x1f))
#define ACTION_LAYER_TAP(layer, key) (ACT_LAYER_TAP<<12 | (layer)<<8 | (key))
@ -266,6 +268,7 @@ enum layer_pram_tap_op {
#define ACTION_LAYER_ON_OFF(layer) ACTION_LAYER_TAP((layer), OP_ON_OFF)
#define ACTION_LAYER_OFF_ON(layer) ACTION_LAYER_TAP((layer), OP_OFF_ON)
#define ACTION_LAYER_SET_CLEAR(layer) ACTION_LAYER_TAP((layer), OP_SET_CLEAR)
#define ACTION_LAYER_ONESHOT(layer) ACTION_LAYER_TAP((layer), OP_ONESHOT)
#define ACTION_LAYER_MODS(layer, mods) ACTION_LAYER_TAP((layer), 0xe0 | ((mods)&0x0f))
/* With Tapping */
#define ACTION_LAYER_TAP_KEY(layer, key) ACTION_LAYER_TAP((layer), (key))

View File

@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "report.h"
#include "debug.h"
#include "action_util.h"
#include "action_layer.h"
#include "timer.h"
static inline void add_key_byte(uint8_t code);
@ -47,11 +48,70 @@ report_keyboard_t *keyboard_report = &(report_keyboard_t){};
#ifndef NO_ACTION_ONESHOT
static int8_t oneshot_mods = 0;
static int8_t oneshot_locked_mods = 0;
int8_t get_oneshot_locked_mods(void) { return oneshot_locked_mods; }
void set_oneshot_locked_mods(int8_t mods) { oneshot_locked_mods = mods; }
void clear_oneshot_locked_mods(void) { oneshot_locked_mods = 0; }
#if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
static int16_t oneshot_time = 0;
inline bool has_oneshot_mods_timed_out() {
return TIMER_DIFF_16(timer_read(), oneshot_time) >= ONESHOT_TIMEOUT;
}
#endif
#endif
/* oneshot layer */
#ifndef NO_ACTION_ONESHOT
/* oneshot_layer_data bits
* LLLL LSSS
* where:
* L => are layer bits
* S => oneshot state bits
*/
static int8_t oneshot_layer_data = 0;
inline uint8_t get_oneshot_layer(void) { return oneshot_layer_data >> 3; }
inline uint8_t get_oneshot_layer_state(void) { return oneshot_layer_data & 0b111; }
#if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
static int16_t oneshot_layer_time = 0;
inline bool has_oneshot_layer_timed_out() {
return TIMER_DIFF_16(timer_read(), oneshot_layer_time) >= ONESHOT_TIMEOUT &&
!(get_oneshot_layer_state() & ONESHOT_TOGGLED);
}
#endif
/* Oneshot layer */
void set_oneshot_layer(uint8_t layer, uint8_t state)
{
oneshot_layer_data = layer << 3 | state;
layer_on(layer);
#if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
oneshot_layer_time = timer_read();
#endif
}
void reset_oneshot_layer(void) {
oneshot_layer_data = 0;
#if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
oneshot_layer_time = 0;
#endif
}
void clear_oneshot_layer_state(oneshot_fullfillment_t state)
{
uint8_t start_state = oneshot_layer_data;
oneshot_layer_data &= ~state;
if (!get_oneshot_layer_state() && start_state != oneshot_layer_data) {
layer_off(get_oneshot_layer());
#if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
oneshot_layer_time = 0;
#endif
}
}
bool is_oneshot_layer_active(void)
{
return get_oneshot_layer_state();
}
#endif
void send_keyboard_report(void) {
keyboard_report->mods = real_mods;
@ -60,7 +120,7 @@ void send_keyboard_report(void) {
#ifndef NO_ACTION_ONESHOT
if (oneshot_mods) {
#if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
if (TIMER_DIFF_16(timer_read(), oneshot_time) >= ONESHOT_TIMEOUT) {
if (has_oneshot_mods_timed_out()) {
dprintf("Oneshot: timeout\n");
clear_oneshot_mods();
}
@ -70,6 +130,7 @@ void send_keyboard_report(void) {
clear_oneshot_mods();
}
}
#endif
host_keyboard_send(keyboard_report);
}
@ -143,11 +204,12 @@ void clear_oneshot_mods(void)
oneshot_time = 0;
#endif
}
uint8_t get_oneshot_mods(void)
{
return oneshot_mods;
}
#endif
/*
* inspect keyboard state
*/

View File

@ -56,10 +56,30 @@ void clear_macro_mods(void);
/* oneshot modifier */
void set_oneshot_mods(uint8_t mods);
uint8_t get_oneshot_mods(void);
void clear_oneshot_mods(void);
void oneshot_toggle(void);
void oneshot_enable(void);
void oneshot_disable(void);
bool has_oneshot_mods_timed_out(void);
int8_t get_oneshot_locked_mods(void);
void set_oneshot_locked_mods(int8_t mods);
void clear_oneshot_locked_mods(void);
typedef enum {
ONESHOT_PRESSED = 0b01,
ONESHOT_OTHER_KEY_PRESSED = 0b10,
ONESHOT_START = 0b11,
ONESHOT_TOGGLED = 0b100
} oneshot_fullfillment_t;
void set_oneshot_layer(uint8_t layer, uint8_t state);
uint8_t get_oneshot_layer(void);
void clear_oneshot_layer_state(oneshot_fullfillment_t state);
void reset_oneshot_layer(void);
bool is_oneshot_layer_active(void);
uint8_t get_oneshot_layer_state(void);
bool has_oneshot_layer_timed_out(void);
/* inspect */
uint8_t has_anykey(void);

View File

@ -83,3 +83,8 @@ void backlight_level(uint8_t level)
eeconfig_update_backlight(backlight_config.raw);
backlight_set(backlight_config.level);
}
uint8_t get_backlight_level(void)
{
return backlight_config.level;
}

View File

@ -36,5 +36,6 @@ void backlight_toggle(void);
void backlight_step(void);
void backlight_set(uint8_t level);
void backlight_level(uint8_t level);
uint8_t get_backlight_level(void);
#endif

View File

@ -357,9 +357,11 @@ static bool command_common(uint8_t code)
clear_keyboard(); // clear to prevent stuck keys
print("\n\nJumping to bootloader... ");
#ifdef AUDIO_ENABLE
stop_all_notes();
play_goodbye_tone();
#else
_delay_ms(1000);
#endif
_delay_ms(1000);
bootloader_jump(); // not return
break;

View File

@ -16,10 +16,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NODEBUG_H
#define NODEBUG_H 1
#define NODEBUG_H
#define NO_DEBUG
#include "debug.h"
#undef NO_DEBUG
#ifndef NO_DEBUG
#define NO_DEBUG
#include "debug.h"
#undef NO_DEBUG
#else
#include "debug.h"
#endif
#endif

View File

@ -528,14 +528,20 @@ This is a feature to assign both toggle layer and momentary switch layer action
### 4.3 Oneshot Modifier
This runs onetime effects which modify only on just one following key. It works as normal modifier key when holding down while oneshot modifier when tapping.
This runs onetime effects which modify only on just one following key. It works as normal modifier key when holding down while oneshot modifier when tapping. The behavior of oneshot modifiers is similar to the [sticky keys](https://en.wikipedia.org/wiki/StickyKeys) functionality found in most operating systems.
ACTION_MODS_ONESHOT(MOD_LSFT)
Oneshot layer key:
ACTION_LAYER_ONESHOT(MY_LAYER)
Say you want to type 'The', you have to push and hold Shift key before type 't' then release it before type 'h' and 'e', otherwise you'll get 'THe' or 'the' unintentionally. With Oneshot Modifier you can tap Shift then type 't', 'h' and 'e' normally, you don't need to holding Shift key properly here. This mean you can release Shift before 't' is pressed down.
Oneshot effect is cancel unless following key is pressed down within `ONESHOT_TIMEOUT` of `config.h`. No timeout when it is `0` or not defined.
Most implementations of sticky keys allow you to lock a modifier by double tapping the modifier. The layer then remains locked untill the modifier is tapped again. To enable this behaviour for oneshot modifiers set `ONESHOT_TAP_TOGGLE` to the number taps required. The feature is disabled if `ONESHOT_TAP_TOGGLE<2` or not defined.
### 4.4 Tap Toggle Mods
Similar to layer tap toggle, this works as a momentary modifier when holding, but toggles on with several taps. A single tap will 'unstick' the modifier again.

View File

@ -142,6 +142,9 @@ CFLAGS += $(CSTANDARD)
ifdef CONFIG_H
CFLAGS += -include $(CONFIG_H)
endif
ifdef CONFIG_USER_H
CFLAGS += -include $(CONFIG_USER_H)
endif
#---------------- Compiler Options C++ ----------------
@ -176,6 +179,9 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
ifdef CONFIG_H
CPPFLAGS += -include $(CONFIG_H)
endif
ifdef CONFIG_USER_H
CPPFLAGS += -include $(CONFIG_USER_H)
endif
#---------------- Assembler Options ----------------
@ -192,6 +198,9 @@ ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
ifdef CONFIG_H
ASFLAGS += -include $(CONFIG_H)
endif
ifdef CONFIG_USER_H
ASFLAGS += -include $(CONFIG_USER_H)
endif
#---------------- Library Options ----------------