Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e354e36ece | ||
|
|
b05c153633 | ||
|
|
5229734647 | ||
|
|
cb91320d6d | ||
|
|
692a77c2dd | ||
|
|
82500842f6 | ||
|
|
a055a45b13 | ||
|
|
5ce0d64027 | ||
|
|
8707bdd509 | ||
|
|
d554d96334 | ||
|
|
d8478351d7 | ||
|
|
2196dc9f86 | ||
|
|
9fb1e5d171 | ||
|
|
3364334bfd | ||
|
|
b5da3b53b3 | ||
|
|
b36a1ef61b | ||
|
|
74d86832c3 | ||
|
|
0aaff74b39 | ||
|
|
7624a4e57e | ||
|
|
3d1349b280 | ||
|
|
8eaf23ae81 | ||
|
|
abce980b8b | ||
|
|
d27855665a | ||
|
|
ee9a7aba39 | ||
|
|
21ad968ac1 | ||
|
|
b2398ecbe7 | ||
|
|
258954dc3e | ||
|
|
835431330c | ||
|
|
a75bd221f2 | ||
|
|
805b42275b | ||
|
|
7f5361aedb | ||
|
|
434a450be1 | ||
|
|
4bd64227fd | ||
|
|
8a9c19ee93 |
No files matched your search
@@ -135,9 +135,11 @@ void led_set_user(uint8_t usb_led) {
|
|||||||
* Keyboard/Revision: `void led_set_kb(uint8_t usb_led)`
|
* Keyboard/Revision: `void led_set_kb(uint8_t usb_led)`
|
||||||
* Keymap: `void led_set_user(uint8_t usb_led)`
|
* Keymap: `void led_set_user(uint8_t usb_led)`
|
||||||
|
|
||||||
|
|
||||||
# Matrix Initialization Code
|
# Matrix Initialization Code
|
||||||
|
|
||||||
Before a keyboard can be used the hardware must be initialized. QMK handles initialization of the keyboard matrix itself, but if you have other hardware like LED's or i²c controllers you will need to set up that hardware before it can be used.
|
Before a keyboard can be used the hardware must be initialized. QMK handles initialization of the keyboard matrix itself, but if you have other hardware like LED's or i²c controllers you will need to set up that hardware before it can be used.
|
||||||
|
|
||||||
|
|
||||||
### Example `matrix_init_user()` Implementation
|
### Example `matrix_init_user()` Implementation
|
||||||
|
|
||||||
@@ -177,9 +179,38 @@ This function gets called at every matrix scan, which is basically as often as t
|
|||||||
You should use this function if you need custom matrix scanning code. It can also be used for custom status output (such as LED's or a display) or other functionality that you want to trigger regularly even when the user isn't typing.
|
You should use this function if you need custom matrix scanning code. It can also be used for custom status output (such as LED's or a display) or other functionality that you want to trigger regularly even when the user isn't typing.
|
||||||
|
|
||||||
|
|
||||||
|
# Keyboard Idling/Wake Code
|
||||||
|
|
||||||
|
If the board supports it, it can be "idled", by stopping a number of functions. A good example of this is RGB lights or backlights. This can save on power consumption, or may be better behavior for your keyboard.
|
||||||
|
|
||||||
|
This is controlled by two functions: `suspend_power_down_*` and `suspend_wakeup_init_*`, which are called when the system is board is idled and when it wakes up, respectively.
|
||||||
|
|
||||||
|
|
||||||
|
### Example suspend_power_down_user() and suspend_wakeup_init_user() Implementation
|
||||||
|
|
||||||
|
This example, at the keyboard level, sets up B1, B2, and B3 as LED pins.
|
||||||
|
|
||||||
|
```
|
||||||
|
void suspend_power_down_user(void)
|
||||||
|
{
|
||||||
|
rgb_matrix_set_suspend_state(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void suspend_wakeup_init_user(void)
|
||||||
|
{
|
||||||
|
rgb_matrix_set_suspend_state(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### `keyboard_init_*` Function Documentation
|
||||||
|
|
||||||
|
* Keyboard/Revision: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)`
|
||||||
|
* Keymap: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)`
|
||||||
|
|
||||||
# Layer Change Code
|
# Layer Change Code
|
||||||
|
|
||||||
Thir runs code every time that the layers get changed. This can be useful for layer indication, or custom layer handling.
|
This runs code every time that the layers get changed. This can be useful for layer indication, or custom layer handling.
|
||||||
|
|
||||||
### Example `layer_state_set_*` Implementation
|
### Example `layer_state_set_*` Implementation
|
||||||
|
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ These control the RGB Lighting functionality.
|
|||||||
|`RGB_MODE_KNIGHT` |`RGB_M_K` |"Knight Rider" animation mode |
|
|`RGB_MODE_KNIGHT` |`RGB_M_K` |"Knight Rider" animation mode |
|
||||||
|`RGB_MODE_XMAS` |`RGB_M_X` |Christmas animation mode |
|
|`RGB_MODE_XMAS` |`RGB_M_X` |Christmas animation mode |
|
||||||
|`RGB_MODE_GRADIENT`|`RGB_M_G` |Static gradient animation mode |
|
|`RGB_MODE_GRADIENT`|`RGB_M_G` |Static gradient animation mode |
|
||||||
|
|`RGB_MODE_RGBTEST `|`RGB_M_T` |Red,Green,Blue test animation mode |
|
||||||
|
|
||||||
note: for backwards compatibility, `RGB_SMOD` is an alias for `RGB_MOD`.
|
note: for backwards compatibility, `RGB_SMOD` is an alias for `RGB_MOD`.
|
||||||
|
|
||||||
|
|||||||
@@ -47,16 +47,6 @@ The `info.json` file is a JSON formatted dictionary with the following keys avai
|
|||||||
* Example: `Clueboard 66%`
|
* Example: `Clueboard 66%`
|
||||||
* `url`
|
* `url`
|
||||||
* A URL to the keyboard's product page, [QMK.fm/keyboards](https://qmk.fm/keyboards) page, or other page describing information about the keyboard.
|
* A URL to the keyboard's product page, [QMK.fm/keyboards](https://qmk.fm/keyboards) page, or other page describing information about the keyboard.
|
||||||
* `bootloader`
|
|
||||||
* What bootloader this keyboard uses. Available options:
|
|
||||||
* `atmel-dfu`
|
|
||||||
* `kiibohd-dfu-util`
|
|
||||||
* `lufa-dfu`
|
|
||||||
* `qmk-dfu`
|
|
||||||
* `stm32-dfu-util`
|
|
||||||
* `caterina`
|
|
||||||
* `halfkay`
|
|
||||||
* `bootloadHID`
|
|
||||||
* `maintainer`
|
* `maintainer`
|
||||||
* GitHub username of the maintainer, or `qmk` for community maintained boards
|
* GitHub username of the maintainer, or `qmk` for community maintained boards
|
||||||
* `width`
|
* `width`
|
||||||
|
|||||||
@@ -283,6 +283,7 @@ This is a reference only. Each group of keys links to the page documenting their
|
|||||||
|`RGB_MODE_KNIGHT` |`RGB_M_K` |"Knight Rider" animation mode |
|
|`RGB_MODE_KNIGHT` |`RGB_M_K` |"Knight Rider" animation mode |
|
||||||
|`RGB_MODE_XMAS` |`RGB_M_X` |Christmas animation mode |
|
|`RGB_MODE_XMAS` |`RGB_M_X` |Christmas animation mode |
|
||||||
|`RGB_MODE_GRADIENT`|`RGB_M_G` |Static gradient animation mode |
|
|`RGB_MODE_GRADIENT`|`RGB_M_G` |Static gradient animation mode |
|
||||||
|
|`RGB_MODE_RGBTEST` |`RGB_M_T` |Red,Green,Blue test animation mode |
|
||||||
|
|
||||||
## [RGB Matrix Lighting](feature_rgb_matrix.md)
|
## [RGB Matrix Lighting](feature_rgb_matrix.md)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# DudeOfAwesome's Big Series 1-key layout
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
### Tap dancing taps:
|
||||||
|
1. Media Play / Pause
|
||||||
|
1. Media Next
|
||||||
|
1. RGB Mode Next
|
||||||
|
1. RGB Mode Previous
|
||||||
|
|
||||||
|
## Building and flashing
|
||||||
|
|
||||||
|
1. Put your board in DFU mode with the button on the bottom
|
||||||
|
1. Flash:
|
||||||
|
```bash
|
||||||
|
$ make bigseries:dudeofawesome:dfu
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2018 Cole Markham
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_USER_H
|
||||||
|
#define CONFIG_USER_H
|
||||||
|
|
||||||
|
#define TAPPING_TERM 1000
|
||||||
|
|
||||||
|
#endif
|
||||||
+50
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2018 Cole Markham
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
enum TAP_DANCE {
|
||||||
|
TD_PLAY = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
LAYOUT(TD(TD_PLAY)),
|
||||||
|
};
|
||||||
|
|
||||||
|
void tap_dance (qk_tap_dance_state_t *state, void *user_data) {
|
||||||
|
switch (state->count) {
|
||||||
|
case 0 ... 1:
|
||||||
|
register_code(KC_MEDIA_PLAY_PAUSE);
|
||||||
|
unregister_code(KC_MEDIA_PLAY_PAUSE);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
register_code(KC_MEDIA_NEXT_TRACK);
|
||||||
|
unregister_code(KC_MEDIA_NEXT_TRACK);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
rgblight_step();
|
||||||
|
break;
|
||||||
|
case 4: default:
|
||||||
|
rgblight_step_reverse();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Tap Dance Definitions
|
||||||
|
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||||
|
[TD_PLAY] = ACTION_TAP_DANCE_FN(tap_dance),
|
||||||
|
};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
TAP_DANCE_ENABLE = yes
|
||||||
@@ -26,8 +26,8 @@ void matrix_init_user(void) {
|
|||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
if (runonce && timer_elapsed(my_timer) > 1000) {
|
if (runonce && timer_elapsed(my_timer) > 1000) {
|
||||||
runonce = false;
|
runonce = false;
|
||||||
rgblight_sethsv(0x0, 0xff, 0x80);
|
rgblight_sethsv_noeeprom(0x0, 0xff, 0x80);
|
||||||
rgblight_mode(9);
|
rgblight_mode_noeeprom(9);
|
||||||
rgblight_enable();
|
rgblight_enable_noeeprom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
#define KEYMAP( \
|
#define LAYOUT( \
|
||||||
K05, K25, K35, K45, K55, K06, KA6, KA7, K07, KB5, KC5, KD5, KE5, KD1, KE1, KE2, \
|
K05, K25, K35, K45, K55, K06, KA6, KA7, K07, KB5, KC5, KD5, KE5, KD1, KE1, KE2, \
|
||||||
K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, KD0, \
|
K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, KD0, \
|
||||||
K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3, KC3, KD3, K67, \
|
K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3, KC3, KD3, K67, \
|
||||||
@@ -38,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
{ K07, K17, K27, K37, K47, K57, K67, K77, KC_NO, KC_NO, KA7, KB7, KC7, KD7, KE7 } \
|
{ K07, K17, K27, K37, K47, K57, K67, K77, KC_NO, KC_NO, KA7, KB7, KC7, KD7, KE7 } \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define KC_KEYMAP( \
|
#define LAYOUT_kc( \
|
||||||
K05, K25, K35, K45, K55, K06, KA6, KA7, K07, KB5, KC5, KD5, KE5, KD1, KE1, KE2, \
|
K05, K25, K35, K45, K55, K06, KA6, KA7, K07, KB5, KC5, KD5, KE5, KD1, KE1, KE2, \
|
||||||
K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, KD0, \
|
K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, KD0, \
|
||||||
K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3, KC3, KD3, K67, \
|
K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3, KC3, KD3, K67, \
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"keyboard_name": "B.mini",
|
||||||
|
"url": "",
|
||||||
|
"maintainer": "qmk",
|
||||||
|
"width": 16,
|
||||||
|
"height": 6,
|
||||||
|
"layouts": {
|
||||||
|
"LAYOUT": {
|
||||||
|
"key_count": 84,
|
||||||
|
"layout": [{"label":"K05", "x":0, "y":0}, {"label":"K25", "x":1, "y":0}, {"label":"K35", "x":2, "y":0}, {"label":"K45", "x":3, "y":0}, {"label":"K55", "x":4, "y":0}, {"label":"K06", "x":5, "y":0}, {"label":"KA6", "x":6, "y":0}, {"label":"KA7", "x":7, "y":0}, {"label":"K07", "x":8, "y":0}, {"label":"KB5", "x":9, "y":0}, {"label":"KC5", "x":10, "y":0}, {"label":"KD5", "x":11, "y":0}, {"label":"KE5", "x":12, "y":0}, {"label":"KD1", "x":13, "y":0}, {"label":"KE1", "x":14, "y":0}, {"label":"KE2", "x":15, "y":0}, {"label":"K04", "x":0, "y":1}, {"label":"K14", "x":1, "y":1}, {"label":"K24", "x":2, "y":1}, {"label":"K34", "x":3, "y":1}, {"label":"K44", "x":4, "y":1}, {"label":"K54", "x":5, "y":1}, {"label":"K16", "x":6, "y":1}, {"label":"KB6", "x":7, "y":1}, {"label":"KB7", "x":8, "y":1}, {"label":"K17", "x":9, "y":1}, {"label":"KA4", "x":10, "y":1}, {"label":"KB4", "x":11, "y":1}, {"label":"KC4", "x":12, "y":1}, {"label":"KE4", "x":13, "y":1, "w":2}, {"label":"KD0", "x":15, "y":1}, {"label":"K03", "x":0, "y":2, "w":1.5}, {"label":"K13", "x":1.5, "y":2}, {"label":"K23", "x":2.5, "y":2}, {"label":"K33", "x":3.5, "y":2}, {"label":"K43", "x":4.5, "y":2}, {"label":"K53", "x":5.5, "y":2}, {"label":"K26", "x":6.5, "y":2}, {"label":"KC6", "x":7.5, "y":2}, {"label":"KC7", "x":8.5, "y":2}, {"label":"K27", "x":9.5, "y":2}, {"label":"KA3", "x":10.5, "y":2}, {"label":"KB3", "x":11.5, "y":2}, {"label":"KC3", "x":12.5, "y":2}, {"label":"KD3", "x":13.5, "y":2, "w":1.5}, {"label":"K67", "x":15, "y":2}, {"label":"K02", "x":0, "y":3, "w":1.75}, {"label":"K12", "x":1.75, "y":3}, {"label":"K22", "x":2.75, "y":3}, {"label":"K32", "x":3.75, "y":3}, {"label":"K42", "x":4.75, "y":3}, {"label":"K52", "x":5.75, "y":3}, {"label":"K36", "x":6.75, "y":3}, {"label":"KD6", "x":7.75, "y":3}, {"label":"KD7", "x":8.75, "y":3}, {"label":"K37", "x":9.75, "y":3}, {"label":"KA2", "x":10.75, "y":3}, {"label":"KB2", "x":11.75, "y":3}, {"label":"KD2", "x":12.75, "y":3, "w":2.25}, {"label":"KE0", "x":15, "y":3}, {"label":"K01", "x":0, "y":4, "w":2.25}, {"label":"K11", "x":2.25, "y":4}, {"label":"K21", "x":3.25, "y":4}, {"label":"K31", "x":4.25, "y":4}, {"label":"K41", "x":5.25, "y":4}, {"label":"K51", "x":6.25, "y":4}, {"label":"K46", "x":7.25, "y":4}, {"label":"KE6", "x":8.25, "y":4}, {"label":"KE7", "x":9.25, "y":4}, {"label":"K47", "x":10.25, "y":4}, {"label":"KA1", "x":11.25, "y":4}, {"label":"KB1", "x":12.25, "y":4, "w":1.75}, {"label":"K86", "x":14, "y":4}, {"label":"K77", "x":15, "y":4}, {"label":"K00", "x":0, "y":5, "w":1.25}, {"label":"K10", "x":1.25, "y":5, "w":1.25}, {"label":"K20", "x":2.5, "y":5, "w":1.25}, {"label":"K56", "x":3.75, "y":5, "w":6.25}, {"label":"K57", "x":10, "y":5}, {"label":"KB0", "x":11, "y":5}, {"label":"KC0", "x":12, "y":5}, {"label":"K66", "x":13, "y":5}, {"label":"K76", "x":14, "y":5}, {"label":"K96", "x":15, "y":5}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,10 +15,10 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "bmini.h"
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
[0] = KEYMAP(
|
[0] = LAYOUT(
|
||||||
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_HOME,KC_END,
|
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_HOME,KC_END,
|
||||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSPC, KC_DEL,
|
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSPC, KC_DEL,
|
||||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,KC_BSLS, KC_INS,
|
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_INS,
|
||||||
@@ -26,7 +26,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT, KC_UP, KC_PGDN,
|
KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT, KC_UP, KC_PGDN,
|
||||||
KC_LCTL,KC_LALT,KC_LGUI, KC_SPC, KC_RGUI,KC_RALT,KC_RCTL,KC_LEFT,KC_DOWN,KC_RGHT
|
KC_LCTL,KC_LALT,KC_LGUI, KC_SPC, KC_RGUI,KC_RALT,KC_RCTL,KC_LEFT,KC_DOWN,KC_RGHT
|
||||||
),
|
),
|
||||||
[1] = KEYMAP(
|
[1] = LAYOUT(
|
||||||
KC_TRNS,RGB_TOG,RGB_MOD,RGB_HUI,RGB_SAI,RGB_VAI,RGB_HUD,RGB_SAD,RGB_VAD,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_END,
|
KC_TRNS,RGB_TOG,RGB_MOD,RGB_HUI,RGB_SAI,RGB_VAI,RGB_HUD,RGB_SAD,RGB_VAD,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_END,
|
||||||
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_DEL,
|
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_DEL,
|
||||||
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_INS,
|
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_INS,
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ B.mini
|
|||||||
|
|
||||||
A 75% keyboard with RGB
|
A 75% keyboard with RGB
|
||||||
|
|
||||||
Keyboard Maintainer: QMK Community
|
Keyboard Maintainer: QMK Community
|
||||||
Hardware Supported: B.mini PCB
|
Hardware Supported: B.mini PCB
|
||||||
Hardware Availability: http://winkeyless.kr/product/b-mini-x2-pcb/
|
Hardware Availability: http://winkeyless.kr/product/b-mini-x2-pcb/
|
||||||
|
|
||||||
Make example for this keyboard (after setting up your build environment):
|
Make example for this keyboard (after setting up your build environment):
|
||||||
|
|
||||||
|
|||||||
+40
-9
@@ -42,24 +42,55 @@ void backlight_init_ports(void) {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// for keyboard subdirectory level init functions
|
||||||
|
// @Override
|
||||||
|
void matrix_init_kb(void) {
|
||||||
|
// call user level keymaps, if any
|
||||||
|
matrix_init_user();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
extern rgblight_config_t rgblight_config;
|
extern rgblight_config_t rgblight_config;
|
||||||
|
|
||||||
|
// custom RGB driver
|
||||||
void rgblight_set(void) {
|
void rgblight_set(void) {
|
||||||
if (!rgblight_config.enable) {
|
if (!rgblight_config.enable) {
|
||||||
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
for (uint8_t i=0; i<RGBLED_NUM; i++) {
|
||||||
led[i].r = 0;
|
led[i].r = 0;
|
||||||
led[i].g = 0;
|
led[i].g = 0;
|
||||||
led[i].b = 0;
|
led[i].b = 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i2c_init();
|
||||||
|
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool rgb_init = false;
|
||||||
|
|
||||||
|
void matrix_scan_kb(void) {
|
||||||
|
// if LEDs were previously on before poweroff, turn them back on
|
||||||
|
if (rgb_init == false && rgblight_config.enable) {
|
||||||
i2c_init();
|
i2c_init();
|
||||||
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
|
||||||
|
rgb_init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
rgblight_task();
|
||||||
|
#else
|
||||||
|
void matrix_scan_kb(void) {
|
||||||
|
#endif
|
||||||
|
matrix_scan_user();
|
||||||
|
/* Nothing else for now. */
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__ ((weak))
|
__attribute__((weak)) // overridable
|
||||||
|
void matrix_init_user(void) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__attribute__((weak)) // overridable
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
rgblight_task();
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
#include "dhertz.h"
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
/* Layer 0: Default Layer
|
||||||
|
* ,---------------------------------------------------------------.
|
||||||
|
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Backsp|Del|
|
||||||
|
* |---------------------------------------------------------------|
|
||||||
|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Enter|Hom|
|
||||||
|
* |------------------------------------------------------` |---|
|
||||||
|
* |SrCtl | A| S| D| F| G| H| J| K| L| ;| '| \| |End|
|
||||||
|
* |---------------------------------------------------------------|
|
||||||
|
* |Shif| #| Z| X| C| V| B| N| M| ,| .| /|Shift |Up |PgD|
|
||||||
|
* |---------------------------------------------------------------|
|
||||||
|
* |NcCtl| Alt| CTab| LyrSpc | CGv| Alt|Lef|Dow|Rig|
|
||||||
|
* `---------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[0] = LAYOUT_iso(
|
||||||
|
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_DEL,
|
||||||
|
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_HOME,
|
||||||
|
SRCH_CTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_END,
|
||||||
|
KC_LSFT, HSH_TLD, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN,
|
||||||
|
NC_CTL, KC_LALT, CMD_TAB_CMD, LYR_SPC, CMD_GRV_CMD, KC_RALT, KC_LEFT, KC_DOWN, KC_RIGHT
|
||||||
|
),
|
||||||
|
/* Layer 1: Special
|
||||||
|
* ,---------------------------------------------------------------.
|
||||||
|
* | §| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| |Iso|
|
||||||
|
* |---------------------------------------------------------------|
|
||||||
|
* | | | | | | | | | | | | | | | |
|
||||||
|
* |------------------------------------------------------` |---|
|
||||||
|
* | | | | | | | | | |CSL| | | `| | |
|
||||||
|
* |---------------------------------------------------------------|
|
||||||
|
* | | `| | |CAC| | | | | | | | |PgU| |
|
||||||
|
* |---------------------------------------------------------------|
|
||||||
|
* | | | | | | |Hom|PgD|End|
|
||||||
|
* `---------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[1] = LAYOUT_iso(
|
||||||
|
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F10, KC_F11, KC_TRNS, ISO_COUNTRY_CODE,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, CMD_SFT_L, KC_TRNS, KC_TRNS, KC_NUBS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_NUBS, KC_TRNS, KC_TRNS, CMD_ALT_C, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDOWN, KC_END
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
|
void matrix_init_keymap(void) {
|
||||||
|
rgblight_enable_noeeprom();
|
||||||
|
rgblight_sethsv_teal();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t layer_state_set_keymap(uint32_t state) {
|
||||||
|
switch (biton32(state)) {
|
||||||
|
case 1:
|
||||||
|
rgblight_sethsv_noeeprom_magenta();
|
||||||
|
break;
|
||||||
|
default: // for any other layers, or the default layer
|
||||||
|
rgblight_sethsv_noeeprom_cyan();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
}
|
||||||
+19
-13
@@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
|
|
||||||
#ifndef DEBOUNCE
|
#ifndef DEBOUNCE
|
||||||
#define DEBOUNCE 5
|
# define DEBOUNCE 5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint8_t debouncing = DEBOUNCE;
|
static uint8_t debouncing = DEBOUNCE;
|
||||||
@@ -29,6 +29,9 @@ static uint8_t debouncing = DEBOUNCE;
|
|||||||
static matrix_row_t matrix[MATRIX_ROWS];
|
static matrix_row_t matrix[MATRIX_ROWS];
|
||||||
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||||
|
|
||||||
|
void matrix_set_row_status(uint8_t row);
|
||||||
|
uint8_t bit_reverse(uint8_t x);
|
||||||
|
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
// all outputs for rows high
|
// all outputs for rows high
|
||||||
DDRB = 0xFF;
|
DDRB = 0xFF;
|
||||||
@@ -47,18 +50,8 @@ void matrix_init(void) {
|
|||||||
matrix[row] = 0x00;
|
matrix[row] = 0x00;
|
||||||
matrix_debouncing[row] = 0x00;
|
matrix_debouncing[row] = 0x00;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_set_row_status(uint8_t row) {
|
matrix_init_quantum();
|
||||||
DDRB = (1 << row);
|
|
||||||
PORTB = ~(1 << row);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t bit_reverse(uint8_t x) {
|
|
||||||
x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
|
|
||||||
x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
|
|
||||||
x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
|
|
||||||
return x;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void) {
|
uint8_t matrix_scan(void) {
|
||||||
@@ -93,11 +86,24 @@ uint8_t matrix_scan(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
matrix_scan_user();
|
matrix_scan_quantum();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// declarations
|
||||||
|
void matrix_set_row_status(uint8_t row) {
|
||||||
|
DDRB = (1 << row);
|
||||||
|
PORTB = ~(1 << row);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t bit_reverse(uint8_t x) {
|
||||||
|
x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa);
|
||||||
|
x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc);
|
||||||
|
x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
inline matrix_row_t matrix_get_row(uint8_t row) {
|
inline matrix_row_t matrix_get_row(uint8_t row) {
|
||||||
return matrix[row];
|
return matrix[row];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
#define KEYMAP( \
|
#define LAYOUT_ortho_4x4( \
|
||||||
A1, A2, A3, A4, \
|
A1, A2, A3, A4, \
|
||||||
B1, B2, B3, B4, \
|
B1, B2, B3, B4, \
|
||||||
C1, C2, C3, C4, \
|
C1, C2, C3, C4, \
|
||||||
@@ -16,13 +16,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Used to create a keymap using only KC_ prefixed keys
|
// Used to create a keymap using only KC_ prefixed keys
|
||||||
#define KC_KEYMAP( \
|
#define LAYOUT_kc( \
|
||||||
A1, A2, A3, A4, \
|
A1, A2, A3, A4, \
|
||||||
B1, B2, B3, B4, \
|
B1, B2, B3, B4, \
|
||||||
C1, C2, C3, C4, \
|
C1, C2, C3, C4, \
|
||||||
D1, D2, D3, D4 \
|
D1, D2, D3, D4 \
|
||||||
) \
|
) \
|
||||||
KEYMAP( \
|
LAYOUT_ortho_4x4( \
|
||||||
KC_##A1, KC_##A2, KC_##A3, KC_##A4, \
|
KC_##A1, KC_##A2, KC_##A3, KC_##A4, \
|
||||||
KC_##B1, KC_##B2, KC_##B3, KC_##B4, \
|
KC_##B1, KC_##B2, KC_##B3, KC_##B4, \
|
||||||
KC_##C1, KC_##C2, KC_##C3, KC_##C4, \
|
KC_##C1, KC_##C2, KC_##C3, KC_##C4, \
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"keyboard_name": "Chocopad",
|
||||||
|
"url": "",
|
||||||
|
"maintainer": "qmk",
|
||||||
|
"width": 4,
|
||||||
|
"height": 4,
|
||||||
|
"layouts": {
|
||||||
|
"LAYOUT_ortho_4x4": {
|
||||||
|
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,61 +1,30 @@
|
|||||||
#include "chocopad.h"
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
#define _BASE 0
|
#define _BASE 0
|
||||||
#define _FN1 1
|
#define _FN1 1
|
||||||
#define _FN2 2
|
#define _FN2 2
|
||||||
|
|
||||||
#define KC_ KC_TRNS
|
|
||||||
#define _______ KC_TRNS
|
#define _______ KC_TRNS
|
||||||
|
|
||||||
#define KC_X1 MO(_FN1)
|
|
||||||
#define KC_X2 MO(_FN2)
|
|
||||||
#define KC_RST RESET
|
|
||||||
#define KC_BSTP BL_STEP
|
|
||||||
#define KC_RTOG RGB_TOG
|
|
||||||
#define KC_RMOD RGB_MOD
|
|
||||||
#define KC_RHUI RGB_HUI
|
|
||||||
#define KC_RHUD RGB_HUD
|
|
||||||
#define KC_RSAI RGB_SAI
|
|
||||||
#define KC_RSAD RGB_SAD
|
|
||||||
#define KC_RVAI RGB_VAI
|
|
||||||
#define KC_RVAD RGB_VAD
|
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
[_BASE] = KC_KEYMAP(
|
[_BASE] = LAYOUT_ortho_4x4(
|
||||||
//,----+----+----+----.
|
KC_PGUP, KC_HOME, KC_UP, KC_END , \
|
||||||
PGUP,HOME, UP ,END ,
|
KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, \
|
||||||
//|----+----+----+----|
|
MO(_FN2), KC_VOLU, KC_MPLY, KC_MPRV, \
|
||||||
PGDN,LEFT,DOWN,RGHT,
|
MO(_FN1), KC_VOLD, KC_MUTE, KC_MNXT \
|
||||||
//|----+----+----+----|
|
|
||||||
X2 ,VOLU,MPLY,MPRV,
|
|
||||||
//|----+----+----+----|
|
|
||||||
X1 ,VOLD,MUTE,MNXT
|
|
||||||
//`----+----+----+----'
|
|
||||||
),
|
),
|
||||||
|
[_FN1] = LAYOUT_ortho_4x4(
|
||||||
[_FN1] = KC_KEYMAP(
|
KC_ESC, KC_P7, KC_P8, KC_P9, \
|
||||||
//,----+----+----+----.
|
KC_TAB, KC_P4, KC_P5, KC_P6, \
|
||||||
ESC , P7 , P8 , P9 ,
|
KC_ENT, KC_P1, KC_P2, KC_P3, \
|
||||||
//|----+----+----+----|
|
_______, KC_P0, KC_P0, KC_DOT \
|
||||||
TAB , P4 , P5 , P6 ,
|
|
||||||
//|----+----+----+----|
|
|
||||||
ENT , P1 , P2 , P3 ,
|
|
||||||
//|----+----+----+----|
|
|
||||||
, P0 , P0 ,DOT
|
|
||||||
//`----+----+----+----'
|
|
||||||
),
|
),
|
||||||
|
[_FN2] = LAYOUT_ortho_4x4(
|
||||||
[_FN2] = KC_KEYMAP(
|
RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, \
|
||||||
//,----+----+----+----.
|
RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, \
|
||||||
RTOG,RHUI,RSAI,RVAI,
|
_______, _______, _______, RESET, \
|
||||||
//|----+----+----+----|
|
BL_STEP, _______, _______, _______ \
|
||||||
RMOD,RHUD,RSAD,RVAD,
|
|
||||||
//|----+----+----+----|
|
|
||||||
, , ,RST ,
|
|
||||||
//|----+----+----+----|
|
|
||||||
BSTP, , ,
|
|
||||||
//`----+----+----+----'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -54,3 +54,5 @@ NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https:/
|
|||||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
AUDIO_ENABLE = no
|
AUDIO_ENABLE = no
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
|
|
||||||
|
LAYOUTS = ortho_4x4
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
|
|
||||||
#define KEYMAP( \
|
#define LAYOUT( \
|
||||||
k00, k01, k02, k03, k04, k05 \
|
k00, k01, k02, k03, k04, k05 \
|
||||||
) \
|
) \
|
||||||
{ \
|
{ \
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
{
|
{
|
||||||
"keyboard_name": "Christmas Tree",
|
"keyboard_name": "Christmas Tree",
|
||||||
"keyboard_folder": "christmas_tree",
|
"keyboard_folder": "christmas_tree",
|
||||||
"url": "https://www.reddit.com/r/MechanicalKeyboards/comments/7cqxpf/gb_christmas_tree_pcb_gb_now_live/",
|
"url": "https://www.reddit.com/r/MechanicalKeyboards/comments/7cqxpf/gb_christmas_tree_pcb_gb_now_live/",
|
||||||
"maintainer": "That-Canadian",
|
"maintainer": "That-Canadian",
|
||||||
"width": 3,
|
"width": 3,
|
||||||
"height": 3,
|
"height": 3,
|
||||||
"layouts": {
|
"layouts": {
|
||||||
"2017": {
|
"2017": {
|
||||||
"key_count": 6
|
"key_count": 6,
|
||||||
}
|
"layout": [{"x":1, "y":0}, {"x":0.5, "y":1}, {"x":1.5, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "christmas_tree.h"
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
extern keymap_config_t keymap_config;
|
extern keymap_config_t keymap_config;
|
||||||
|
|
||||||
@@ -32,27 +32,35 @@ enum custom_keycodes {
|
|||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
/* Base
|
/* Base
|
||||||
* ,------.
|
* ,------.
|
||||||
* | 1 |
|
* | 1 |
|
||||||
* ,------+------.
|
* ,------+------.
|
||||||
* | 2 | 3 |
|
* | 2 | 3 |
|
||||||
* ,------+------+------.
|
* ,------+------+------.
|
||||||
* | 4 | FUNC | 6 |
|
* | 4 | FUNC | 6 |
|
||||||
* `--------------------'
|
* `--------------------'
|
||||||
*/
|
*/
|
||||||
[_BASE] = KEYMAP(KC_1, KC_2, KC_3, KC_4, MO(_FUNC), KC_6),
|
[_BASE] = LAYOUT(
|
||||||
|
KC_1,
|
||||||
|
KC_2, KC_3,
|
||||||
|
KC_4, MO(_FUNC), KC_6
|
||||||
|
),
|
||||||
|
|
||||||
/* Func
|
/* Func
|
||||||
* ,------.
|
* ,------.
|
||||||
* |BCKLIT|
|
* |BCKLIT|
|
||||||
* ,------+------.
|
* ,------+------.
|
||||||
* | 8 | 9 |
|
* | 8 | 9 |
|
||||||
* ,------+------+------.
|
* ,------+------+------.
|
||||||
* | 0 | FUNC | RESET|
|
* | 0 | FUNC | RESET|
|
||||||
* `--------------------'
|
* `--------------------'
|
||||||
*/
|
*/
|
||||||
[_FUNC] = KEYMAP(BACKLIT, KC_8, KC_9, KC_0, _______, RESET)
|
[_FUNC] = LAYOUT(
|
||||||
|
BACKLIT,
|
||||||
|
KC_8, KC_9,
|
||||||
|
KC_0, _______, RESET
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#include "../../config.h"
|
||||||
|
|
||||||
|
// Sets good default for the speed of the mouse.
|
||||||
|
#undef MOUSEKEY_INTERVAL
|
||||||
|
#undef MOUSEKEY_DELAY
|
||||||
|
#undef MOUSEKEY_TIME_TO_MAX
|
||||||
|
#undef MOUSEKEY_MAX_SPEED
|
||||||
|
|
||||||
|
#define MOUSEKEY_INTERVAL 20
|
||||||
|
#define MOUSEKEY_DELAY 100
|
||||||
|
#define MOUSEKEY_TIME_TO_MAX 60
|
||||||
|
#define MOUSEKEY_MAX_SPEED 7
|
||||||
|
|
||||||
|
#undef MOUSEKEY_WHEEL_MAX_SPEED
|
||||||
|
#undef MOUSEKEY_WHEEL_TIME_TO_MAX
|
||||||
|
#undef MOUSEKEY_WHEEL_DELAY
|
||||||
|
|
||||||
|
#define MOUSEKEY_WHEEL_MAX_SPEED 5
|
||||||
|
#define MOUSEKEY_WHEEL_TIME_TO_MAX 60
|
||||||
|
#define MOUSEKEY_WHEEL_DELAY 100
|
||||||
|
|
||||||
|
#undef TAPPING_TOGGLE
|
||||||
|
#undef TAPPING_TERM
|
||||||
|
#undef IGNORE_MOD_TAP_INTERRUPT
|
||||||
|
|
||||||
|
#define TAPPING_TOGGLE 1
|
||||||
|
#define TAPPING_TERM 150
|
||||||
|
#define IGNORE_MOD_TAP_INTERRUPT
|
||||||
@@ -0,0 +1,234 @@
|
|||||||
|
// An Ergodox EZ keymap mostly following the programmer's dvorak layout.
|
||||||
|
// There is a standard QWERTY layer as well
|
||||||
|
//
|
||||||
|
// See the README.md file for an image of this keymap.
|
||||||
|
|
||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
// The layers that we are defining for this keyboards.
|
||||||
|
#define BASE 0
|
||||||
|
#define NUM 1
|
||||||
|
#define QWERTY 2
|
||||||
|
#define MAC 3
|
||||||
|
|
||||||
|
// The Tap Dance identifiers, used in the TD keycode and tap_dance_actions array.
|
||||||
|
#define TAP_MACRO 0
|
||||||
|
|
||||||
|
// SAFE_RANGE must be used to tag the first element of the enum.
|
||||||
|
// DYNAMIC_MACRO_RANGE must always be the last element of the enum if other
|
||||||
|
// values are added (as its value is used to create a couple of other keycodes
|
||||||
|
// after it).
|
||||||
|
enum custom_keycodes {
|
||||||
|
MC_ARROW = SAFE_RANGE,
|
||||||
|
DYNAMIC_MACRO_RANGE
|
||||||
|
};
|
||||||
|
|
||||||
|
// A 'transparent' key code (that falls back to the layers below it).
|
||||||
|
#define ___ KC_TRANSPARENT
|
||||||
|
|
||||||
|
// A 'blocking' key code. Does nothing but prevent falling back to another layer.
|
||||||
|
#define XXX KC_NO
|
||||||
|
|
||||||
|
// Some combined keys (one normal keycode when tapped and one modifier or layer
|
||||||
|
// toggle when held).
|
||||||
|
#define SPC_RALT MT(MOD_RALT, KC_SPC) // SPACE key and right alt modifier.
|
||||||
|
|
||||||
|
// The most portable copy/paste keys (windows (mostly), linux, and some terminal emulators).
|
||||||
|
#define MK_CUT LSFT(KC_DEL) // shift + delete
|
||||||
|
#define MK_COPY LCTL(KC_INS) // ctrl + insert
|
||||||
|
#define MK_PASTE LSFT(KC_INS) // shift + insert
|
||||||
|
//Move mac desktop spaces
|
||||||
|
#define MAC_L LGUI(LSFT(KC_UP)) // cmd + shift + up
|
||||||
|
#define MAC_R LGUI(LSFT(KC_DOWN)) // cmd + shift + down
|
||||||
|
|
||||||
|
// This file must be included after DYNAMIC_MACRO_RANGE is defined...
|
||||||
|
#include "dynamic_macro.h"
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
// Layer 0: basic keys.
|
||||||
|
[BASE] = LAYOUT_ergodox_pretty(
|
||||||
|
KC_DLR, KC_AMPR, KC_LBRC, KC_LCBR, KC_RCBR, KC_LPRN, KC_CIRC, KC_F4, KC_EQUAL,KC_ASTR, KC_BSLASH, KC_PLUS, KC_RBRACKET, KC_EXLM,
|
||||||
|
GUI_T(KC_BSLASH), KC_SCOLON,KC_COMMA, KC_DOT, KC_P, KC_Y, KC_PERC, KC_DELETE, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLASH,
|
||||||
|
MO(NUM), KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINUS,
|
||||||
|
KC_LSPO, KC_QUOTE, KC_Q, KC_J, KC_K, KC_X, KC_LALT, TD(TAP_MACRO),KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSPC,
|
||||||
|
KC_AT, KC_HASH, KC_GRAVE, KC_LEFT, KC_RIGHT, KC_UP, KC_DOWN, KC_HOME, KC_END, TO(QWERTY),
|
||||||
|
ALT_T(KC_APPLICATION), ALL_T(KC_NO), KC_PGUP, KC_LGUI,
|
||||||
|
KC_BSLASH, TO(MAC),
|
||||||
|
KC_ENTER, KC_TAB, CTL_T(KC_ESCAPE), CTL_T(KC_ESCAPE), KC_BSPACE, KC_SPACE),
|
||||||
|
|
||||||
|
// Layer 1: function and numpad keys.
|
||||||
|
[NUM] = LAYOUT_ergodox_pretty(
|
||||||
|
___, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, ___, ___, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
|
||||||
|
___, KC_EXLM, KC_COMMA, KC_DOT, KC_MS_BTN1, KC_MS_BTN2, ___, ___, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
|
||||||
|
XXX, ___, KC_LCBR, KC_RCBR, MC_ARROW, KC_GRAVE, KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_UNDS,
|
||||||
|
___, ___, KC_CIRC, KC_LBRACKET, KC_RBRACKET, KC_TILD, ___, ___, KC_0, KC_1, KC_2, KC_3, KC_KP_SLASH, KC_BSLASH,
|
||||||
|
___, ___, ___, ___, ___, ___, KC_0, KC_KP_DOT, KC_EQUAL, ___,
|
||||||
|
___, ___, KC_KP_ASTERISK, KC_KP_SLASH,
|
||||||
|
KC_LCTL, ___,
|
||||||
|
KC_KP_PLUS, KC_KP_MINUS, KC_DLR, KC_DELETE, KC_BSPACE, KC_SPACE),
|
||||||
|
|
||||||
|
// Layer 2: QWERTY control.
|
||||||
|
[QWERTY] = LAYOUT_ergodox_pretty(
|
||||||
|
/* left hand */
|
||||||
|
KC_EQUAL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, KC_RIGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS,
|
||||||
|
KC_DELETE, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, TO(BASE), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLASH,
|
||||||
|
MO(NUM), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, GUI_T(KC_QUOT),
|
||||||
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, ALT_T(KC_NO), MEH_T(KC_NO), KC_N, KC_M, KC_COMMA, KC_DOT, KC_SLASH, KC_RSPC,
|
||||||
|
KC_GRAVE, KC_QUOTE, LALT(KC_TAB), KC_LEFT, KC_RIGHT, KC_UP, KC_DOWN, KC_LBRACKET, KC_RBRACKET, TO(BASE),
|
||||||
|
___, KC_LGUI, ___, KC_ESCAPE,
|
||||||
|
KC_HOME, KC_PGUP,
|
||||||
|
KC_ENTER, KC_TAB, KC_END, KC_PGDOWN, KC_BSPACE, KC_SPACE),
|
||||||
|
|
||||||
|
// Layer 3: Mac layer
|
||||||
|
[MAC] = LAYOUT_ergodox_pretty(
|
||||||
|
/* left hand */
|
||||||
|
___, KC_1, KC_2, KC_3, KC_4, KC_5, ___, ___, KC_6, KC_7, KC_8, KC_9, KC_0, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, MAC_L, MAC_R, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___,
|
||||||
|
___, TO(BASE),
|
||||||
|
KC_LGUI, KC_LALT, KC_LGUI, KC_LGUI, KC_LALT, KC_LGUI),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Whether the macro 1 is currently being recorded.
|
||||||
|
static bool is_macro1_recording = false;
|
||||||
|
|
||||||
|
// The current set of active layers (as a bitmask).
|
||||||
|
// There is a global 'layer_state' variable but it is set after the call
|
||||||
|
// to layer_state_set_user().
|
||||||
|
static uint32_t current_layer_state = 0;
|
||||||
|
uint32_t layer_state_set_user(uint32_t state);
|
||||||
|
|
||||||
|
// Method called at the end of the tap dance on the TAP_MACRO key. That key is
|
||||||
|
// used to start recording a macro (double tap or more), to stop recording (any
|
||||||
|
// number of tap), or to play the recorded macro (1 tap).
|
||||||
|
void macro_tapdance_fn(qk_tap_dance_state_t *state, void *user_data) {
|
||||||
|
uint16_t keycode;
|
||||||
|
keyrecord_t record;
|
||||||
|
dprintf("macro_tap_dance_fn %d\n", state->count);
|
||||||
|
if (is_macro1_recording) {
|
||||||
|
keycode = DYN_REC_STOP;
|
||||||
|
is_macro1_recording = false;
|
||||||
|
layer_state_set_user(current_layer_state);
|
||||||
|
} else if (state->count == 1) {
|
||||||
|
keycode = DYN_MACRO_PLAY1;
|
||||||
|
} else {
|
||||||
|
keycode = DYN_REC_START1;
|
||||||
|
is_macro1_recording = true;
|
||||||
|
layer_state_set_user(current_layer_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
record.event.pressed = true;
|
||||||
|
process_record_dynamic_macro(keycode, &record);
|
||||||
|
record.event.pressed = false;
|
||||||
|
process_record_dynamic_macro(keycode, &record);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The definition of the tap dance actions:
|
||||||
|
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||||
|
// This Tap dance plays the macro 1 on TAP and records it on double tap.
|
||||||
|
[TAP_MACRO] = ACTION_TAP_DANCE_FN(macro_tapdance_fn)
|
||||||
|
};
|
||||||
|
|
||||||
|
// Runs for each key down or up event.
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
if (keycode != TD(TAP_MACRO)) {
|
||||||
|
// That key is processed by the macro_tapdance_fn. Not ignoring it here is
|
||||||
|
// mostly a no-op except that it is recorded in the macros (and uses space).
|
||||||
|
// We can't just return false when the key is a tap dance, because
|
||||||
|
// process_record_user, is called before the tap dance processing (and
|
||||||
|
// returning false would eat the tap dance).
|
||||||
|
if (!process_record_dynamic_macro(keycode, record)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(record->event.pressed) {
|
||||||
|
switch(keycode) {
|
||||||
|
case MC_ARROW:
|
||||||
|
SEND_STRING("=>");
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true; // Let QMK send the enter press/release events
|
||||||
|
}
|
||||||
|
|
||||||
|
// Runs just one time when the keyboard initializes.
|
||||||
|
void matrix_init_user(void) {
|
||||||
|
ergodox_right_led_1_off();
|
||||||
|
ergodox_right_led_2_off();
|
||||||
|
ergodox_right_led_3_off();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Runs constantly in the background, in a loop.
|
||||||
|
void matrix_scan_user(void) {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// Value to use to switch LEDs on. The default value of 255 is far too bright.
|
||||||
|
static const uint8_t max_led_value = 20;
|
||||||
|
|
||||||
|
// Whether the given layer (one of the constant defined at the top) is active.
|
||||||
|
#define LAYER_ON(layer) (current_layer_state & (1<<layer))
|
||||||
|
|
||||||
|
void led_1_on(void) {
|
||||||
|
ergodox_right_led_1_on();
|
||||||
|
ergodox_right_led_1_set(max_led_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void led_2_on(void) {
|
||||||
|
ergodox_right_led_2_on();
|
||||||
|
ergodox_right_led_2_set(max_led_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void led_3_on(void) {
|
||||||
|
ergodox_right_led_3_on();
|
||||||
|
ergodox_right_led_3_set(max_led_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void led_1_off(void) {
|
||||||
|
ergodox_right_led_1_off();
|
||||||
|
}
|
||||||
|
|
||||||
|
void led_2_off(void) {
|
||||||
|
ergodox_right_led_2_off();
|
||||||
|
}
|
||||||
|
|
||||||
|
void led_3_off(void) {
|
||||||
|
ergodox_right_led_3_off();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t layer_state_set_user(uint32_t state) {
|
||||||
|
current_layer_state = state;
|
||||||
|
|
||||||
|
if (is_macro1_recording) {
|
||||||
|
led_1_on();
|
||||||
|
led_2_on();
|
||||||
|
led_3_on();
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LAYER_ON(NUM)) {
|
||||||
|
led_1_on();
|
||||||
|
} else {
|
||||||
|
led_1_off();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LAYER_ON(MAC)) {
|
||||||
|
led_2_on();
|
||||||
|
} else {
|
||||||
|
led_2_off();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LAYER_ON(QWERTY)) {
|
||||||
|
led_3_on();
|
||||||
|
} else {
|
||||||
|
led_3_off();
|
||||||
|
}
|
||||||
|
|
||||||
|
return state;
|
||||||
|
};
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Ergodox EZ Layout by bpruitt-goddard
|
||||||
|

|
||||||
|
|
||||||
|
[KLE link](http://www.keyboard-layout-editor.com/#/gists/5896c5a729a64633d3f63de71e7e0e79)
|
||||||
|
|
||||||
|
## Layers
|
||||||
|
| Layer | Legend |
|
||||||
|
| ----- | ------ |
|
||||||
|
| Base | Top (black) |
|
||||||
|
| Num | Center (blue) |
|
||||||
|
| QWERTY | Bottom (Red) |
|
||||||
|
| MAC | Front/Bottom-most (Yellow) |
|
||||||
|
|
||||||
|
## Features
|
||||||
|
* Tap-dance dynamic macro key.
|
||||||
|
* Tap twice for starting macro. Then tap once to complete the macro
|
||||||
|
* Tap one for replaying macro
|
||||||
|
* Numpad on right hand with momentary Num layer
|
||||||
|
* QWERTY layer for non-dvorak users
|
||||||
|
* Mac layer for changing thumbpad modifier keys with Command
|
||||||
|
* Uses the following dual function keys
|
||||||
|
* Space Cadet shifts (shift/paren)
|
||||||
|
* Ctrl/Esc
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||||
|
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||||
|
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
|
NKRO_ENABLE = yes # USB Nkey Rollover - for issues, see github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
|
ONEHAND_ENABLE = yes # Allow swapping hands of keyboard
|
||||||
|
KEY_LOCK_ENABLE = yes # Enable the KC_LOCK key
|
||||||
|
TAP_DANCE_ENABLE = yes # Enable the tap dance feature.
|
||||||
|
CONSOLE_ENABLE = yes # Console for debug
|
||||||
|
|
||||||
|
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
|
||||||
|
UNICODE_ENABLE = no
|
||||||
|
SLEEP_LED_ENABLE = no
|
||||||
|
API_SYSEX_ENABLE = no
|
||||||
|
RGBLIGHT_ENABLE = no
|
||||||
|
RGBLIGHT_ANIMATION = no
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2018 Daniel Gordon <[email protected]>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PREVENT_STUCK_MODIFIERS
|
||||||
|
|
||||||
|
#undef IGNORE_MOD_TAP_INTERRUPT
|
||||||
|
#define IGNORE_MOD_TAP_INTERRUPT
|
||||||
|
|
||||||
|
#undef PERMISSIVE_HOLD
|
||||||
|
// #define PERMISSIVE_HOLD
|
||||||
|
|
||||||
|
#define ONESHOT_TAP_TOGGLE 2
|
||||||
|
|
||||||
|
#undef TAPPING_TERM
|
||||||
|
#define TAPPING_TERM 200
|
||||||
|
|
||||||
|
#define FORCE_NKRO
|
||||||
@@ -10,16 +10,6 @@
|
|||||||
#include "keymap_nordic.h"
|
#include "keymap_nordic.h"
|
||||||
|
|
||||||
|
|
||||||
#define TLSLSH M(TIL_SLASH)
|
|
||||||
#define F1_F13 TD(F1F13)
|
|
||||||
#define F2_F14 TD(F2F14)
|
|
||||||
#define F5_F15 TD(F5F15)
|
|
||||||
#define F4_ALTF4 TD(ALTF4)
|
|
||||||
#define END_ESC TD(ENDESC)
|
|
||||||
#define SHF6_AF7 TD(F6F7)
|
|
||||||
#define F12_RUN TD(F12ETAPS)
|
|
||||||
#define COMMA_TD TD(COMMA)
|
|
||||||
|
|
||||||
enum custom_keycodes {
|
enum custom_keycodes {
|
||||||
PLACEHOLDER = SAFE_RANGE, // can always be here
|
PLACEHOLDER = SAFE_RANGE, // can always be here
|
||||||
EPRM,
|
EPRM,
|
||||||
@@ -27,129 +17,94 @@ enum custom_keycodes {
|
|||||||
RGB_SLD,
|
RGB_SLD,
|
||||||
};
|
};
|
||||||
|
|
||||||
//Tap dance enums
|
|
||||||
enum {
|
|
||||||
F12TAP = 0,
|
|
||||||
F12ETAPS,
|
|
||||||
CALCCOMP,
|
|
||||||
REFRESH, //send R, or Control+R if double tapped.
|
|
||||||
ENDESC,
|
|
||||||
XESC, //'quad function'. x, control, escape, alt
|
|
||||||
ALY2, //'quad function': a, Hyper, ctrl+a, layer 2
|
|
||||||
PRLOCK,
|
|
||||||
F6F7, // Shift F6 or Alt F7
|
|
||||||
TABCOMBO,
|
|
||||||
FCTRL,
|
|
||||||
F3D,
|
|
||||||
ALTF4,
|
|
||||||
COMMA,
|
|
||||||
AT,
|
|
||||||
HTAB,
|
|
||||||
F1F13,
|
|
||||||
F2F14,
|
|
||||||
F5F15
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Custom tapping terms for each key.
|
// Custom tapping terms for each key.
|
||||||
// Requires changes to action_taping.c
|
// Requires changes to action_taping.c
|
||||||
/* uint16_t get_tapping_term(keyevent_t* event) {
|
// uint16_t get_tapping_term(keyevent_t* event) {
|
||||||
uint16_t keycode = keymap_key_to_keycode(layer_switch_get_layer(event->key), event->key);
|
// uint16_t keycode = keymap_key_to_keycode(layer_switch_get_layer(event->key), event->key);
|
||||||
if (keycode == LT(3,KC_E) ) {
|
// if (keycode == NAV_E ) {
|
||||||
return TAPPING_TERM + 50;
|
// return TAPPING_TERM + 50;
|
||||||
}
|
// }
|
||||||
return TAPPING_TERM;
|
// return TAPPING_TERM;
|
||||||
} */
|
// }
|
||||||
|
|
||||||
|
|
||||||
// Tap Dance Definitions
|
// _XXXXXX_ is a symbol that means, "DO NOT ASSIGN THIS KEY TO ANTYING", because the key
|
||||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
// underneath this layer is the key that sends you to/from this layer.
|
||||||
// simple tap dance
|
// Meaning, if you were to put something here - then you will be stuck in this layer.
|
||||||
[F12ETAPS] = ACTION_TAP_DANCE_DOUBLE(KC_F12,LSFT(LCTL(KC_F10))),
|
// It is simply a visual reminder not to use that key for this layer.
|
||||||
[REFRESH] = ACTION_TAP_DANCE_DOUBLE(KC_R,LCTL(KC_R)),
|
// Example: On the numpad layer, under the letter `D` is `_XXXXXXX_`, because pressing and holding
|
||||||
[ENDESC] = ACTION_TAP_DANCE_DOUBLE(KC_END, KC_ESC),
|
// `D` sends you to the numpad layer
|
||||||
[CALCCOMP] = ACTION_TAP_DANCE_DOUBLE(KC_CALCULATOR, KC_MY_COMPUTER),
|
|
||||||
[ALTF4] = ACTION_TAP_DANCE_DOUBLE(KC_F4,LALT(KC_F4)),
|
|
||||||
[F6F7] = ACTION_TAP_DANCE_DOUBLE(LSFT(KC_F6), LALT(KC_F7)),
|
|
||||||
[F1F13] = ACTION_TAP_DANCE_DOUBLE(KC_F1, KC_F13),
|
|
||||||
[F2F14] = ACTION_TAP_DANCE_DOUBLE(KC_F2, KC_F14),
|
|
||||||
[F5F15] = ACTION_TAP_DANCE_DOUBLE(KC_F5, KC_F15),
|
|
||||||
[TABCOMBO] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tab_finished, tab_reset),
|
|
||||||
[F3D] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, bt_finished, bt_reset),
|
|
||||||
[COMMA] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, comma_finished, comma_reset),
|
|
||||||
[HTAB] = ACTION_TAP_DANCE_FN_ADVANCED(NULL,h_finished, h_reset)
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
|
||||||
//**************************FIRST LAYER - LAYER ZERO **************************************
|
//**************************FIRST LAYER - LAYER ZERO **************************************
|
||||||
[_QWERTY] = KEYMAP(
|
[_QWERTY] = KEYMAP(
|
||||||
|
|
||||||
SHF6_AF7, F1_F13, F2_F14, TD(F3D), F4_ALTF4, F5_F15, KC_F11,
|
SHF6_AF7, F1_F13 , F2_F14, TD(F3D), F4_ALTF4, F5_F15, KC_F11,
|
||||||
________, KC_Q, CTR_SH_W, NAV_E, CTR_AL_R, KC_T, PRINTSCR,
|
SPRK_TCK , Q_ESC , CTR_SH_W, NAV_E, ALT_SH_R, KC_T, PRINTSCR,
|
||||||
KC_TAB, KC_A, MEH_S, NUMPAD_D, CTRL_F, WIN_G,
|
KC_TAB , KC_A , MEH_S, NUMPAD_D, CTRL_F, WIN_G,
|
||||||
ALT_SHFT, CTRL_Z, HYPER_X, MOUSE_C, ALT_V, KC_B, TT(_MOUSE),
|
OSL(_ONESHOT), CTRL_Z , HYPER_X, MOUSE_C, ALT_V, KC_B, OSL(_MOUSE),
|
||||||
KC_MINUS, KC_GRAVE, KC_DELETE, KC_LEFT, KC_RIGHT,
|
KC_MINUS, KC_GRAVE, KC_DELETE, KC_LEFT, KC_RIGHT,
|
||||||
|
|
||||||
KC_INSERT, KC_DELETE,
|
LSFT(KC_INSERT), TT(_QWERTY_KIDS),
|
||||||
ALT_HOME,
|
________ ,
|
||||||
KC_LSHIFT, SYMB_BSP, END_ESC,
|
KC_LSHIFT, SYMB_BSP, KC_INSERT ,
|
||||||
|
|
||||||
F12_RUN, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, TD(CALCCOMP),
|
F12_RUN, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, TD(CALCCOMP),
|
||||||
________, KC_Y, KC_U, KC_I, KC_O, KC_P, ________,
|
CALTDEL , KC_Y, KC_U, KC_I, KC_O, KC_P, MODRESET,
|
||||||
WIN_H, CTRL_J, KC_K, MEH_L, COL_MOUS, ________,
|
WIN_H, CTRL_J, APP_SW_K, MEH_L, COL_MOUS, END_HOME,
|
||||||
KC_LEAD, KC_N, ALT_M, COMMA_TD, HYPE_DOT, KC_SLASH, TD(TABCOMBO),
|
OSL(_ONESHOT), KC_N, ALT_M, COMMA_TD, HYPE_DOT, KC_SLASH, ID_MAN_IP,
|
||||||
KC_UP, KC_DOWN, KC_ESC, KC_TILD, KC_UNDS,
|
KC_UP, KC_DOWN,KC_DELETE, KC_TILD, KC_UNDS,
|
||||||
|
|
||||||
KC_ESCAPE, KC_DELETE,
|
TT(_STREET_FIGHTER), ________,
|
||||||
ALT_T(KC_PGUP),
|
KC_PGUP,
|
||||||
RCTL_T(KC_PGDOWN), LT(_NAV,KC_ENTER), SPAC_SYM),
|
KC_PGDOWN, LT(_NAV,KC_ENTER), SPAC_TXT),
|
||||||
|
|
||||||
|
|
||||||
//**************************SYMBOLS LAYER**************************
|
//**************************SYMBOLS LAYER**************************
|
||||||
[_SYMBOLS] = KEYMAP(
|
[_SYMBOLS] = KEYMAP(
|
||||||
________, ________, ________, ________, ________, ________, ________,
|
________, ________, ________, ________, ________, ________, ________,
|
||||||
________, TLSLSH, KC_AT, KC_LCBR, KC_RCBR, KC_CIRC, ________,
|
________, DEREF , KC_AT, KC_LCBR, KC_RCBR, KC_CIRC, ________,
|
||||||
________, KC_EXLM, KC_PIPE, KC_LPRN, KC_RPRN, M(DEREF),
|
________, KC_EXLM, KC_HASH, KC_LPRN, KC_RPRN, ________,
|
||||||
________,KC_DOLLAR, KC_PERC, LSQUIGLY, RSQUIGLY, ________, ________,
|
________,KC_DOLLAR, KC_PERC, LSQUIGLY, RSQUIGLY, ________, ________,
|
||||||
________, M(TICK3), ________, ________, ________,
|
________,TICK3 , ________, ________, ________,
|
||||||
|
|
||||||
________,________,
|
________,________,
|
||||||
________,
|
________,
|
||||||
________,________,________,
|
________,_XXXXXX_,________,
|
||||||
|
|
||||||
|
|
||||||
________, ________, ________, ________, ________, ________, NUMLOCK,
|
________, ________, ________, ________, ________, ________, NUMLOCK,
|
||||||
________, TLSLSH, KC_PIPE, KC_PLUS, KC_AMPR, ________, CAPLOCK,
|
________,TIL_SLASH, KC_PIPE, KC_PLUS, KC_AMPR, ________, CAPLOCK,
|
||||||
M(EQRIGHT), KC_DQUO, KC_EQUAL, KC_QUOTE,KC_SCOLON, ________,
|
EQRIGHT, KC_DQUO, KC_EQUAL, KC_QUOTE,KC_SCOLON, ________,
|
||||||
________, KC_PIPE, BK_SLASH, ASTERSK, KC_DOT, KC_SLASH, ________,
|
________, KC_M, BK_SLASH, ASTERSK, KC_DOT, KC_SLASH, ________,
|
||||||
________,________,________,M(TILD3),________,
|
________,________ ,________,TILD3,________,
|
||||||
________,________,
|
________,________,
|
||||||
________,
|
________,
|
||||||
________,________,________),
|
________,________,_XXXXXX_),
|
||||||
|
|
||||||
//**************************MOUSE MOVEMENT LAYER**************************
|
//**************************MOUSE MOVEMENT LAYER**************************
|
||||||
[_MOUSE] = KEYMAP(RESET,________,________,________,________,________,________,
|
[_MOUSE] = KEYMAP(UP_ENTER_RESET,________,________,________,________,________,MODRESET,
|
||||||
RESET,________,________,KC_MS_UP,________,KC_MS_WH_UP,CALTDEL,
|
RESET,KC_SECRET_5,________,KC_MS_UP,KC_SECRET_4,KC_MS_WH_UP,________,
|
||||||
________,________,KC_MS_LEFT,KC_MS_DOWN,KC_MS_RIGHT,KC_MS_WH_DOWN,
|
________,________,KC_MS_LEFT,KC_MS_DOWN,KC_MS_RIGHT,KC_MS_WH_DOWN,
|
||||||
KC_SECRET_1,________,HYPR(KC_F13),________,HYPR(KC_F14),KC_SECRET_2,________,
|
KC_SECRET_5,KC_SECRET_4,KC_SECRET_3,_XXXXXX_,KC_SECRET_2,KC_SECRET_1,_XXXXXX_,
|
||||||
________,________,HYPR(KC_F15),KC_MS_WH_LEFT,KC_MS_WH_RIGHT,
|
________,________,HYPR(KC_F15),KC_MS_WH_LEFT,KC_MS_WH_RIGHT,
|
||||||
|
|
||||||
________,________,
|
________,________,
|
||||||
________,
|
________,
|
||||||
KC_MS_BTN1,KC_MS_BTN2,________,
|
KC_MS_BTN1,KC_MS_BTN2,________,
|
||||||
|
|
||||||
|
|
||||||
________,________,________,________,________,________,________,
|
________,________,________,________,________,________,________,
|
||||||
KC_MS_WH_UP,________,________,KC_UP,________,________,________,
|
________,________,________,KC_UP,________,KC_MEDIA_PLAY_PAUSE,________,
|
||||||
________,KC_LEFT,KC_DOWN,KC_RIGHT,________,________,
|
________,KC_LEFT,KC_DOWN,KC_RIGHT,_XXXXXX_,________,
|
||||||
KC_MS_WH_DOWN,________,KC_PGUP,KC_PGDOWN,KC_MEDIA_NEXT_TRACK,________,________,
|
________,KC_MEDIA_NEXT_TRACK,KC_AUDIO_VOL_UP,KC_AUDIO_VOL_DOWN,KC_MUTE,________,________,
|
||||||
KC_AUDIO_VOL_UP,KC_AUDIO_VOL_DOWN,KC_AUDIO_MUTE,KC_MEDIA_PLAY_PAUSE,________,
|
KC_MS_WH_UP,KC_MS_WH_DOWN,________,________,________,
|
||||||
________,________,
|
________,________,
|
||||||
________,
|
________,
|
||||||
________,________,KC_WWW_BACK),
|
________,KC_WWW_BACK,KC_WWW_FORWARD),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -157,23 +112,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
//**************************WINDOWS NAVIGATION LAYER**************************
|
//**************************WINDOWS NAVIGATION LAYER**************************
|
||||||
|
|
||||||
[_NAV] = KEYMAP(________,________,________,________,________,________,________,
|
[_NAV] = KEYMAP(________,________,________,________,________,________,________,
|
||||||
________,________,SNAPLEFT,________,SNAPRGHT,LALT(KC_LEFT),________,
|
________,________,SNAPLEFT,_XXXXXX_,SNAPRGHT,________,________,
|
||||||
________,LCTL(KC_W),PREVTAB,LGUI(KC_D),NEXTTAB,________,
|
________,KC_WWW_BACK,PREVTAB,________,NEXTTAB,SNAPUP,
|
||||||
________,________,WORKLEFT,________,WORKRIGHT,________,________,
|
________,________,WORKLEFT,________,WORKRIGHT,SNAPDOWN,________,
|
||||||
________,________,________,________,________,
|
________,________,________,________,________,
|
||||||
|
|
||||||
________,________,
|
________,________,
|
||||||
________,
|
________,
|
||||||
________,________,________,
|
________,________,________,
|
||||||
|
|
||||||
|
|
||||||
________,________,________,________,________,________,________,
|
________,________,________,________,________,________,________,
|
||||||
________,________,SNAPUP ,KC_UP ,SNAPDOWN,________,________,
|
________,________,SNAPUP ,KC_UP ,SNAPDOWN,________,________,
|
||||||
________,KC_LEFT ,KC_DOWN ,KC_RIGHT,________,________,
|
________,KC_LEFT ,KC_DOWN ,KC_RIGHT,________,________,
|
||||||
________,________,________,________,________,________,________,
|
________,________,________,________,________,________,________,
|
||||||
________,________,________,________,________,
|
________,________,________,________,________,
|
||||||
|
|
||||||
|
|
||||||
________,________,
|
________,________,
|
||||||
________,
|
________,
|
||||||
________,________,________),
|
________,________,________),
|
||||||
@@ -181,95 +136,207 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
//****************************NUMPAD LAYER****************************
|
//****************************NUMPAD LAYER****************************
|
||||||
[_NUMPAD] = KEYMAP(________,________,________,________,________,________,________,
|
[_NUMPAD] = KEYMAP(________,________,________,________,________,________,________,
|
||||||
________,________,________,________,________,________,________,
|
________,________,________,________,________,________,________,
|
||||||
________,________,________,________,________,________,
|
________,KC_DOT ,KC_SPACE,_XXXXXX_, KC_ESC ,________,
|
||||||
________,________,________,________,________,________,________,
|
________,DBMS_OUT,________,________,________,________,________,
|
||||||
________,________,________,________,________,
|
________,________,________,________,________,
|
||||||
|
|
||||||
________,________,
|
________,________,
|
||||||
________,
|
________,
|
||||||
________,________,________,
|
KC_PLUS,KC_MINUS,________,
|
||||||
|
|
||||||
BL_TOGG ,BL_STEP ,________,________,________,________,________,
|
BL_TOGG ,BL_STEP ,________,________,________,________,________,
|
||||||
________,________,KC_7 ,KC_8 ,KC_9 ,________,________,
|
________,________,KC_7 ,KC_8 ,KC_9 ,________,________,
|
||||||
________,KC_4 ,KC_5 ,KC_6 ,________,________,
|
________,KC_4 ,KC_5 ,KC_6 ,________,________,
|
||||||
________,________,KC_1 ,KC_2 ,KC_3 ,________,________,
|
________,KC_DOT, KC_1 ,KC_2 ,KC_3 ,________,________,
|
||||||
KC_0 ,KC_0 , KC_DOT ,________,________,
|
KC_0 ,KC_DOT , KC_DOT ,________,________,
|
||||||
|
|
||||||
________,________,
|
________,________,
|
||||||
________,
|
________,
|
||||||
________,________,KC_0),
|
________,________,KC_0),
|
||||||
|
|
||||||
|
//****************************APP SWITCH LAYER****************************
|
||||||
|
[_APPSWITCH] = KEYMAP(________,________,________,________,________,________,________,
|
||||||
|
________,________ , ________ , ________ ,________ ,________,________,
|
||||||
|
________,APP_5,APP_6,APP_7,APP_8,________,
|
||||||
|
________,DBMS_OUT,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,
|
||||||
|
|
||||||
|
________,________,
|
||||||
|
________,
|
||||||
|
KC_PLUS,________,________,
|
||||||
|
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,APP_3 ,________,APP_4 ,________,________,
|
||||||
|
________,APP_1 ,_XXXXXX_,APP_2 ,________,________,
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,
|
||||||
|
|
||||||
|
________,________,
|
||||||
|
________,
|
||||||
|
________,________,________),
|
||||||
|
|
||||||
|
|
||||||
|
[_ONESHOT] = KEYMAP( UP_ENTER_RESET , ________, ________, ________, ________, ________, ________,
|
||||||
|
________, ________, ________, KC_UP , ________, ________, ________,
|
||||||
|
________, ________, KC_LEFT , KC_DOWN , KC_RIGHT, ________,
|
||||||
|
MAGIC_TOGGLE_NKRO, ________, ________, ________, ________, ________, ________,
|
||||||
|
________, ________, ________, ________, ________,
|
||||||
|
|
||||||
|
________, ________,
|
||||||
|
________,
|
||||||
|
________, ________, ________,
|
||||||
|
|
||||||
|
________, ________, ________, ________, ________, ________, ________,
|
||||||
|
________, ________, KC_7, KC_8, KC_9, KC_PLUS, ________,
|
||||||
|
________, KC_4, KC_5, KC_6, KC_EQUAL, ________,
|
||||||
|
________, ________, KC_1, KC_2, KC_3, KC_ASTR, ________,
|
||||||
|
________, ________, KC_0, ________, ________,
|
||||||
|
|
||||||
|
________, ________,
|
||||||
|
________,
|
||||||
|
________, ________, ________),
|
||||||
//****************************TEXT/INTELLIJ NAVIGATION LAYER****************************
|
//****************************TEXT/INTELLIJ NAVIGATION LAYER****************************
|
||||||
[_TEXTNAV] = KEYMAP(________,________,________,________,________,________,________,
|
[_TEXTNAV] = KEYMAP(________,________,________,________,________,________,________,
|
||||||
________,MEH(KC_Q),LSFT(KC_ESCAPE),MEH(KC_D),MEH(KC_2),LALT(LSFT(KC_UP)),________,
|
________,MEH(KC_Q),LSFT(KC_ESCAPE),MEH(KC_D),MEH(KC_2),LALT(LSFT(KC_UP)),________,
|
||||||
________,LALT(KC_F7),LCTL(KC_LEFT),LCTL(KC_B),LCTL(KC_RIGHT),LALT(LSFT(KC_DOWN)),
|
________,________,LCTL(KC_LEFT),LCTL(KC_B),LCTL(KC_RIGHT),LALT(LSFT(KC_DOWN)),
|
||||||
________,________,________,LCTL(LSFT(KC_COMMA)),MEH(KC_DOT),LALT(KC_MS_WH_UP),________,________,________,________,________,________,________,________,________,________,LCTL(KC_DELETE),________,LALT(LSFT(KC_F9)),________,________,________,________,________,________,________,MEH(KC_5),LALT(LSFT(KC_Z)),________,LALT(KC_Z),________,________,________,LCTL(LSFT(KC_LEFT)),LALT(LCTL(KC_S)),LCTL(LSFT(KC_RIGHT)),LCTL(LSFT(KC_COMMA)),________,________,________,________,________,________,________,________,________,________,________,________,________,________,________,________,________,________,________)
|
________,________,________,LCTL(LSFT(KC_COMMA)),MEH(KC_DOT),LALT(KC_MS_WH_UP),________,
|
||||||
|
________,________,________,________,________,
|
||||||
|
|
||||||
|
________,________,________,________,________,________,
|
||||||
|
|
||||||
|
LALT(LSFT(KC_F9)),________,________,________,________,________,________,________,MEH(KC_5),LALT(LSFT(KC_Z)),
|
||||||
|
________,LALT(KC_Z),________,________,________,LCTL(LSFT(KC_LEFT)),LALT(LCTL(KC_S)),LCTL(LSFT(KC_RIGHT)),
|
||||||
|
LCTL(LSFT(KC_COMMA)),________,________,________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,________,________,________,________,_XXXXXX_),
|
||||||
|
[_QWERTY_KIDS] = KEYMAP(
|
||||||
|
|
||||||
|
KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO ,
|
||||||
|
KC_NO , KC_Q , KC_W, KC_E, KC_R, KC_T, KC_NO ,
|
||||||
|
KC_NO , KC_A , KC_S, KC_D, KC_F, KC_G ,
|
||||||
|
KC_NO , KC_Z , KC_X, KC_C, KC_V, KC_B, KC_NO ,
|
||||||
|
KC_MINUS, KC_GRAVE, KC_DELETE, KC_LEFT, KC_RIGHT,
|
||||||
|
|
||||||
|
KC_NO , TT(_QWERTY_KIDS) ,
|
||||||
|
KC_NO ,
|
||||||
|
KC_LSHIFT, KC_BSPACE, KC_NO ,
|
||||||
|
|
||||||
|
KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO ,
|
||||||
|
KC_NO , KC_Y, KC_U, KC_I, KC_O, KC_P, KC_NO ,
|
||||||
|
KC_H, KC_J, KC_K, KC_L, KC_SCOLON , KC_NO,
|
||||||
|
KC_NO , KC_N, KC_M, KC_COMMA , KC_DOT , KC_SLASH, KC_NO ,
|
||||||
|
KC_UP, KC_DOWN, KC_DELETE, KC_TILD, KC_UNDS,
|
||||||
|
|
||||||
|
KC_NO , KC_NO ,
|
||||||
|
KC_NO,
|
||||||
|
KC_NO, KC_ENTER, KC_SPACE),
|
||||||
|
|
||||||
|
[_STREET_FIGHTER] = KEYMAP(
|
||||||
|
|
||||||
|
KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO ,
|
||||||
|
KC_NO , KC_NO , DIE_1000X_LEFT, KC_UP, DIE_1000X_RIGHT, KC_NO, KC_NO ,
|
||||||
|
KC_NO , KC_NO , KC_LEFT, KC_DOWN, KC_RIGHT, KC_NO ,
|
||||||
|
KC_NO , KC_NO , KC_NO, KC_NO, KC_NO, KC_NO, KC_NO ,
|
||||||
|
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
|
||||||
|
|
||||||
|
________ , ________ ,
|
||||||
|
________ ,
|
||||||
|
________, ________, ________ ,
|
||||||
|
|
||||||
|
KC_NO, KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO ,
|
||||||
|
KC_NO , KC_NO, KC_G, KC_H, KC_J, KC_NO, KC_NO ,
|
||||||
|
KC_NO, KC_B, KC_N, KC_M, KC_K , KC_NO,
|
||||||
|
KC_NO , KC_NO, KC_NO, KC_NO , KC_NO , KC_NO, KC_NO ,
|
||||||
|
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
|
||||||
|
|
||||||
|
TT(_STREET_FIGHTER) , ________ ,
|
||||||
|
________,
|
||||||
|
________, ________, ________),
|
||||||
|
|
||||||
|
|
||||||
|
//************************Windows navigation to directories*************************
|
||||||
|
[_DIRNAV] = KEYMAP(
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,KC_A,________,________,________,
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,
|
||||||
|
|
||||||
|
________,________,
|
||||||
|
________,
|
||||||
|
________,________,________,
|
||||||
|
|
||||||
|
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,_______,________,________,________,
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,
|
||||||
|
|
||||||
|
|
||||||
|
________,________,
|
||||||
|
________,
|
||||||
|
________,________,________),
|
||||||
|
|
||||||
|
|
||||||
|
[_TEXT_MACROS] = KEYMAP(
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,KC_A,________,________,________,
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,
|
||||||
|
|
||||||
|
________,________,
|
||||||
|
________,
|
||||||
|
________,________,________,
|
||||||
|
|
||||||
|
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,_______,________,________,________,
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,
|
||||||
|
|
||||||
|
|
||||||
|
________,________,
|
||||||
|
________,
|
||||||
|
________,________,________)
|
||||||
|
|
||||||
|
|
||||||
|
/* FOR FORMATTING FUTURE LAYERS
|
||||||
|
NO KEY CODES SHOULD BE MORE THAN 8 CHARACTERS
|
||||||
|
GOES LEFT HAND THEN RIGHT HAND
|
||||||
|
[_DIRNAV] = KEYMAP(
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,
|
||||||
|
|
||||||
|
________,________,
|
||||||
|
________,
|
||||||
|
________,________,________,
|
||||||
|
|
||||||
|
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,________,________,
|
||||||
|
________,________,________,________,________,
|
||||||
|
|
||||||
|
|
||||||
|
________,________,
|
||||||
|
________,
|
||||||
|
________,________,________), */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint16_t PROGMEM fn_actions[] = {
|
const uint16_t PROGMEM fn_actions[] = {
|
||||||
[1] = ACTION_LAYER_TAP_TOGGLE(1)
|
[1] = ACTION_LAYER_TAP_TOGGLE(1)
|
||||||
};
|
};
|
||||||
|
|
||||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
|
||||||
{
|
|
||||||
switch(id) {
|
|
||||||
case INFOQM: {
|
|
||||||
if (record->event.pressed) {
|
|
||||||
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case TIL_SLASH: {
|
|
||||||
if (record->event.pressed) {
|
|
||||||
SEND_STRING ("~/.");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case DEREF: {
|
|
||||||
if (record->event.pressed) {
|
|
||||||
SEND_STRING ("->");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case EQRIGHT: {
|
|
||||||
if (record->event.pressed) {
|
|
||||||
SEND_STRING ("=>");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case TICK3: {
|
|
||||||
if (record->event.pressed) {
|
|
||||||
SEND_STRING ("```");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case TILD3: {
|
|
||||||
if (record->event.pressed) {
|
|
||||||
SEND_STRING ("~~~");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case ALTTAB_START: {
|
|
||||||
register_code(KC_LALT);
|
|
||||||
layer_on(8);
|
|
||||||
}
|
|
||||||
|
|
||||||
case ALTTAB_END: {
|
|
||||||
unregister_code(KC_LALT);
|
|
||||||
layer_off(8);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
return MACRO_NONE;
|
|
||||||
};
|
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
|
||||||
uint8_t layer = biton32(layer_state);
|
uint8_t layer = biton32(layer_state);
|
||||||
@@ -281,35 +348,51 @@ void matrix_scan_user(void) {
|
|||||||
ergodox_right_led_1_off();
|
ergodox_right_led_1_off();
|
||||||
ergodox_right_led_2_off();
|
ergodox_right_led_2_off();
|
||||||
ergodox_right_led_3_off();
|
ergodox_right_led_3_off();
|
||||||
switch (layer) {
|
// _delay_ms(45);
|
||||||
case _SYMBOLS:
|
|
||||||
ergodox_right_led_1_on();
|
|
||||||
break;
|
|
||||||
case _MOUSE:
|
|
||||||
ergodox_right_led_2_on();
|
|
||||||
break;
|
|
||||||
case _NUMPAD:
|
|
||||||
ergodox_right_led_3_on();
|
|
||||||
break;
|
|
||||||
case _NAV:
|
|
||||||
ergodox_right_led_1_on();
|
|
||||||
ergodox_right_led_2_on();
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
ergodox_right_led_1_on();
|
|
||||||
ergodox_right_led_3_on();
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
ergodox_right_led_2_on();
|
|
||||||
ergodox_right_led_3_on();
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
ergodox_right_led_1_on();
|
|
||||||
ergodox_right_led_2_on();
|
|
||||||
ergodox_right_led_3_on();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
switch (layer)
|
||||||
|
{
|
||||||
|
case _SYMBOLS:
|
||||||
|
ergodox_right_led_1_on();
|
||||||
|
break;
|
||||||
|
case _MOUSE:
|
||||||
|
ergodox_right_led_2_on();
|
||||||
|
break;
|
||||||
|
case _NUMPAD:
|
||||||
|
ergodox_right_led_3_on();
|
||||||
|
break;
|
||||||
|
case _NAV:
|
||||||
|
ergodox_right_led_1_on();
|
||||||
|
ergodox_right_led_2_on();
|
||||||
|
break;
|
||||||
|
case _MACROS:
|
||||||
|
//layer unused right now
|
||||||
|
break;
|
||||||
|
case _FUNCTION:
|
||||||
|
//layer unused right nowex
|
||||||
|
break;
|
||||||
|
case _APPSWITCH:
|
||||||
|
ergodox_right_led_2_on();
|
||||||
|
ergodox_right_led_3_on();
|
||||||
|
break;
|
||||||
|
case _ONESHOT:
|
||||||
|
ergodox_right_led_1_on();
|
||||||
|
ergodox_right_led_2_on();
|
||||||
|
ergodox_right_led_3_on();
|
||||||
|
break;
|
||||||
|
case _TEXTNAV:
|
||||||
|
ergodox_right_led_1_on();
|
||||||
|
ergodox_right_led_3_on();
|
||||||
|
break;
|
||||||
|
case _QWERTY_KIDS:
|
||||||
|
ergodox_right_led_1_on();
|
||||||
|
ergodox_right_led_2_on();
|
||||||
|
ergodox_right_led_3_on();
|
||||||
|
break;
|
||||||
|
case _STREET_FIGHTER:
|
||||||
|
ergodox_right_led_2_on();
|
||||||
|
ergodox_right_led_3_on();
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
TAP_DANCE_ENABLE = yes
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Danny Nguyen <[email protected]>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#include "config_common.h"
|
||||||
|
|
||||||
|
#endif // CONFIG_H
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
#include "fortitude60.h"
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#ifndef FORTITUDE60_H
|
||||||
|
#define FORTITUDE60_H
|
||||||
|
|
||||||
|
#ifdef KEYBOARD_fortitude60_rev1
|
||||||
|
#include "rev1.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "quantum.h"
|
||||||
|
|
||||||
|
// Used to create a keymap using only KC_ prefixed keys
|
||||||
|
#define LAYOUT_kc( \
|
||||||
|
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||||
|
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||||
|
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||||
|
L30, L31, L32, L33, L34, L35, LT5, RT5, R30, R31, R32, R33, R34, R35, \
|
||||||
|
LT0, LT1, LT2, LT3, LT4, RT4, RT3, RT2, RT1, RT0 \
|
||||||
|
) \
|
||||||
|
LAYOUT( \
|
||||||
|
KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, \
|
||||||
|
KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, \
|
||||||
|
KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \
|
||||||
|
KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##LT5, KC_##RT5, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35, \
|
||||||
|
KC_##LT0, KC_##LT1, KC_##LT2, KC_##LT3, KC_##LT4, KC_##RT4, KC_##RT3, KC_##RT2, KC_##RT1, KC_##RT0 \
|
||||||
|
)
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Danny Nguyen <[email protected]>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_USER_H
|
||||||
|
#define CONFIG_USER_H
|
||||||
|
|
||||||
|
#include "config_common.h"
|
||||||
|
|
||||||
|
#define USE_SERIAL
|
||||||
|
|
||||||
|
/* Select hand configuration */
|
||||||
|
|
||||||
|
// #define MASTER_LEFT
|
||||||
|
// #define MASTER_RIGHT
|
||||||
|
#define EE_HANDS
|
||||||
|
|
||||||
|
#define USE_SERIAL_PD2
|
||||||
|
/* #undef RGBLED_NUM */
|
||||||
|
/* #define RGBLIGHT_ANIMATIONS */
|
||||||
|
/* #define RGBLED_NUM 12 */
|
||||||
|
/* #define RGBLIGHT_HUE_STEP 8 */
|
||||||
|
/* #define RGBLIGHT_SAT_STEP 8 */
|
||||||
|
/* #define RGBLIGHT_VAL_STEP 8 */
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
#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 _ADJUST 16
|
||||||
|
|
||||||
|
enum custom_keycodes {
|
||||||
|
QWERTY = SAFE_RANGE,
|
||||||
|
COLEMAK,
|
||||||
|
DVORAK,
|
||||||
|
LOWER,
|
||||||
|
RAISE,
|
||||||
|
ADJUST,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Fillers to make layering more clear
|
||||||
|
#define _______ KC_TRNS
|
||||||
|
#define XXXXXXX KC_NO
|
||||||
|
#define LOWER MO(_LOWER)
|
||||||
|
#define RAISE MO(_RAISE)
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
/* Qwerty
|
||||||
|
* ,-----------------------------------------. ,-----------------------------------------.
|
||||||
|
* | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del |
|
||||||
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
|
* | 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 |
|
||||||
|
* `-------------+------+------+------+------+------+------+------+------+------+------+-------------'
|
||||||
|
* | GUI | Ctrl |Lower |Space | Ctrl |Enter |Space |Raise | Alt | GUI |
|
||||||
|
* `---------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_QWERTY] = LAYOUT( \
|
||||||
|
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
|
||||||
|
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_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_LBRC, KC_RBRC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||||
|
KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_LCTL, KC_ENT, KC_SPC, RAISE, KC_RALT, KC_RGUI\
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Colemak
|
||||||
|
* ,-----------------------------------------. ,-----------------------------------------.
|
||||||
|
* | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del |
|
||||||
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
|
* | 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 |
|
||||||
|
* `-------------+------+------+------+------+------+------+------+------+------+------+-------------'
|
||||||
|
* | GUI | Ctrl |Lower |Space | Ctrl |Enter |Space |Raise | Alt | GUI |
|
||||||
|
* `---------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_COLEMAK] = LAYOUT( \
|
||||||
|
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
|
||||||
|
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_LBRC, KC_RBRC, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||||
|
KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_LCTL, KC_ENT, KC_SPC, RAISE, KC_RALT, KC_RGUI\
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Dvorak
|
||||||
|
* ,-----------------------------------------. ,-----------------------------------------.
|
||||||
|
* | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del |
|
||||||
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
|
* | 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 |
|
||||||
|
* `-------------+------+------+------+------+------+------+------+------+------+------+-------------'
|
||||||
|
* | GUI | Ctrl |Lower |Space | Ctrl |Enter |Space |Raise | Alt | GUI |
|
||||||
|
* `---------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_DVORAK] = LAYOUT( \
|
||||||
|
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
|
||||||
|
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_LBRC, KC_RBRC, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
|
||||||
|
KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_LCTL, KC_ENT, KC_SPC, RAISE, KC_RALT, KC_RGUI\
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Lower
|
||||||
|
* ,-----------------------------------------. ,-----------------------------------------.
|
||||||
|
* | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | |
|
||||||
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
|
* | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | Del |
|
||||||
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
|
* | Del | F1 | F2 | F3 | F4 | F5 | | F6 | _ | + | | \ | | |
|
||||||
|
* |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
|
||||||
|
* | | F7 | F8 | F9 | F10 | F11 | | | F12 |ISO ~ |ISO | | | | |
|
||||||
|
* `-------------+------+------+------+------+------+------+------+------+------+------+-------------'
|
||||||
|
* | | | | | | | | | | |
|
||||||
|
* `---------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_LOWER] = LAYOUT( \
|
||||||
|
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \
|
||||||
|
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \
|
||||||
|
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,S(KC_NUHS),S(KC_NUBS),_______, _______, _______,\
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______\
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Raise
|
||||||
|
* ,-----------------------------------------. ,-----------------------------------------.
|
||||||
|
* | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del |
|
||||||
|
* |------+------+------+------+------+------. ,------+------+------+------+------+------|
|
||||||
|
* | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp |
|
||||||
|
* |------+------+------+------+------+------. ,------+------+------+------+------+------|
|
||||||
|
* | Del | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | | |
|
||||||
|
* |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
|
||||||
|
* | | F7 | F8 | F9 | F10 | F11 | | | F12 |ISO # |ISO / | | | |
|
||||||
|
* `-------------+------+------+------+------+------+------+------+------+------+------+-------------'
|
||||||
|
* | | | | | | | | | | |
|
||||||
|
* `---------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_RAISE] = LAYOUT( \
|
||||||
|
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
|
||||||
|
KC_GRV, KC_1, KC_UP, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
|
||||||
|
KC_DEL, KC_LEFT, KC_DOWN, KC_RGHT, 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_NUHS, KC_NUBS, _______, _______, _______, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______\
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Adjust (Lower + Raise)
|
||||||
|
* ,-----------------------------------------. ,-----------------------------------------.
|
||||||
|
* | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 |
|
||||||
|
* |------+------+------+------+------+------. ,------+------+------+------+------+------|
|
||||||
|
* | | Reset|RGB Tg|RGB Md|Hue Up|Hue Dn| |Sat Up|Sat Dn|Val Up|Val Dn| | Bksp |
|
||||||
|
* |------+------+------+------+------+------. ,------+------+------+------+------+------|
|
||||||
|
* | | | |Aud on|Audoff|AGnorm| |AGswap| |BL TOG|BL STP| | |
|
||||||
|
* |------+------+------+------+------+------+-------------+------+------+------+------+------+------|
|
||||||
|
* |Qwerty|Colemk|Dvorak| | | | | | | | | | | |
|
||||||
|
* `-------------+------+------+------+------+------+------+------+------+------+------+-------------'
|
||||||
|
* | | | | | | | | | | |
|
||||||
|
* `---------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_ADJUST] = LAYOUT( \
|
||||||
|
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
|
||||||
|
_______, RESET , RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, _______, KC_BSPC, \
|
||||||
|
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, _______, BL_TOGG, BL_STEP, _______, _______, \
|
||||||
|
QWERTY, COLEMAK, DVORAK, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______\
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
uint32_t layer_state_set_user(uint32_t state) {
|
||||||
|
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
|
case QWERTY:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_single_persistent_default_layer(_QWERTY);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case COLEMAK:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_single_persistent_default_layer(_COLEMAK);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case DVORAK:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_single_persistent_default_layer(_DVORAK);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
RGBLIGHT_ENABLE = no
|
||||||
@@ -0,0 +1,423 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Danny Nguyen <[email protected]>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* scan matrix
|
||||||
|
*/
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include "wait.h"
|
||||||
|
#include "print.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "matrix.h"
|
||||||
|
#include "split_util.h"
|
||||||
|
#include "pro_micro.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "timer.h"
|
||||||
|
|
||||||
|
#ifdef BACKLIGHT_ENABLE
|
||||||
|
#include "backlight.h"
|
||||||
|
extern backlight_config_t backlight_config;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "serial.h"
|
||||||
|
|
||||||
|
#ifndef DEBOUNCING_DELAY
|
||||||
|
# define DEBOUNCING_DELAY 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (DEBOUNCING_DELAY > 0)
|
||||||
|
static uint16_t debouncing_time;
|
||||||
|
static bool debouncing = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (MATRIX_COLS <= 8)
|
||||||
|
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||||
|
# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
|
||||||
|
# define matrix_bitpop(i) bitpop(matrix[i])
|
||||||
|
# define ROW_SHIFTER ((uint8_t)1)
|
||||||
|
#else
|
||||||
|
# error "Currently only supports 8 COLS"
|
||||||
|
#endif
|
||||||
|
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||||
|
|
||||||
|
#define ERROR_DISCONNECT_COUNT 5
|
||||||
|
|
||||||
|
#define SERIAL_LED_ADDR 0x00
|
||||||
|
|
||||||
|
#define ROWS_PER_HAND (MATRIX_ROWS/2)
|
||||||
|
|
||||||
|
static uint8_t error_count = 0;
|
||||||
|
|
||||||
|
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||||
|
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||||
|
|
||||||
|
/* matrix state(1:on, 0:off) */
|
||||||
|
static matrix_row_t matrix[MATRIX_ROWS];
|
||||||
|
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||||
|
|
||||||
|
#if (DIODE_DIRECTION == COL2ROW)
|
||||||
|
static void init_cols(void);
|
||||||
|
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row);
|
||||||
|
static void unselect_rows(void);
|
||||||
|
static void select_row(uint8_t row);
|
||||||
|
static void unselect_row(uint8_t row);
|
||||||
|
#elif (DIODE_DIRECTION == ROW2COL)
|
||||||
|
static void init_rows(void);
|
||||||
|
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col);
|
||||||
|
static void unselect_cols(void);
|
||||||
|
static void unselect_col(uint8_t col);
|
||||||
|
static void select_col(uint8_t col);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_init_kb(void) {
|
||||||
|
matrix_init_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_scan_kb(void) {
|
||||||
|
matrix_scan_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_init_user(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_scan_user(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
uint8_t matrix_rows(void)
|
||||||
|
{
|
||||||
|
return MATRIX_ROWS;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
uint8_t matrix_cols(void)
|
||||||
|
{
|
||||||
|
return MATRIX_COLS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_init(void)
|
||||||
|
{
|
||||||
|
debug_enable = true;
|
||||||
|
debug_matrix = true;
|
||||||
|
debug_mouse = true;
|
||||||
|
// initialize row and col
|
||||||
|
unselect_rows();
|
||||||
|
init_cols();
|
||||||
|
|
||||||
|
TX_RX_LED_INIT;
|
||||||
|
|
||||||
|
// initialize matrix state: all keys off
|
||||||
|
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
||||||
|
matrix[i] = 0;
|
||||||
|
matrix_debouncing[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
matrix_init_quantum();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t _matrix_scan(void)
|
||||||
|
{
|
||||||
|
int offset = isLeftHand ? 0 : (ROWS_PER_HAND);
|
||||||
|
#if (DIODE_DIRECTION == COL2ROW)
|
||||||
|
// Set row, read cols
|
||||||
|
for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) {
|
||||||
|
# if (DEBOUNCING_DELAY > 0)
|
||||||
|
bool matrix_changed = read_cols_on_row(matrix_debouncing+offset, current_row);
|
||||||
|
|
||||||
|
if (matrix_changed) {
|
||||||
|
debouncing = true;
|
||||||
|
debouncing_time = timer_read();
|
||||||
|
}
|
||||||
|
|
||||||
|
# else
|
||||||
|
read_cols_on_row(matrix+offset, current_row);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif (DIODE_DIRECTION == ROW2COL)
|
||||||
|
// Set col, read rows
|
||||||
|
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
|
||||||
|
# if (DEBOUNCING_DELAY > 0)
|
||||||
|
bool matrix_changed = read_rows_on_col(matrix_debouncing+offset, current_col);
|
||||||
|
if (matrix_changed) {
|
||||||
|
debouncing = true;
|
||||||
|
debouncing_time = timer_read();
|
||||||
|
}
|
||||||
|
# else
|
||||||
|
read_rows_on_col(matrix+offset, current_col);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# if (DEBOUNCING_DELAY > 0)
|
||||||
|
if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {
|
||||||
|
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
|
||||||
|
matrix[i+offset] = matrix_debouncing[i+offset];
|
||||||
|
}
|
||||||
|
debouncing = false;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int serial_transaction(void) {
|
||||||
|
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
|
||||||
|
|
||||||
|
if (serial_update_buffers()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||||
|
matrix[slaveOffset+i] = serial_slave_buffer[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef BACKLIGHT_ENABLE
|
||||||
|
// Write backlight level for slave to read
|
||||||
|
serial_master_buffer[SERIAL_LED_ADDR] = backlight_config.enable ? backlight_config.level : 0;
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t matrix_scan(void)
|
||||||
|
{
|
||||||
|
uint8_t ret = _matrix_scan();
|
||||||
|
|
||||||
|
if( serial_transaction() ) {
|
||||||
|
// turn on the indicator led when halves are disconnected
|
||||||
|
TXLED1;
|
||||||
|
|
||||||
|
error_count++;
|
||||||
|
|
||||||
|
if (error_count > ERROR_DISCONNECT_COUNT) {
|
||||||
|
// reset other half if disconnected
|
||||||
|
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
|
||||||
|
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||||
|
matrix[slaveOffset+i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// turn off the indicator led on no error
|
||||||
|
TXLED0;
|
||||||
|
error_count = 0;
|
||||||
|
}
|
||||||
|
matrix_scan_quantum();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_slave_scan(void) {
|
||||||
|
_matrix_scan();
|
||||||
|
|
||||||
|
int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
|
||||||
|
|
||||||
|
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||||
|
serial_slave_buffer[i] = matrix[offset+i];
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef BACKLIGHT_ENABLE
|
||||||
|
// Read backlight level sent from master and update level on slave
|
||||||
|
backlight_set(serial_master_buffer[SERIAL_LED_ADDR]);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool matrix_is_modified(void)
|
||||||
|
{
|
||||||
|
if (debouncing) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool matrix_is_on(uint8_t row, uint8_t col)
|
||||||
|
{
|
||||||
|
return (matrix[row] & ((matrix_row_t)1<<col));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
matrix_row_t matrix_get_row(uint8_t row)
|
||||||
|
{
|
||||||
|
return matrix[row];
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_print(void)
|
||||||
|
{
|
||||||
|
print("\nr/c 0123456789ABCDEF\n");
|
||||||
|
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||||
|
phex(row); print(": ");
|
||||||
|
pbin_reverse16(matrix_get_row(row));
|
||||||
|
print("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t matrix_key_count(void)
|
||||||
|
{
|
||||||
|
uint8_t count = 0;
|
||||||
|
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||||
|
count += bitpop16(matrix[i]);
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if (DIODE_DIRECTION == COL2ROW)
|
||||||
|
|
||||||
|
static void init_cols(void)
|
||||||
|
{
|
||||||
|
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||||
|
uint8_t pin = col_pins[x];
|
||||||
|
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||||
|
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
||||||
|
{
|
||||||
|
// Store last value of row prior to reading
|
||||||
|
matrix_row_t last_row_value = current_matrix[current_row];
|
||||||
|
|
||||||
|
// Clear data in matrix row
|
||||||
|
current_matrix[current_row] = 0;
|
||||||
|
|
||||||
|
// Select row and wait for row selecton to stabilize
|
||||||
|
select_row(current_row);
|
||||||
|
wait_us(30);
|
||||||
|
|
||||||
|
// For each col...
|
||||||
|
for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
|
||||||
|
|
||||||
|
// Select the col pin to read (active low)
|
||||||
|
uint8_t pin = col_pins[col_index];
|
||||||
|
uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
|
||||||
|
|
||||||
|
// Populate the matrix row with the state of the col pin
|
||||||
|
current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unselect row
|
||||||
|
unselect_row(current_row);
|
||||||
|
|
||||||
|
return (last_row_value != current_matrix[current_row]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void select_row(uint8_t row)
|
||||||
|
{
|
||||||
|
uint8_t pin = row_pins[row];
|
||||||
|
_SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
|
||||||
|
_SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
|
||||||
|
}
|
||||||
|
|
||||||
|
static void unselect_row(uint8_t row)
|
||||||
|
{
|
||||||
|
uint8_t pin = row_pins[row];
|
||||||
|
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||||
|
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||||
|
}
|
||||||
|
|
||||||
|
static void unselect_rows(void)
|
||||||
|
{
|
||||||
|
for(uint8_t x = 0; x < ROWS_PER_HAND; x++) {
|
||||||
|
uint8_t pin = row_pins[x];
|
||||||
|
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||||
|
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif (DIODE_DIRECTION == ROW2COL)
|
||||||
|
|
||||||
|
static void init_rows(void)
|
||||||
|
{
|
||||||
|
for(uint8_t x = 0; x < ROWS_PER_HAND; x++) {
|
||||||
|
uint8_t pin = row_pins[x];
|
||||||
|
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||||
|
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
||||||
|
{
|
||||||
|
bool matrix_changed = false;
|
||||||
|
|
||||||
|
// Select col and wait for col selecton to stabilize
|
||||||
|
select_col(current_col);
|
||||||
|
wait_us(30);
|
||||||
|
|
||||||
|
// For each row...
|
||||||
|
for(uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Store last value of row prior to reading
|
||||||
|
matrix_row_t last_row_value = current_matrix[row_index];
|
||||||
|
|
||||||
|
// Check row pin state
|
||||||
|
if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF)) == 0)
|
||||||
|
{
|
||||||
|
// Pin LO, set col bit
|
||||||
|
current_matrix[row_index] |= (ROW_SHIFTER << current_col);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Pin HI, clear col bit
|
||||||
|
current_matrix[row_index] &= ~(ROW_SHIFTER << current_col);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine if the matrix changed state
|
||||||
|
if ((last_row_value != current_matrix[row_index]) && !(matrix_changed))
|
||||||
|
{
|
||||||
|
matrix_changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unselect col
|
||||||
|
unselect_col(current_col);
|
||||||
|
|
||||||
|
return matrix_changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void select_col(uint8_t col)
|
||||||
|
{
|
||||||
|
uint8_t pin = col_pins[col];
|
||||||
|
_SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
|
||||||
|
_SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
|
||||||
|
}
|
||||||
|
|
||||||
|
static void unselect_col(uint8_t col)
|
||||||
|
{
|
||||||
|
uint8_t pin = col_pins[col];
|
||||||
|
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||||
|
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||||
|
}
|
||||||
|
|
||||||
|
static void unselect_cols(void)
|
||||||
|
{
|
||||||
|
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||||
|
uint8_t pin = col_pins[x];
|
||||||
|
_SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
|
||||||
|
_SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# Fortitude60
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
👊A 60% (12x5) split keyboard with staggerd column layout.👊
|
||||||
|
|
||||||
|
Keyboard Maintainer: [Pekaso](https://github.com/Pekaso) [@Pekaso](https://twitter.com/Pekaso)
|
||||||
|
Hardware Supported: Fortitude60 PCB, Beetle 32u4
|
||||||
|
Hardware Availability: [plustk2s.com](http://plustk2s.com)
|
||||||
|
|
||||||
|
Make example for this keyboard (after setting up your build environment):
|
||||||
|
|
||||||
|
make fortitude60/rev1:default:avrdude
|
||||||
|
|
||||||
|
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Danny Nguyen <[email protected]>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef REV1_CONFIG_H
|
||||||
|
#define REV1_CONFIG_H
|
||||||
|
|
||||||
|
#include QMK_KEYBOARD_CONFIG_H
|
||||||
|
|
||||||
|
/* USB Device descriptor parameter */
|
||||||
|
#define VENDOR_ID 0xCB10
|
||||||
|
#define PRODUCT_ID 0x1156
|
||||||
|
#define DEVICE_VER 0x0100
|
||||||
|
#define MANUFACTURER Pekaso
|
||||||
|
#define PRODUCT The Fortitude60 Keyboard
|
||||||
|
#define DESCRIPTION Split 60 keyboard.
|
||||||
|
|
||||||
|
/* key matrix size */
|
||||||
|
// Rows are doubled-up
|
||||||
|
#define MATRIX_ROWS 10
|
||||||
|
#define MATRIX_COLS 6
|
||||||
|
|
||||||
|
// wiring of each half
|
||||||
|
#define MATRIX_ROW_PINS { D1, D0, D3, B7, B6 }
|
||||||
|
#define MATRIX_COL_PINS { F7, F6, F5, B3, B2, B1 }
|
||||||
|
|
||||||
|
/* COL2ROW or ROW2COL */
|
||||||
|
#define DIODE_DIRECTION COL2ROW
|
||||||
|
|
||||||
|
/* define if matrix has ghost */
|
||||||
|
//#define MATRIX_HAS_GHOST
|
||||||
|
|
||||||
|
/* number of backlight levels */
|
||||||
|
#ifdef BACKLIGHT_ENABLE
|
||||||
|
#define BACKLIGHT_PIN B5
|
||||||
|
#define BACKLIGHT_LEVELS 9
|
||||||
|
// #define BACKLIGHT_BREATHING
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Set 0 if debouncing isn't needed */
|
||||||
|
#define DEBOUNCING_DELAY 5
|
||||||
|
|
||||||
|
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||||
|
#define LOCKING_SUPPORT_ENABLE
|
||||||
|
/* Locking resynchronize hack */
|
||||||
|
#define LOCKING_RESYNC_ENABLE
|
||||||
|
|
||||||
|
/* key combination for command */
|
||||||
|
#define IS_COMMAND() ( \
|
||||||
|
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/* ws2812 RGB LED */
|
||||||
|
/* #define RGB_DI_PIN D3 */
|
||||||
|
/* #define RGBLIGHT_TIMER */
|
||||||
|
/* #define RGBLED_NUM 16 // Number of LEDs */
|
||||||
|
/* #define ws2812_PORTREG PORTD */
|
||||||
|
/* #define ws2812_DDRREG DDRD */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Feature disable options
|
||||||
|
* These options are also useful to firmware size reduction.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* disable debug print */
|
||||||
|
// #define NO_DEBUG
|
||||||
|
|
||||||
|
/* disable print */
|
||||||
|
// #define NO_PRINT
|
||||||
|
|
||||||
|
/* disable action features */
|
||||||
|
//#define NO_ACTION_LAYER
|
||||||
|
//#define NO_ACTION_TAPPING
|
||||||
|
//#define NO_ACTION_ONESHOT
|
||||||
|
//#define NO_ACTION_MACRO
|
||||||
|
//#define NO_ACTION_FUNCTION
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#include "rev1.h"
|
||||||
|
|
||||||
|
#ifdef SSD1306OLED
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void matrix_init_kb(void) {
|
||||||
|
|
||||||
|
// // green led on
|
||||||
|
// DDRD |= (1<<5);
|
||||||
|
// PORTD &= ~(1<<5);
|
||||||
|
|
||||||
|
// // orange led on
|
||||||
|
// DDRB |= (1<<0);
|
||||||
|
// PORTB &= ~(1<<0);
|
||||||
|
|
||||||
|
matrix_init_user();
|
||||||
|
};
|
||||||
|
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
#ifndef REV1_H
|
||||||
|
#define REV1_H
|
||||||
|
|
||||||
|
#include "fortitude60.h"
|
||||||
|
|
||||||
|
//void promicro_bootloader_jmp(bool program);
|
||||||
|
#include "quantum.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USE_I2C
|
||||||
|
#include <stddef.h>
|
||||||
|
#ifdef __AVR__
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//void promicro_bootloader_jmp(bool program);
|
||||||
|
|
||||||
|
// Standard Keymap
|
||||||
|
// (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left)
|
||||||
|
#define LAYOUT( \
|
||||||
|
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
||||||
|
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
||||||
|
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
||||||
|
L30, L31, L32, L33, L34, L35, LT5, RT5, R30, R31, R32, R33, R34, R35, \
|
||||||
|
LT0, LT1, LT2, LT3, LT4, RT4, RT3, RT2, RT1, RT0 \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ L00, L01, L02, L03, L04, L05 }, \
|
||||||
|
{ L10, L11, L12, L13, L14, L15 }, \
|
||||||
|
{ L20, L21, L22, L23, L24, L25 }, \
|
||||||
|
{ L30, L31, L32, L33, L34, L35 }, \
|
||||||
|
{ LT0, LT1, LT2, LT3, LT4, LT5 }, \
|
||||||
|
{ R05, R04, R03, R02, R01, R00 }, \
|
||||||
|
{ R15, R14, R13, R12, R11, R10 }, \
|
||||||
|
{ R25, R24, R23, R22, R21, R20 }, \
|
||||||
|
{ R35, R34, R33, R32, R31, R30 }, \
|
||||||
|
{ RT0, RT1, RT2, RT3, RT4, RT5 } \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define LAYOUT_ortho_5x12 LAYOUT
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
BACKLIGHT_ENABLE = yes
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
SRC += matrix.c \
|
||||||
|
split_util.c \
|
||||||
|
serial.c
|
||||||
|
|
||||||
|
# MCU name
|
||||||
|
#MCU = at90usb1287
|
||||||
|
MCU = atmega32u4
|
||||||
|
|
||||||
|
# Processor frequency.
|
||||||
|
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||||
|
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||||
|
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||||
|
# automatically to create a 32-bit value in your source code.
|
||||||
|
#
|
||||||
|
# This will be an integer division of F_USB below, as it is sourced by
|
||||||
|
# F_USB after it has run through any CPU prescalers. Note that this value
|
||||||
|
# does not *change* the processor frequency - it should merely be updated to
|
||||||
|
# reflect the processor speed set externally so that the code can use accurate
|
||||||
|
# software delays.
|
||||||
|
F_CPU = 16000000
|
||||||
|
|
||||||
|
#
|
||||||
|
# LUFA specific
|
||||||
|
#
|
||||||
|
# Target architecture (see library "Board Types" documentation).
|
||||||
|
ARCH = AVR8
|
||||||
|
|
||||||
|
# Input clock frequency.
|
||||||
|
# This will define a symbol, F_USB, in all source code files equal to the
|
||||||
|
# input clock frequency (before any prescaling is performed) in Hz. This value may
|
||||||
|
# differ from F_CPU if prescaling is used on the latter, and is required as the
|
||||||
|
# raw input clock is fed directly to the PLL sections of the AVR for high speed
|
||||||
|
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
|
||||||
|
# at the end, this will be done automatically to create a 32-bit value in your
|
||||||
|
# source code.
|
||||||
|
#
|
||||||
|
# If no clock division is performed on the input clock inside the AVR (via the
|
||||||
|
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
|
||||||
|
F_USB = $(F_CPU)
|
||||||
|
|
||||||
|
# Bootloader
|
||||||
|
# This definition is optional, and if your keyboard supports multiple bootloaders of
|
||||||
|
# different sizes, comment this out, and the correct address will be loaded
|
||||||
|
# automatically (+60). See bootloader.mk for all options.
|
||||||
|
BOOTLOADER = caterina
|
||||||
|
|
||||||
|
# Interrupt driven control endpoint task(+60)
|
||||||
|
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||||
|
|
||||||
|
# Build Options
|
||||||
|
# change to "no" to disable the options, or define them in the Makefile in
|
||||||
|
# the appropriate keymap folder that will get included automatically
|
||||||
|
#
|
||||||
|
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||||
|
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||||
|
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||||
|
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||||
|
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
|
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||||
|
MIDI_ENABLE = no # MIDI controls
|
||||||
|
AUDIO_ENABLE = no # 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.
|
||||||
|
USE_SERIAL = yes # Serial support only on fortitude60
|
||||||
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
|
SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||||
|
|
||||||
|
CUSTOM_MATRIX = yes
|
||||||
|
|
||||||
|
DEFAULT_FOLDER = fortitude60/rev1
|
||||||
@@ -0,0 +1,235 @@
|
|||||||
|
/*
|
||||||
|
* WARNING: be careful changing this code, it is very timing dependent
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef F_CPU
|
||||||
|
#define F_CPU 16000000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "serial.h"
|
||||||
|
|
||||||
|
#ifndef USE_I2C
|
||||||
|
|
||||||
|
// Serial pulse period in microseconds. Its probably a bad idea to lower this
|
||||||
|
// value.
|
||||||
|
#define SERIAL_DELAY 24
|
||||||
|
|
||||||
|
uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
|
||||||
|
uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
|
||||||
|
|
||||||
|
#define SLAVE_DATA_CORRUPT (1<<0)
|
||||||
|
volatile uint8_t status = 0;
|
||||||
|
|
||||||
|
inline static
|
||||||
|
void serial_delay(void) {
|
||||||
|
_delay_us(SERIAL_DELAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static
|
||||||
|
void serial_output(void) {
|
||||||
|
SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// make the serial pin an input with pull-up resistor
|
||||||
|
inline static
|
||||||
|
void serial_input(void) {
|
||||||
|
SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK;
|
||||||
|
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static
|
||||||
|
uint8_t serial_read_pin(void) {
|
||||||
|
return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static
|
||||||
|
void serial_low(void) {
|
||||||
|
SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static
|
||||||
|
void serial_high(void) {
|
||||||
|
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void serial_master_init(void) {
|
||||||
|
serial_output();
|
||||||
|
serial_high();
|
||||||
|
}
|
||||||
|
|
||||||
|
void serial_slave_init(void) {
|
||||||
|
serial_input();
|
||||||
|
|
||||||
|
#ifndef USE_SERIAL_PD2
|
||||||
|
// Enable INT0
|
||||||
|
EIMSK |= _BV(INT0);
|
||||||
|
// Trigger on falling edge of INT0
|
||||||
|
EICRA &= ~(_BV(ISC00) | _BV(ISC01));
|
||||||
|
#else
|
||||||
|
// Enable INT2
|
||||||
|
EIMSK |= _BV(INT2);
|
||||||
|
// Trigger on falling edge of INT2
|
||||||
|
EICRA &= ~(_BV(ISC20) | _BV(ISC21));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used by the master to synchronize timing with the slave.
|
||||||
|
static
|
||||||
|
void sync_recv(void) {
|
||||||
|
serial_input();
|
||||||
|
// This shouldn't hang if the slave disconnects because the
|
||||||
|
// serial line will float to high if the slave does disconnect.
|
||||||
|
while (!serial_read_pin());
|
||||||
|
serial_delay();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used by the slave to send a synchronization signal to the master.
|
||||||
|
static
|
||||||
|
void sync_send(void) {
|
||||||
|
serial_output();
|
||||||
|
|
||||||
|
serial_low();
|
||||||
|
serial_delay();
|
||||||
|
|
||||||
|
serial_high();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reads a byte from the serial line
|
||||||
|
static
|
||||||
|
uint8_t serial_read_byte(void) {
|
||||||
|
uint8_t byte = 0;
|
||||||
|
serial_input();
|
||||||
|
for ( uint8_t i = 0; i < 8; ++i) {
|
||||||
|
byte = (byte << 1) | serial_read_pin();
|
||||||
|
serial_delay();
|
||||||
|
_delay_us(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return byte;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sends a byte with MSB ordering
|
||||||
|
static
|
||||||
|
void serial_write_byte(uint8_t data) {
|
||||||
|
uint8_t b = 8;
|
||||||
|
serial_output();
|
||||||
|
while( b-- ) {
|
||||||
|
if(data & (1 << b)) {
|
||||||
|
serial_high();
|
||||||
|
} else {
|
||||||
|
serial_low();
|
||||||
|
}
|
||||||
|
serial_delay();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// interrupt handle to be used by the slave device
|
||||||
|
ISR(SERIAL_PIN_INTERRUPT) {
|
||||||
|
sync_send();
|
||||||
|
|
||||||
|
uint8_t checksum = 0;
|
||||||
|
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
|
||||||
|
serial_write_byte(serial_slave_buffer[i]);
|
||||||
|
sync_send();
|
||||||
|
checksum += serial_slave_buffer[i];
|
||||||
|
}
|
||||||
|
serial_write_byte(checksum);
|
||||||
|
sync_send();
|
||||||
|
|
||||||
|
// wait for the sync to finish sending
|
||||||
|
serial_delay();
|
||||||
|
|
||||||
|
// read the middle of pulses
|
||||||
|
_delay_us(SERIAL_DELAY/2);
|
||||||
|
|
||||||
|
uint8_t checksum_computed = 0;
|
||||||
|
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
|
||||||
|
serial_master_buffer[i] = serial_read_byte();
|
||||||
|
sync_send();
|
||||||
|
checksum_computed += serial_master_buffer[i];
|
||||||
|
}
|
||||||
|
uint8_t checksum_received = serial_read_byte();
|
||||||
|
sync_send();
|
||||||
|
|
||||||
|
serial_input(); // end transaction
|
||||||
|
|
||||||
|
if ( checksum_computed != checksum_received ) {
|
||||||
|
status |= SLAVE_DATA_CORRUPT;
|
||||||
|
} else {
|
||||||
|
status &= ~SLAVE_DATA_CORRUPT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool serial_slave_DATA_CORRUPT(void) {
|
||||||
|
return status & SLAVE_DATA_CORRUPT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copies the serial_slave_buffer to the master and sends the
|
||||||
|
// serial_master_buffer to the slave.
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// 0 => no error
|
||||||
|
// 1 => slave did not respond
|
||||||
|
int serial_update_buffers(void) {
|
||||||
|
// this code is very time dependent, so we need to disable interrupts
|
||||||
|
cli();
|
||||||
|
|
||||||
|
// signal to the slave that we want to start a transaction
|
||||||
|
serial_output();
|
||||||
|
serial_low();
|
||||||
|
_delay_us(1);
|
||||||
|
|
||||||
|
// wait for the slaves response
|
||||||
|
serial_input();
|
||||||
|
serial_high();
|
||||||
|
_delay_us(SERIAL_DELAY);
|
||||||
|
|
||||||
|
// check if the slave is present
|
||||||
|
if (serial_read_pin()) {
|
||||||
|
// slave failed to pull the line low, assume not present
|
||||||
|
sei();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the slave is present syncronize with it
|
||||||
|
sync_recv();
|
||||||
|
|
||||||
|
uint8_t checksum_computed = 0;
|
||||||
|
// receive data from the slave
|
||||||
|
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
|
||||||
|
serial_slave_buffer[i] = serial_read_byte();
|
||||||
|
sync_recv();
|
||||||
|
checksum_computed += serial_slave_buffer[i];
|
||||||
|
}
|
||||||
|
uint8_t checksum_received = serial_read_byte();
|
||||||
|
sync_recv();
|
||||||
|
|
||||||
|
if (checksum_computed != checksum_received) {
|
||||||
|
sei();
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t checksum = 0;
|
||||||
|
// send data to the slave
|
||||||
|
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
|
||||||
|
serial_write_byte(serial_master_buffer[i]);
|
||||||
|
sync_recv();
|
||||||
|
checksum += serial_master_buffer[i];
|
||||||
|
}
|
||||||
|
serial_write_byte(checksum);
|
||||||
|
sync_recv();
|
||||||
|
|
||||||
|
// always, release the line when not in use
|
||||||
|
serial_output();
|
||||||
|
serial_high();
|
||||||
|
|
||||||
|
sei();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#ifndef MY_SERIAL_H
|
||||||
|
#define MY_SERIAL_H
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
/* TODO: some defines for interrupt setup */
|
||||||
|
#define SERIAL_PIN_DDR DDRD
|
||||||
|
#define SERIAL_PIN_PORT PORTD
|
||||||
|
#define SERIAL_PIN_INPUT PIND
|
||||||
|
|
||||||
|
#ifndef USE_SERIAL_PD2
|
||||||
|
#define SERIAL_PIN_MASK _BV(PD0)
|
||||||
|
#define SERIAL_PIN_INTERRUPT INT0_vect
|
||||||
|
#else
|
||||||
|
#define SERIAL_PIN_MASK _BV(PD2)
|
||||||
|
#define SERIAL_PIN_INTERRUPT INT2_vect
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
|
||||||
|
#define SERIAL_MASTER_BUFFER_LENGTH 1
|
||||||
|
|
||||||
|
// Buffers for master - slave communication
|
||||||
|
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
|
||||||
|
extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
|
||||||
|
|
||||||
|
void serial_master_init(void);
|
||||||
|
void serial_slave_init(void);
|
||||||
|
int serial_update_buffers(void);
|
||||||
|
bool serial_slave_data_corrupt(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/wdt.h>
|
||||||
|
#include <avr/power.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include <avr/eeprom.h>
|
||||||
|
#include "split_util.h"
|
||||||
|
#include "matrix.h"
|
||||||
|
#include "keyboard.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "timer.h"
|
||||||
|
|
||||||
|
#include "serial.h"
|
||||||
|
|
||||||
|
volatile bool isLeftHand = true;
|
||||||
|
|
||||||
|
static void setup_handedness(void) {
|
||||||
|
#ifdef EE_HANDS
|
||||||
|
isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
|
||||||
|
#else
|
||||||
|
// I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
|
||||||
|
#if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
|
||||||
|
isLeftHand = !has_usb();
|
||||||
|
#else
|
||||||
|
isLeftHand = has_usb();
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void keyboard_master_setup(void) {
|
||||||
|
#ifdef USE_I2C
|
||||||
|
i2c_master_init();
|
||||||
|
#ifdef SSD1306OLED
|
||||||
|
matrix_master_OLED_init ();
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
serial_master_init();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void keyboard_slave_setup(void) {
|
||||||
|
timer_init();
|
||||||
|
#ifdef USE_I2C
|
||||||
|
i2c_slave_init(SLAVE_I2C_ADDRESS);
|
||||||
|
#else
|
||||||
|
serial_slave_init();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool has_usb(void) {
|
||||||
|
/* return (UDADDR & _BV(ADDEN)); */
|
||||||
|
USBCON |= (1 << OTGPADE); //enables VBUS pad
|
||||||
|
_delay_us(5);
|
||||||
|
return (USBSTA & (1<<VBUS)); //checks state of VBUS
|
||||||
|
}
|
||||||
|
|
||||||
|
void split_keyboard_setup(void) {
|
||||||
|
setup_handedness();
|
||||||
|
|
||||||
|
if (isLeftHand) {
|
||||||
|
/* if (has_usb()) { */
|
||||||
|
keyboard_master_setup();
|
||||||
|
} else {
|
||||||
|
keyboard_slave_setup();
|
||||||
|
}
|
||||||
|
sei();
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyboard_slave_loop(void) {
|
||||||
|
matrix_init();
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
matrix_slave_scan();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// this code runs before the usb and keyboard is initialized
|
||||||
|
void matrix_setup(void) {
|
||||||
|
split_keyboard_setup();
|
||||||
|
|
||||||
|
if (!isLeftHand) {
|
||||||
|
/* if (!has_usb()) { */
|
||||||
|
keyboard_slave_loop();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#ifndef SPLIT_KEYBOARD_UTIL_H
|
||||||
|
#define SPLIT_KEYBOARD_UTIL_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "eeconfig.h"
|
||||||
|
|
||||||
|
extern volatile bool isLeftHand;
|
||||||
|
|
||||||
|
// slave version of matix scan, defined in matrix.c
|
||||||
|
void matrix_slave_scan(void);
|
||||||
|
|
||||||
|
void split_keyboard_setup(void);
|
||||||
|
bool has_usb(void);
|
||||||
|
void keyboard_slave_loop(void);
|
||||||
|
|
||||||
|
void matrix_master_OLED_init (void);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# Gherkin Layout
|
||||||
|
This is my gherkin layout.
|
||||||
|
It is used as a game pad, and key layout is inspired by spare keys I had lying around.
|
||||||
|
The firmware is very simple, and only includes one layer keymap, and RGB effects.
|
||||||
|
|
||||||
|
# Flashing
|
||||||
|
The following command should be used from the main qmk directory.
|
||||||
|
```
|
||||||
|
make gherkin:bbaserdem
|
||||||
|
sudo avrdude -p atmgea34u4 -P `ls /dev/ttyACM*` -c avr109 -U flash:.build/gherkin_bbaserdem.hex
|
||||||
|
```
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#ifndef CONFIG_USER_H
|
||||||
|
#define CONFIG_USER_H
|
||||||
|
|
||||||
|
#include "../../config.h"
|
||||||
|
#define RGB_DI_PIN F6
|
||||||
|
#define RGBLED_NUM 10
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
#ifdef BACKLIGHT_LEVELS
|
||||||
|
#undef BACKLIGHT_LEVELS
|
||||||
|
#endif
|
||||||
|
#define BACKLIGHT_LEVELS 3
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
// This is a game-pad gherkin layout with RGB and LED lights
|
||||||
|
|
||||||
|
#include "gherkin.h"
|
||||||
|
|
||||||
|
backlight_config_t backlight_config;
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
/* Game pad
|
||||||
|
* ,-----------------------------------------------------------.
|
||||||
|
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | Ctl | Alt | ~ |
|
||||||
|
* |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||||
|
* | Tab | Q | W | E | R | T | |^| | ; | ' | / |
|
||||||
|
* |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----|
|
||||||
|
* | Shf | A | S | D | F | <-- | |v| | --> | , | . |
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
KEYMAP(
|
||||||
|
KC_ESCAPE, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_LCTRL, KC_LALT, KC_GRAVE,
|
||||||
|
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_UP, KC_SCLN, KC_QUOTE, KC_SLASH,
|
||||||
|
KC_LSHIFT, KC_A, KC_S, KC_D, KC_F, KC_LEFT, KC_DOWN, KC_RIGHT, KC_COMMA, KC_DOT
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
void matrix_init_user(void) {
|
||||||
|
// Set LED's to max
|
||||||
|
_delay_us(300);
|
||||||
|
backlight_config.level = 2;
|
||||||
|
backlight_config.enable = 1;
|
||||||
|
eeconfig_update_backlight(backlight_config.raw);
|
||||||
|
backlight_set(backlight_config.level);
|
||||||
|
// Set RGB to rainbow mood light
|
||||||
|
rgblight_enable();
|
||||||
|
rgblight_mode(1);
|
||||||
|
rgblight_sethsv(120,255,255);
|
||||||
|
rgblight_mode(6);
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
ifndef QUANTUM_DIR
|
||||||
|
include ../../../../Makefile
|
||||||
|
endif
|
||||||
|
|
||||||
|
STENO_ENABLE = no # Additional protocols for Stenography(+1700), requires VIRTSER
|
||||||
|
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
|
||||||
|
EXTRAKEY_ENABLE = no # Audio control and System control(+450)
|
||||||
|
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||||
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
|
AUDIO_ENABLE = no # Enable audio output from keyboard
|
||||||
|
RGBLIGHT_ENABLE = yes # Enable RBG light strips
|
||||||
|
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2012 Jun Wako <[email protected]>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#include "config_common.h"
|
||||||
|
|
||||||
|
/* USB Device descriptor parameter */
|
||||||
|
#define VENDOR_ID 0xFEED
|
||||||
|
#define PRODUCT_ID 0x3060
|
||||||
|
#define DEVICE_VER 0x0001
|
||||||
|
#define MANUFACTURER mtdjr
|
||||||
|
#define PRODUCT Not So MiniDox
|
||||||
|
#define DESCRIPTION A larger version of the MiniDox
|
||||||
|
|
||||||
|
/* key matrix size */
|
||||||
|
// Rows are doubled-up
|
||||||
|
#define MATRIX_ROWS 8
|
||||||
|
#define MATRIX_COLS 6
|
||||||
|
|
||||||
|
/* COL2ROW or ROW2COL */
|
||||||
|
#define DIODE_DIRECTION COL2ROW
|
||||||
|
|
||||||
|
// wiring of each half
|
||||||
|
#define MATRIX_ROW_PINS { D7, E6, B4, B5 }
|
||||||
|
#define MATRIX_COL_PINS { B6, B2, B3, B1, F7, D4 }
|
||||||
|
|
||||||
|
#define USE_SERIAL
|
||||||
|
|
||||||
|
//#define EE_HANDS
|
||||||
|
|
||||||
|
#define MASTER_LEFT
|
||||||
|
//#define MASTER_RIGHT
|
||||||
|
|
||||||
|
/* define if matrix has ghost */
|
||||||
|
//#define MATRIX_HAS_GHOST
|
||||||
|
|
||||||
|
/* number of backlight levels */
|
||||||
|
// #define BACKLIGHT_LEVELS 3
|
||||||
|
|
||||||
|
/* Set 0 if debouncing isn't needed */
|
||||||
|
#define DEBOUNCING_DELAY 5
|
||||||
|
|
||||||
|
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||||
|
#define LOCKING_SUPPORT_ENABLE
|
||||||
|
/* Locking resynchronize hack */
|
||||||
|
#define LOCKING_RESYNC_ENABLE
|
||||||
|
|
||||||
|
/* key combination for command */
|
||||||
|
#define IS_COMMAND() ( \
|
||||||
|
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/* disable debug print */
|
||||||
|
//#define NO_DEBUG
|
||||||
|
|
||||||
|
/* disable print */
|
||||||
|
//#define NO_PRINT
|
||||||
|
|
||||||
|
/* disable action features */
|
||||||
|
//#define NO_ACTION_LAYER
|
||||||
|
//#define NO_ACTION_TAPPING
|
||||||
|
//#define NO_ACTION_ONESHOT
|
||||||
|
//#define NO_ACTION_MACRO
|
||||||
|
//#define NO_ACTION_FUNCTION
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,162 @@
|
|||||||
|
#include <util/twi.h>
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <util/twi.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "i2c.h"
|
||||||
|
|
||||||
|
#ifdef USE_I2C
|
||||||
|
|
||||||
|
// Limits the amount of we wait for any one i2c transaction.
|
||||||
|
// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
|
||||||
|
// 9 bits, a single transaction will take around 90μs to complete.
|
||||||
|
//
|
||||||
|
// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
|
||||||
|
// poll loop takes at least 8 clock cycles to execute
|
||||||
|
#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8
|
||||||
|
|
||||||
|
#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE)
|
||||||
|
|
||||||
|
volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
|
||||||
|
|
||||||
|
static volatile uint8_t slave_buffer_pos;
|
||||||
|
static volatile bool slave_has_register_set = false;
|
||||||
|
|
||||||
|
// Wait for an i2c operation to finish
|
||||||
|
inline static
|
||||||
|
void i2c_delay(void) {
|
||||||
|
uint16_t lim = 0;
|
||||||
|
while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT)
|
||||||
|
lim++;
|
||||||
|
|
||||||
|
// easier way, but will wait slightly longer
|
||||||
|
// _delay_us(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup twi to run at 100kHz
|
||||||
|
void i2c_master_init(void) {
|
||||||
|
// no prescaler
|
||||||
|
TWSR = 0;
|
||||||
|
// Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
|
||||||
|
// Check datasheets for more info.
|
||||||
|
TWBR = ((F_CPU/SCL_CLOCK)-16)/2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start a transaction with the given i2c slave address. The direction of the
|
||||||
|
// transfer is set with I2C_READ and I2C_WRITE.
|
||||||
|
// returns: 0 => success
|
||||||
|
// 1 => error
|
||||||
|
uint8_t i2c_master_start(uint8_t address) {
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA);
|
||||||
|
|
||||||
|
i2c_delay();
|
||||||
|
|
||||||
|
// check that we started successfully
|
||||||
|
if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
TWDR = address;
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||||
|
|
||||||
|
i2c_delay();
|
||||||
|
|
||||||
|
if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) )
|
||||||
|
return 1; // slave did not acknowledge
|
||||||
|
else
|
||||||
|
return 0; // success
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Finish the i2c transaction.
|
||||||
|
void i2c_master_stop(void) {
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
|
||||||
|
|
||||||
|
uint16_t lim = 0;
|
||||||
|
while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT)
|
||||||
|
lim++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write one byte to the i2c slave.
|
||||||
|
// returns 0 => slave ACK
|
||||||
|
// 1 => slave NACK
|
||||||
|
uint8_t i2c_master_write(uint8_t data) {
|
||||||
|
TWDR = data;
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||||
|
|
||||||
|
i2c_delay();
|
||||||
|
|
||||||
|
// check if the slave acknowledged us
|
||||||
|
return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
|
||||||
|
// if ack=0 the acknowledge bit is not set.
|
||||||
|
// returns: byte read from i2c device
|
||||||
|
uint8_t i2c_master_read(int ack) {
|
||||||
|
TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA);
|
||||||
|
|
||||||
|
i2c_delay();
|
||||||
|
return TWDR;
|
||||||
|
}
|
||||||
|
|
||||||
|
void i2c_reset_state(void) {
|
||||||
|
TWCR = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void i2c_slave_init(uint8_t address) {
|
||||||
|
TWAR = address << 0; // slave i2c address
|
||||||
|
// TWEN - twi enable
|
||||||
|
// TWEA - enable address acknowledgement
|
||||||
|
// TWINT - twi interrupt flag
|
||||||
|
// TWIE - enable the twi interrupt
|
||||||
|
TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
ISR(TWI_vect);
|
||||||
|
|
||||||
|
ISR(TWI_vect) {
|
||||||
|
uint8_t ack = 1;
|
||||||
|
switch(TW_STATUS) {
|
||||||
|
case TW_SR_SLA_ACK:
|
||||||
|
// this device has been addressed as a slave receiver
|
||||||
|
slave_has_register_set = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TW_SR_DATA_ACK:
|
||||||
|
// this device has received data as a slave receiver
|
||||||
|
// The first byte that we receive in this transaction sets the location
|
||||||
|
// of the read/write location of the slaves memory that it exposes over
|
||||||
|
// i2c. After that, bytes will be written at slave_buffer_pos, incrementing
|
||||||
|
// slave_buffer_pos after each write.
|
||||||
|
if(!slave_has_register_set) {
|
||||||
|
slave_buffer_pos = TWDR;
|
||||||
|
// don't acknowledge the master if this memory loctaion is out of bounds
|
||||||
|
if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) {
|
||||||
|
ack = 0;
|
||||||
|
slave_buffer_pos = 0;
|
||||||
|
}
|
||||||
|
slave_has_register_set = true;
|
||||||
|
} else {
|
||||||
|
i2c_slave_buffer[slave_buffer_pos] = TWDR;
|
||||||
|
BUFFER_POS_INC();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TW_ST_SLA_ACK:
|
||||||
|
case TW_ST_DATA_ACK:
|
||||||
|
// master has addressed this device as a slave transmitter and is
|
||||||
|
// requesting data.
|
||||||
|
TWDR = i2c_slave_buffer[slave_buffer_pos];
|
||||||
|
BUFFER_POS_INC();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TW_BUS_ERROR: // something went wrong, reset twi state
|
||||||
|
TWCR = 0;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Reset everything, so we are ready for the next TWI interrupt
|
||||||
|
TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
#ifndef I2C_H
|
||||||
|
#define I2C_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifndef F_CPU
|
||||||
|
#define F_CPU 16000000UL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define I2C_READ 1
|
||||||
|
#define I2C_WRITE 0
|
||||||
|
|
||||||
|
#define I2C_ACK 1
|
||||||
|
#define I2C_NACK 0
|
||||||
|
|
||||||
|
#define SLAVE_BUFFER_SIZE 0x10
|
||||||
|
|
||||||
|
// i2c SCL clock frequency
|
||||||
|
#define SCL_CLOCK 400000L
|
||||||
|
|
||||||
|
extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
|
||||||
|
|
||||||
|
void i2c_master_init(void);
|
||||||
|
uint8_t i2c_master_start(uint8_t address);
|
||||||
|
void i2c_master_stop(void);
|
||||||
|
uint8_t i2c_master_write(uint8_t data);
|
||||||
|
uint8_t i2c_master_read(int);
|
||||||
|
void i2c_reset_state(void);
|
||||||
|
void i2c_slave_init(uint8_t address);
|
||||||
|
|
||||||
|
|
||||||
|
static inline unsigned char i2c_start_read(unsigned char addr) {
|
||||||
|
return i2c_master_start((addr << 1) | I2C_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned char i2c_start_write(unsigned char addr) {
|
||||||
|
return i2c_master_start((addr << 1) | I2C_WRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// from SSD1306 scrips
|
||||||
|
extern unsigned char i2c_rep_start(unsigned char addr);
|
||||||
|
extern void i2c_start_wait(unsigned char addr);
|
||||||
|
extern unsigned char i2c_readAck(void);
|
||||||
|
extern unsigned char i2c_readNak(void);
|
||||||
|
extern unsigned char i2c_read(unsigned char ack);
|
||||||
|
|
||||||
|
#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak();
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
#include QMK_KEYBOARD_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 _LOWER 1
|
||||||
|
#define _RAISE 2
|
||||||
|
#define _ADJUST 16
|
||||||
|
|
||||||
|
enum custom_keycodes {
|
||||||
|
QWERTY = SAFE_RANGE,
|
||||||
|
LOWER,
|
||||||
|
RAISE,
|
||||||
|
ADJUST,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Fillers to make layering more clear
|
||||||
|
#define _______ KC_TRNS
|
||||||
|
#define XXXXXXX KC_NO
|
||||||
|
|
||||||
|
#define KC_LOWR LOWER
|
||||||
|
#define KC_RASE RAISE
|
||||||
|
#define KC_RST RESET
|
||||||
|
#define KC_CAD LCTL(LALT(KC_DEL))
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
[_QWERTY] = LAYOUT(
|
||||||
|
// ,-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------.
|
||||||
|
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_LCTL, 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,
|
||||||
|
// '-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------'
|
||||||
|
KC_LGUI,KC_LOWR, KC_SPC, KC_SPC,KC_RASE,KC_RALT
|
||||||
|
// `-------+-------+-------` `-------+-------+-------`
|
||||||
|
),
|
||||||
|
|
||||||
|
[_LOWER] = LAYOUT(
|
||||||
|
// ,-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------.
|
||||||
|
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL,
|
||||||
|
// |-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------|
|
||||||
|
_______,_______,_______,_______,_______,_______, _______,_______,_______,KC_LCBR,KC_RCBR,KC_BSLS,
|
||||||
|
// |-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------|
|
||||||
|
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,
|
||||||
|
// '-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------'
|
||||||
|
_______,_______,_______, _______,_______,_______
|
||||||
|
// `-------+-------+-------` `-------+-------+-------`
|
||||||
|
),
|
||||||
|
|
||||||
|
[_RAISE] = LAYOUT(
|
||||||
|
// ,-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------.
|
||||||
|
KC_GRV,KC_EXLM, KC_AT,KC_HASH, KC_DLR,KC_PERC, KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,KC_RPRN, KC_DEL,
|
||||||
|
// |-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------|
|
||||||
|
_______,_______,_______,_______,KC_MINS, KC_EQL, _______, KC_UP,_______,KC_LBRC,KC_RBRC,KC_PIPE,
|
||||||
|
// |-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------|
|
||||||
|
_______,_______,_______,_______,_______,_______, KC_LEFT,KC_DOWN,KC_RGHT,_______,_______,_______,
|
||||||
|
// '-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------'
|
||||||
|
_______,_______,_______, _______,_______,_______
|
||||||
|
// `-------+-------+-------` `-------+-------+-------`
|
||||||
|
),
|
||||||
|
[_ADJUST] = LAYOUT(
|
||||||
|
// ,-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------.
|
||||||
|
_______,_______,_______,_______, KC_RST,_______, _______,_______,_______,_______,_______, KC_CAD,
|
||||||
|
// |-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------|
|
||||||
|
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,
|
||||||
|
// |-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------|
|
||||||
|
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,
|
||||||
|
// '-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------'
|
||||||
|
_______,_______,_______, _______,_______,_______
|
||||||
|
// `-------+-------+-------` `-------+-------+-------`
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
|
case QWERTY:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_single_persistent_default_layer(_QWERTY);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case LOWER:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
layer_on(_LOWER);
|
||||||
|
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||||
|
} else {
|
||||||
|
layer_off(_LOWER);
|
||||||
|
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case RAISE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
layer_on(_RAISE);
|
||||||
|
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||||
|
} else {
|
||||||
|
layer_off(_RAISE);
|
||||||
|
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case ADJUST:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
layer_on(_ADJUST);
|
||||||
|
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||||
|
} else {
|
||||||
|
layer_off(_ADJUST);
|
||||||
|
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#ifndef CONFIG_USER_H
|
||||||
|
#define CONFIG_USER_H
|
||||||
|
|
||||||
|
#include QMK_KEYBOARD_CONFIG_H
|
||||||
|
|
||||||
|
#define SOLENOID_ENABLE
|
||||||
|
#define SOLENOID_PIN F6
|
||||||
|
#undef SOLENOID_ACTIVE
|
||||||
|
#define SOLENOID_ACTIVE true
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
#include "mtdjr.h"
|
||||||
|
|
||||||
|
extern keymap_config_t keymap_config;
|
||||||
|
|
||||||
|
#define KC_LOCK TD(TD_ALTLOCK)
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
[_QWERTY] = LAYOUT_kc(
|
||||||
|
// ,----+-----+-----+-----+-----+-----, ,----+-----+-----+-----+-----+-----,
|
||||||
|
TAB, Q, W, E, R, T, Y, U, I, O, P, BSPC,
|
||||||
|
// |----+-----+-----+-----+-----+-----| |----+-----+-----+-----+-----+-----|
|
||||||
|
LCTL, A, S, D, F, G, H, J, K, L, SCLN, QUOT,
|
||||||
|
// |----+-----+-----+-----+-----+-----| |----+-----+-----+-----+-----+-----|
|
||||||
|
LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, ENT,
|
||||||
|
// |----+-----+-----+-----+-----+-----|-, ,-|----+-----+-----+-----+-----+-----|
|
||||||
|
LGUI, LOWR, SPC, SPC, RASE, LOCK
|
||||||
|
// `----+-----+-----` `----+-----+-----`
|
||||||
|
),
|
||||||
|
|
||||||
|
[_LOWER] = LAYOUT_kc(
|
||||||
|
// ,----+-----+-----+-----+-----+-----, ,----+-----+-----+-----+-----+-----,
|
||||||
|
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, DEL,
|
||||||
|
// |----+-----+-----+-----+-----+-----| |----+-----+-----+-----+-----+-----|
|
||||||
|
, , , , , , , , , LCBR, RCBR, BSLS,
|
||||||
|
// |----+-----+-----+-----+-----+-----| |----+-----+-----+-----+-----+-----|
|
||||||
|
, , , XCPY, XINS, , , , , , , ,
|
||||||
|
// |----+-----+-----+-----+-----+-----|-, ,-|----+-----+-----+-----+-----+-----|
|
||||||
|
, , , , ,
|
||||||
|
// `----+-----+-----` `----+-----+-----`
|
||||||
|
),
|
||||||
|
|
||||||
|
[_RAISE] = LAYOUT_kc(
|
||||||
|
// ,----+-----+-----+-----+-----+-----, ,----+-----+-----+-----+-----+-----,
|
||||||
|
GRV, EXLM, AT, HASH, DLR, PERC, CIRC, AMPR, ASTR, LPRN, RPRN, DEL,
|
||||||
|
// |----+-----+-----+-----+-----+-----| |----+-----+-----+-----+-----+-----|
|
||||||
|
, , , , MINS, EQL, , , UP, LBRC, RBRC, PIPE,
|
||||||
|
// |----+-----+-----+-----+-----+-----| |----+-----+-----+-----+-----+-----|
|
||||||
|
, , , , , , , LEFT, DOWN, RGHT, , ,
|
||||||
|
// |----+-----+-----+-----+-----+-----|-, ,-|----+-----+-----+-----+-----+-----|
|
||||||
|
, , , , ,
|
||||||
|
// `----+-----+-----` `----+-----+-----`
|
||||||
|
),
|
||||||
|
[_ADJUST] = LAYOUT_kc(
|
||||||
|
// ,----+-----+-----+-----+-----+-----, ,----+-----+-----+-----+-----+-----,
|
||||||
|
STOG, xxxx, xxxx, xxxx, RST, xxxx, ROOT, PPLY, PSEF, xxxx, xxxx, CAD,
|
||||||
|
// |----+-----+-----+-----+-----+-----| |----+-----+-----+-----+-----+-----|
|
||||||
|
SDM, SDP, SBOF, SBON, xxxx, xxxx, xxxx, xxxx, xxxx, xxxx, xxxx, xxxx,
|
||||||
|
// |----+-----+-----+-----+-----+-----| |----+-----+-----+-----+-----+-----|
|
||||||
|
xxxx, xxxx, xxxx, xxxx, xxxx, xxxx, xxxx, xxxx, xxxx, xxxx, xxxx, xxxx,
|
||||||
|
// |----+-----+-----+-----+-----+-----|-, ,-|----+-----+-----+-----+-----+-----|
|
||||||
|
xxxx, , xxxx, xxxx, , xxxx
|
||||||
|
// `----+-----+-----` `----+-----+-----`
|
||||||
|
)
|
||||||
|
};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
TAP_DANCE_ENABLE = yes
|
||||||
@@ -0,0 +1,307 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2012 Jun Wako <[email protected]>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* scan matrix
|
||||||
|
*/
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/wdt.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include "print.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "matrix.h"
|
||||||
|
#include "split_util.h"
|
||||||
|
#include "pro_micro.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifdef USE_I2C
|
||||||
|
# include "i2c.h"
|
||||||
|
#else // USE_SERIAL
|
||||||
|
# include "serial.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DEBOUNCE
|
||||||
|
# define DEBOUNCE 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ERROR_DISCONNECT_COUNT 5
|
||||||
|
|
||||||
|
static uint8_t debouncing = DEBOUNCE;
|
||||||
|
static const int ROWS_PER_HAND = MATRIX_ROWS/2;
|
||||||
|
static uint8_t error_count = 0;
|
||||||
|
|
||||||
|
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||||
|
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||||
|
|
||||||
|
/* matrix state(1:on, 0:off) */
|
||||||
|
static matrix_row_t matrix[MATRIX_ROWS];
|
||||||
|
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||||
|
|
||||||
|
static matrix_row_t read_cols(void);
|
||||||
|
static void init_cols(void);
|
||||||
|
static void unselect_rows(void);
|
||||||
|
static void select_row(uint8_t row);
|
||||||
|
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_init_kb(void) {
|
||||||
|
matrix_init_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_scan_kb(void) {
|
||||||
|
matrix_scan_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_init_user(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void matrix_scan_user(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
uint8_t matrix_rows(void)
|
||||||
|
{
|
||||||
|
return MATRIX_ROWS;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
uint8_t matrix_cols(void)
|
||||||
|
{
|
||||||
|
return MATRIX_COLS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_init(void)
|
||||||
|
{
|
||||||
|
debug_enable = true;
|
||||||
|
debug_matrix = true;
|
||||||
|
debug_mouse = true;
|
||||||
|
// initialize row and col
|
||||||
|
unselect_rows();
|
||||||
|
init_cols();
|
||||||
|
|
||||||
|
TX_RX_LED_INIT;
|
||||||
|
|
||||||
|
// initialize matrix state: all keys off
|
||||||
|
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
||||||
|
matrix[i] = 0;
|
||||||
|
matrix_debouncing[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
matrix_init_quantum();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t _matrix_scan(void)
|
||||||
|
{
|
||||||
|
// Right hand is stored after the left in the matirx so, we need to offset it
|
||||||
|
int offset = isLeftHand ? 0 : (ROWS_PER_HAND);
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
|
||||||
|
select_row(i);
|
||||||
|
_delay_us(30); // without this wait read unstable value.
|
||||||
|
matrix_row_t cols = read_cols();
|
||||||
|
if (matrix_debouncing[i+offset] != cols) {
|
||||||
|
matrix_debouncing[i+offset] = cols;
|
||||||
|
debouncing = DEBOUNCE;
|
||||||
|
}
|
||||||
|
unselect_rows();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debouncing) {
|
||||||
|
if (--debouncing) {
|
||||||
|
_delay_ms(1);
|
||||||
|
} else {
|
||||||
|
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
|
||||||
|
matrix[i+offset] = matrix_debouncing[i+offset];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USE_I2C
|
||||||
|
|
||||||
|
// Get rows from other half over i2c
|
||||||
|
int i2c_transaction(void) {
|
||||||
|
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
|
||||||
|
|
||||||
|
int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
|
||||||
|
if (err) goto i2c_error;
|
||||||
|
|
||||||
|
// start of matrix stored at 0x00
|
||||||
|
err = i2c_master_write(0x00);
|
||||||
|
if (err) goto i2c_error;
|
||||||
|
|
||||||
|
// Start read
|
||||||
|
err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
|
||||||
|
if (err) goto i2c_error;
|
||||||
|
|
||||||
|
if (!err) {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < ROWS_PER_HAND-1; ++i) {
|
||||||
|
matrix[slaveOffset+i] = i2c_master_read(I2C_ACK);
|
||||||
|
}
|
||||||
|
matrix[slaveOffset+i] = i2c_master_read(I2C_NACK);
|
||||||
|
i2c_master_stop();
|
||||||
|
} else {
|
||||||
|
i2c_error: // the cable is disconnceted, or something else went wrong
|
||||||
|
i2c_reset_state();
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else // USE_SERIAL
|
||||||
|
|
||||||
|
int serial_transaction(void) {
|
||||||
|
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
|
||||||
|
|
||||||
|
if (serial_update_buffers()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||||
|
matrix[slaveOffset+i] = serial_slave_buffer[i];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uint8_t matrix_scan(void)
|
||||||
|
{
|
||||||
|
int ret = _matrix_scan();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USE_I2C
|
||||||
|
if( i2c_transaction() ) {
|
||||||
|
#else // USE_SERIAL
|
||||||
|
if( serial_transaction() ) {
|
||||||
|
#endif
|
||||||
|
// turn on the indicator led when halves are disconnected
|
||||||
|
TXLED1;
|
||||||
|
|
||||||
|
error_count++;
|
||||||
|
|
||||||
|
if (error_count > ERROR_DISCONNECT_COUNT) {
|
||||||
|
// reset other half if disconnected
|
||||||
|
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
|
||||||
|
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||||
|
matrix[slaveOffset+i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// turn off the indicator led on no error
|
||||||
|
TXLED0;
|
||||||
|
error_count = 0;
|
||||||
|
}
|
||||||
|
matrix_scan_quantum();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_slave_scan(void) {
|
||||||
|
_matrix_scan();
|
||||||
|
|
||||||
|
int offset = (isLeftHand) ? 0 : (MATRIX_ROWS / 2);
|
||||||
|
|
||||||
|
#ifdef USE_I2C
|
||||||
|
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||||
|
/* i2c_slave_buffer[i] = matrix[offset+i]; */
|
||||||
|
i2c_slave_buffer[i] = matrix[offset+i];
|
||||||
|
}
|
||||||
|
#else // USE_SERIAL
|
||||||
|
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||||
|
serial_slave_buffer[i] = matrix[offset+i];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool matrix_is_modified(void)
|
||||||
|
{
|
||||||
|
if (debouncing) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool matrix_is_on(uint8_t row, uint8_t col)
|
||||||
|
{
|
||||||
|
return (matrix[row] & ((matrix_row_t)1<<col));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
matrix_row_t matrix_get_row(uint8_t row)
|
||||||
|
{
|
||||||
|
return matrix[row];
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_print(void)
|
||||||
|
{
|
||||||
|
print("\nr/c 0123456789ABCDEF\n");
|
||||||
|
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||||
|
phex(row); print(": ");
|
||||||
|
pbin_reverse16(matrix_get_row(row));
|
||||||
|
print("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t matrix_key_count(void)
|
||||||
|
{
|
||||||
|
uint8_t count = 0;
|
||||||
|
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||||
|
count += bitpop16(matrix[i]);
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void init_cols(void)
|
||||||
|
{
|
||||||
|
for(int x = 0; x < MATRIX_COLS; x++) {
|
||||||
|
_SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF);
|
||||||
|
_SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static matrix_row_t read_cols(void)
|
||||||
|
{
|
||||||
|
matrix_row_t result = 0;
|
||||||
|
for(int x = 0; x < MATRIX_COLS; x++) {
|
||||||
|
result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void unselect_rows(void)
|
||||||
|
{
|
||||||
|
for(int x = 0; x < ROWS_PER_HAND; x++) {
|
||||||
|
_SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF);
|
||||||
|
_SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void select_row(uint8_t row)
|
||||||
|
{
|
||||||
|
_SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF);
|
||||||
|
_SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF);
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
#include "not_so_minidox.h"
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
#ifndef NOSOTMINIDOX_H
|
||||||
|
#define NOSOTMINIDOX_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "quantum.h"
|
||||||
|
|
||||||
|
#define LAYOUT( \
|
||||||
|
L00, L01, L02, L03, L04, L05, R05, R04, R03, R02, R01, R00, \
|
||||||
|
L10, L11, L12, L13, L14, L15, R15, R14, R13, R12, R11, R10, \
|
||||||
|
L20, L21, L22, L23, L24, L25, R25, R24, R23, R22, R21, R20, \
|
||||||
|
LT1, LT2, LT3, RT3, RT2, RT1 \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ L00, L01, L02, L03, L04, L05 }, \
|
||||||
|
{ L10, L11, L12, L13, L14, L15 }, \
|
||||||
|
{ L20, L21, L22, L23, L24, L25 }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, LT1, LT2, LT3 }, \
|
||||||
|
{ R00, R01, R02, R03, R04, R05 }, \
|
||||||
|
{ R10, R11, R12, R13, R14, R15 }, \
|
||||||
|
{ R20, R21, R22, R23, R24, R25 }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, RT1, RT2, RT3 }, \
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used to create a keymap using only KC_ prefixed keys
|
||||||
|
#define LAYOUT_kc( \
|
||||||
|
L00, L01, L02, L03, L04, L05, R05, R04, R03, R02, R01, R00, \
|
||||||
|
L10, L11, L12, L13, L14, L15, R15, R14, R13, R12, R11, R10, \
|
||||||
|
L20, L21, L22, L23, L24, L25, R25, R24, R23, R22, R21, R20, \
|
||||||
|
LT1, LT2, LT3, RT3, RT2, RT1 \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05 }, \
|
||||||
|
{ KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15 }, \
|
||||||
|
{ KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25 }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, KC_##LT1, KC_##LT2, KC_##LT3 }, \
|
||||||
|
{ KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05 }, \
|
||||||
|
{ KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15 }, \
|
||||||
|
{ KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25 }, \
|
||||||
|
{ KC_NO, KC_NO, KC_NO, KC_##RT1, KC_##RT2, KC_##RT3 }, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
not_so_minidox
|
||||||
|
=====
|
||||||
|
|
||||||
|
![not_so_minidox]()
|
||||||
|
|
||||||
|
A slightly larger version of the MiniDox
|
||||||
|
|
||||||
|
Keyboard Maintainer: mtdjr
|
||||||
|
Hardware Supported: None yet/ProMicro
|
||||||
|
|
||||||
|
Make example for this keyboard (after setting up your build environment):
|
||||||
|
|
||||||
|
make not_so_minidox/rev1:default
|
||||||
|
|
||||||
|
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
|
||||||
|
|
||||||
|
Flashing
|
||||||
|
-------
|
||||||
|
Note: Most of this is copied from the Let's Split readme, because it is awesome
|
||||||
|
|
||||||
|
From the root directory run `make PROJECT:KEYMAP:avrdude` for automatic serial port resolution and flashing.
|
||||||
|
Example: `make not_so_minidox/rev1:default:avrdude`
|
||||||
|
|
||||||
|
Choosing which board to plug the USB cable into (choosing Master)
|
||||||
|
--------
|
||||||
|
Because the two boards are identical, the firmware has logic to differentiate the left and right board.
|
||||||
|
|
||||||
|
It uses two strategies to figure things out: look at the EEPROM (memory on the chip) or looks if the current board has the usb cable.
|
||||||
|
|
||||||
|
The EEPROM approach requires additional setup (flashing the eeeprom) but allows you to swap the usb cable to either side.
|
||||||
|
|
||||||
|
The USB cable approach is easier to setup and if you just want the usb cable on the left board, you do not need to do anything extra.
|
||||||
|
|
||||||
|
### Setting the left hand as master
|
||||||
|
If you always plug the usb cable into the left board, nothing extra is needed as this is the default. Comment out `EE_HANDS` and comment out `I2C_MASTER_RIGHT` or `MASTER_RIGHT` if for some reason it was set.
|
||||||
|
|
||||||
|
### Setting the right hand as master
|
||||||
|
If you always plug the usb cable into the right board, add an extra flag to your `config.h`
|
||||||
|
```
|
||||||
|
#define MASTER_RIGHT
|
||||||
|
```
|
||||||
|
|
||||||
|
### Setting EE_hands to use either hands as master
|
||||||
|
If you define `EE_HANDS` in your `config.h`, you will need to set the
|
||||||
|
EEPROM for the left and right halves.
|
||||||
|
|
||||||
|
The EEPROM is used to store whether the
|
||||||
|
half is left handed or right handed. This makes it so that the same firmware
|
||||||
|
file will run on both hands instead of having to flash left and right handed
|
||||||
|
versions of the firmware to each half. To flash the EEPROM file for the left
|
||||||
|
half run:
|
||||||
|
```
|
||||||
|
avrdude -p atmega32u4 -P $(COM_PORT) -c avr109 -U eeprom:w:eeprom-lefthand.eep
|
||||||
|
// or the equivalent in dfu-programmer
|
||||||
|
|
||||||
|
```
|
||||||
|
and similarly for right half
|
||||||
|
```
|
||||||
|
avrdude -p atmega32u4 -P $(COM_PORT) -c avr109 -U eeprom:w:eeprom-righhand.eep
|
||||||
|
// or the equivalent in dfu-programmer
|
||||||
|
```
|
||||||
|
|
||||||
|
NOTE: replace `$(COM_PORT)` with the port of your device (e.g. `/dev/ttyACM0`)
|
||||||
|
|
||||||
|
After you have flashed the EEPROM, you then need to set `EE_HANDS` in your config.h, rebuild the hex files and reflash.
|
||||||
|
|
||||||
|
Note that you need to program both halves, but you have the option of using
|
||||||
|
different keymaps for each half. You could program the left half with a QWERTY
|
||||||
|
layout and the right half with a Colemak layout using bootmagic's default layout option.
|
||||||
|
Then if you connect the left half to a computer by USB the keyboard will use QWERTY and Colemak when the
|
||||||
|
right half is connected.
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
SRC += matrix.c \
|
||||||
|
i2c.c \
|
||||||
|
split_util.c \
|
||||||
|
serial.c
|
||||||
|
|
||||||
|
# MCU name
|
||||||
|
#MCU = at90usb1287
|
||||||
|
MCU = atmega32u4
|
||||||
|
|
||||||
|
# Processor frequency.
|
||||||
|
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||||
|
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||||
|
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||||
|
# automatically to create a 32-bit value in your source code.
|
||||||
|
#
|
||||||
|
# This will be an integer division of F_USB below, as it is sourced by
|
||||||
|
# F_USB after it has run through any CPU prescalers. Note that this value
|
||||||
|
# does not *change* the processor frequency - it should merely be updated to
|
||||||
|
# reflect the processor speed set externally so that the code can use accurate
|
||||||
|
# software delays.
|
||||||
|
F_CPU = 16000000
|
||||||
|
|
||||||
|
#
|
||||||
|
# LUFA specific
|
||||||
|
#
|
||||||
|
# Target architecture (see library "Board Types" documentation).
|
||||||
|
ARCH = AVR8
|
||||||
|
|
||||||
|
# Input clock frequency.
|
||||||
|
# This will define a symbol, F_USB, in all source code files equal to the
|
||||||
|
# input clock frequency (before any prescaling is performed) in Hz. This value may
|
||||||
|
# differ from F_CPU if prescaling is used on the latter, and is required as the
|
||||||
|
# raw input clock is fed directly to the PLL sections of the AVR for high speed
|
||||||
|
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
|
||||||
|
# at the end, this will be done automatically to create a 32-bit value in your
|
||||||
|
# source code.
|
||||||
|
#
|
||||||
|
# If no clock division is performed on the input clock inside the AVR (via the
|
||||||
|
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
|
||||||
|
F_USB = $(F_CPU)
|
||||||
|
|
||||||
|
# Bootloader
|
||||||
|
# This definition is optional, and if your keyboard supports multiple bootloaders of
|
||||||
|
# different sizes, comment this out, and the correct address will be loaded
|
||||||
|
# automatically (+60). See bootloader.mk for all options.
|
||||||
|
BOOTLOADER = caterina
|
||||||
|
|
||||||
|
# Interrupt driven control endpoint task(+60)
|
||||||
|
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||||
|
|
||||||
|
# Build Options
|
||||||
|
# change to "no" to disable the options, or define them in the Makefile in
|
||||||
|
# the appropriate keymap folder that will get included automatically
|
||||||
|
#
|
||||||
|
BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
|
||||||
|
MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
|
||||||
|
EXTRAKEY_ENABLE ?= no # Audio control and System control(+450)
|
||||||
|
CONSOLE_ENABLE ?= no # Console for debug(+400)
|
||||||
|
COMMAND_ENABLE ?= yes # Commands for debug and configuration
|
||||||
|
NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
|
BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality
|
||||||
|
MIDI_ENABLE ?= no # MIDI controls
|
||||||
|
AUDIO_ENABLE ?= no # 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.
|
||||||
|
USE_I2C ?= no
|
||||||
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
|
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
|
||||||
|
|
||||||
|
CUSTOM_MATRIX = yes
|
||||||
@@ -0,0 +1,228 @@
|
|||||||
|
/*
|
||||||
|
* WARNING: be careful changing this code, it is very timing dependent
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef F_CPU
|
||||||
|
#define F_CPU 16000000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "serial.h"
|
||||||
|
|
||||||
|
#ifndef USE_I2C
|
||||||
|
|
||||||
|
// Serial pulse period in microseconds. Its probably a bad idea to lower this
|
||||||
|
// value.
|
||||||
|
#define SERIAL_DELAY 24
|
||||||
|
|
||||||
|
uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
|
||||||
|
uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
|
||||||
|
|
||||||
|
#define SLAVE_DATA_CORRUPT (1<<0)
|
||||||
|
volatile uint8_t status = 0;
|
||||||
|
|
||||||
|
inline static
|
||||||
|
void serial_delay(void) {
|
||||||
|
_delay_us(SERIAL_DELAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static
|
||||||
|
void serial_output(void) {
|
||||||
|
SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// make the serial pin an input with pull-up resistor
|
||||||
|
inline static
|
||||||
|
void serial_input(void) {
|
||||||
|
SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK;
|
||||||
|
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static
|
||||||
|
uint8_t serial_read_pin(void) {
|
||||||
|
return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static
|
||||||
|
void serial_low(void) {
|
||||||
|
SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static
|
||||||
|
void serial_high(void) {
|
||||||
|
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void serial_master_init(void) {
|
||||||
|
serial_output();
|
||||||
|
serial_high();
|
||||||
|
}
|
||||||
|
|
||||||
|
void serial_slave_init(void) {
|
||||||
|
serial_input();
|
||||||
|
|
||||||
|
// Enable INT0
|
||||||
|
EIMSK |= _BV(INT0);
|
||||||
|
// Trigger on falling edge of INT0
|
||||||
|
EICRA &= ~(_BV(ISC00) | _BV(ISC01));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used by the master to synchronize timing with the slave.
|
||||||
|
static
|
||||||
|
void sync_recv(void) {
|
||||||
|
serial_input();
|
||||||
|
// This shouldn't hang if the slave disconnects because the
|
||||||
|
// serial line will float to high if the slave does disconnect.
|
||||||
|
while (!serial_read_pin());
|
||||||
|
serial_delay();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used by the slave to send a synchronization signal to the master.
|
||||||
|
static
|
||||||
|
void sync_send(void) {
|
||||||
|
serial_output();
|
||||||
|
|
||||||
|
serial_low();
|
||||||
|
serial_delay();
|
||||||
|
|
||||||
|
serial_high();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reads a byte from the serial line
|
||||||
|
static
|
||||||
|
uint8_t serial_read_byte(void) {
|
||||||
|
uint8_t byte = 0;
|
||||||
|
serial_input();
|
||||||
|
for ( uint8_t i = 0; i < 8; ++i) {
|
||||||
|
byte = (byte << 1) | serial_read_pin();
|
||||||
|
serial_delay();
|
||||||
|
_delay_us(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return byte;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sends a byte with MSB ordering
|
||||||
|
static
|
||||||
|
void serial_write_byte(uint8_t data) {
|
||||||
|
uint8_t b = 8;
|
||||||
|
serial_output();
|
||||||
|
while( b-- ) {
|
||||||
|
if(data & (1 << b)) {
|
||||||
|
serial_high();
|
||||||
|
} else {
|
||||||
|
serial_low();
|
||||||
|
}
|
||||||
|
serial_delay();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// interrupt handle to be used by the slave device
|
||||||
|
ISR(SERIAL_PIN_INTERRUPT) {
|
||||||
|
sync_send();
|
||||||
|
|
||||||
|
uint8_t checksum = 0;
|
||||||
|
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
|
||||||
|
serial_write_byte(serial_slave_buffer[i]);
|
||||||
|
sync_send();
|
||||||
|
checksum += serial_slave_buffer[i];
|
||||||
|
}
|
||||||
|
serial_write_byte(checksum);
|
||||||
|
sync_send();
|
||||||
|
|
||||||
|
// wait for the sync to finish sending
|
||||||
|
serial_delay();
|
||||||
|
|
||||||
|
// read the middle of pulses
|
||||||
|
_delay_us(SERIAL_DELAY/2);
|
||||||
|
|
||||||
|
uint8_t checksum_computed = 0;
|
||||||
|
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
|
||||||
|
serial_master_buffer[i] = serial_read_byte();
|
||||||
|
sync_send();
|
||||||
|
checksum_computed += serial_master_buffer[i];
|
||||||
|
}
|
||||||
|
uint8_t checksum_received = serial_read_byte();
|
||||||
|
sync_send();
|
||||||
|
|
||||||
|
serial_input(); // end transaction
|
||||||
|
|
||||||
|
if ( checksum_computed != checksum_received ) {
|
||||||
|
status |= SLAVE_DATA_CORRUPT;
|
||||||
|
} else {
|
||||||
|
status &= ~SLAVE_DATA_CORRUPT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool serial_slave_DATA_CORRUPT(void) {
|
||||||
|
return status & SLAVE_DATA_CORRUPT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copies the serial_slave_buffer to the master and sends the
|
||||||
|
// serial_master_buffer to the slave.
|
||||||
|
//
|
||||||
|
// Returns:
|
||||||
|
// 0 => no error
|
||||||
|
// 1 => slave did not respond
|
||||||
|
int serial_update_buffers(void) {
|
||||||
|
// this code is very time dependent, so we need to disable interrupts
|
||||||
|
cli();
|
||||||
|
|
||||||
|
// signal to the slave that we want to start a transaction
|
||||||
|
serial_output();
|
||||||
|
serial_low();
|
||||||
|
_delay_us(1);
|
||||||
|
|
||||||
|
// wait for the slaves response
|
||||||
|
serial_input();
|
||||||
|
serial_high();
|
||||||
|
_delay_us(SERIAL_DELAY);
|
||||||
|
|
||||||
|
// check if the slave is present
|
||||||
|
if (serial_read_pin()) {
|
||||||
|
// slave failed to pull the line low, assume not present
|
||||||
|
sei();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the slave is present syncronize with it
|
||||||
|
sync_recv();
|
||||||
|
|
||||||
|
uint8_t checksum_computed = 0;
|
||||||
|
// receive data from the slave
|
||||||
|
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
|
||||||
|
serial_slave_buffer[i] = serial_read_byte();
|
||||||
|
sync_recv();
|
||||||
|
checksum_computed += serial_slave_buffer[i];
|
||||||
|
}
|
||||||
|
uint8_t checksum_received = serial_read_byte();
|
||||||
|
sync_recv();
|
||||||
|
|
||||||
|
if (checksum_computed != checksum_received) {
|
||||||
|
sei();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t checksum = 0;
|
||||||
|
// send data to the slave
|
||||||
|
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
|
||||||
|
serial_write_byte(serial_master_buffer[i]);
|
||||||
|
sync_recv();
|
||||||
|
checksum += serial_master_buffer[i];
|
||||||
|
}
|
||||||
|
serial_write_byte(checksum);
|
||||||
|
sync_recv();
|
||||||
|
|
||||||
|
// always, release the line when not in use
|
||||||
|
serial_output();
|
||||||
|
serial_high();
|
||||||
|
|
||||||
|
sei();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#ifndef MY_SERIAL_H
|
||||||
|
#define MY_SERIAL_H
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
/* TODO: some defines for interrupt setup */
|
||||||
|
#define SERIAL_PIN_DDR DDRD
|
||||||
|
#define SERIAL_PIN_PORT PORTD
|
||||||
|
#define SERIAL_PIN_INPUT PIND
|
||||||
|
#define SERIAL_PIN_MASK _BV(PD0)
|
||||||
|
#define SERIAL_PIN_INTERRUPT INT0_vect
|
||||||
|
|
||||||
|
#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
|
||||||
|
#define SERIAL_MASTER_BUFFER_LENGTH 1
|
||||||
|
|
||||||
|
// Buffers for master - slave communication
|
||||||
|
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
|
||||||
|
extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
|
||||||
|
|
||||||
|
void serial_master_init(void);
|
||||||
|
void serial_slave_init(void);
|
||||||
|
int serial_update_buffers(void);
|
||||||
|
bool serial_slave_data_corrupt(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
#include <avr/io.h>
|
||||||
|
#include <avr/wdt.h>
|
||||||
|
#include <avr/power.h>
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
#include <util/delay.h>
|
||||||
|
#include <avr/eeprom.h>
|
||||||
|
#include "split_util.h"
|
||||||
|
#include "matrix.h"
|
||||||
|
#include "keyboard.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifdef USE_I2C
|
||||||
|
# include "i2c.h"
|
||||||
|
#else
|
||||||
|
# include "serial.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
volatile bool isLeftHand = true;
|
||||||
|
|
||||||
|
static void setup_handedness(void) {
|
||||||
|
#ifdef EE_HANDS
|
||||||
|
isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
|
||||||
|
#else
|
||||||
|
// I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
|
||||||
|
#if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
|
||||||
|
isLeftHand = !has_usb();
|
||||||
|
#else
|
||||||
|
isLeftHand = has_usb();
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void keyboard_master_setup(void) {
|
||||||
|
#ifdef USE_I2C
|
||||||
|
i2c_master_init();
|
||||||
|
#ifdef SSD1306OLED
|
||||||
|
matrix_master_OLED_init ();
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
serial_master_init();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void keyboard_slave_setup(void) {
|
||||||
|
#ifdef USE_I2C
|
||||||
|
i2c_slave_init(SLAVE_I2C_ADDRESS);
|
||||||
|
#else
|
||||||
|
serial_slave_init();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool has_usb(void) {
|
||||||
|
USBCON |= (1 << OTGPADE); //enables VBUS pad
|
||||||
|
_delay_us(5);
|
||||||
|
return (USBSTA & (1<<VBUS)); //checks state of VBUS
|
||||||
|
}
|
||||||
|
|
||||||
|
void split_keyboard_setup(void) {
|
||||||
|
setup_handedness();
|
||||||
|
|
||||||
|
if (has_usb()) {
|
||||||
|
keyboard_master_setup();
|
||||||
|
} else {
|
||||||
|
keyboard_slave_setup();
|
||||||
|
}
|
||||||
|
sei();
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyboard_slave_loop(void) {
|
||||||
|
matrix_init();
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
matrix_slave_scan();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// this code runs before the usb and keyboard is initialized
|
||||||
|
void matrix_setup(void) {
|
||||||
|
split_keyboard_setup();
|
||||||
|
|
||||||
|
if (!has_usb()) {
|
||||||
|
keyboard_slave_loop();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#ifndef SPLIT_KEYBOARD_UTIL_H
|
||||||
|
#define SPLIT_KEYBOARD_UTIL_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "eeconfig.h"
|
||||||
|
|
||||||
|
#define SLAVE_I2C_ADDRESS 0x32
|
||||||
|
|
||||||
|
extern volatile bool isLeftHand;
|
||||||
|
|
||||||
|
// slave version of matix scan, defined in matrix.c
|
||||||
|
void matrix_slave_scan(void);
|
||||||
|
|
||||||
|
void split_keyboard_setup(void);
|
||||||
|
bool has_usb(void);
|
||||||
|
void keyboard_slave_loop(void);
|
||||||
|
|
||||||
|
void matrix_master_OLED_init (void);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -32,7 +32,7 @@ extern uint8_t is_master;
|
|||||||
#define _DVORAK 2
|
#define _DVORAK 2
|
||||||
#define _LOWER 3
|
#define _LOWER 3
|
||||||
#define _RAISE 4
|
#define _RAISE 4
|
||||||
#define _ADJUST 16
|
#define _ADJUST 6
|
||||||
|
|
||||||
enum custom_keycodes {
|
enum custom_keycodes {
|
||||||
QWERTY = SAFE_RANGE,
|
QWERTY = SAFE_RANGE,
|
||||||
@@ -513,6 +513,12 @@ void music_scale_user(void)
|
|||||||
#ifdef SSD1306OLED
|
#ifdef SSD1306OLED
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
void matrix_scan_user(void) {
|
||||||
|
static int scan_count = 0;
|
||||||
|
if( scan_count == 2 ) {
|
||||||
|
rgblight_enable();
|
||||||
|
rgblight_mode(35);
|
||||||
|
}
|
||||||
|
if( scan_count < 3 ) scan_count ++;
|
||||||
iota_gfx_task(); // this is what updates the display continuously
|
iota_gfx_task(); // this is what updates the display continuously
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,15 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "led_tables.h"
|
#include "led_tables.h"
|
||||||
|
|
||||||
|
#ifndef RGBLIGHT_LIMIT_VAL
|
||||||
|
#define RGBLIGHT_LIMIT_VAL 255
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||||
|
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||||
|
|
||||||
__attribute__ ((weak))
|
__attribute__ ((weak))
|
||||||
const uint16_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {1024, 20, 10, 5}; //modify for led_test
|
const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5};
|
||||||
__attribute__ ((weak))
|
__attribute__ ((weak))
|
||||||
const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {120, 60, 30};
|
const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {120, 60, 30};
|
||||||
__attribute__ ((weak))
|
__attribute__ ((weak))
|
||||||
@@ -35,9 +42,10 @@ __attribute__ ((weak))
|
|||||||
const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63, 31};
|
const uint8_t RGBLED_KNIGHT_INTERVALS[] PROGMEM = {127, 63, 31};
|
||||||
__attribute__ ((weak))
|
__attribute__ ((weak))
|
||||||
const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90};
|
const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90};
|
||||||
|
__attribute__ ((weak))
|
||||||
|
const uint16_t RGBLED_RGBCYCLIC_INTERVALS[] PROGMEM = {1024};
|
||||||
|
|
||||||
rgblight_config_t rgblight_config;
|
rgblight_config_t rgblight_config;
|
||||||
rgblight_config_t inmem_config;
|
|
||||||
|
|
||||||
LED_TYPE led[RGBLED_NUM];
|
LED_TYPE led[RGBLED_NUM];
|
||||||
uint8_t rgblight_inited = 0;
|
uint8_t rgblight_inited = 0;
|
||||||
@@ -46,11 +54,9 @@ bool rgblight_timer_enabled = false;
|
|||||||
void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) {
|
void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) {
|
||||||
uint8_t r = 0, g = 0, b = 0, base, color;
|
uint8_t r = 0, g = 0, b = 0, base, color;
|
||||||
|
|
||||||
#ifdef RGBLIGHT_LIMIT_VAL
|
if (val > RGBLIGHT_LIMIT_VAL) {
|
||||||
if (val > RGBLIGHT_LIMIT_VAL) {
|
|
||||||
val=RGBLIGHT_LIMIT_VAL; // limit the val
|
val=RGBLIGHT_LIMIT_VAL; // limit the val
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (sat == 0) { // Acromatic color (gray). Hue doesn't mind.
|
if (sat == 0) { // Acromatic color (gray). Hue doesn't mind.
|
||||||
r = val;
|
r = val;
|
||||||
@@ -119,7 +125,8 @@ void eeconfig_update_rgblight_default(void) {
|
|||||||
rgblight_config.mode = 1;
|
rgblight_config.mode = 1;
|
||||||
rgblight_config.hue = 0;
|
rgblight_config.hue = 0;
|
||||||
rgblight_config.sat = 255;
|
rgblight_config.sat = 255;
|
||||||
rgblight_config.val = 255;
|
rgblight_config.val = RGBLIGHT_LIMIT_VAL;
|
||||||
|
rgblight_config.speed = 0;
|
||||||
eeconfig_update_rgblight(rgblight_config.raw);
|
eeconfig_update_rgblight(rgblight_config.raw);
|
||||||
}
|
}
|
||||||
void eeconfig_debug_rgblight(void) {
|
void eeconfig_debug_rgblight(void) {
|
||||||
@@ -129,6 +136,7 @@ void eeconfig_debug_rgblight(void) {
|
|||||||
dprintf("rgblight_config.hue = %d\n", rgblight_config.hue);
|
dprintf("rgblight_config.hue = %d\n", rgblight_config.hue);
|
||||||
dprintf("rgblight_config.sat = %d\n", rgblight_config.sat);
|
dprintf("rgblight_config.sat = %d\n", rgblight_config.sat);
|
||||||
dprintf("rgblight_config.val = %d\n", rgblight_config.val);
|
dprintf("rgblight_config.val = %d\n", rgblight_config.val);
|
||||||
|
dprintf("rgblight_config.speed = %d\n", rgblight_config.speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgblight_init(void) {
|
void rgblight_init(void) {
|
||||||
@@ -154,7 +162,7 @@ void rgblight_init(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (rgblight_config.enable) {
|
if (rgblight_config.enable) {
|
||||||
rgblight_mode(rgblight_config.mode);
|
rgblight_mode_noeeprom(rgblight_config.mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +219,7 @@ uint32_t rgblight_get_mode(void) {
|
|||||||
return rgblight_config.mode;
|
return rgblight_config.mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgblight_mode(uint8_t mode) {
|
void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
|
||||||
if (!rgblight_config.enable) {
|
if (!rgblight_config.enable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -222,13 +230,18 @@ void rgblight_mode(uint8_t mode) {
|
|||||||
} else {
|
} else {
|
||||||
rgblight_config.mode = mode;
|
rgblight_config.mode = mode;
|
||||||
}
|
}
|
||||||
eeconfig_update_rgblight(rgblight_config.raw);
|
if (write_to_eeprom) {
|
||||||
xprintf("rgblight mode: %u\n", rgblight_config.mode);
|
eeconfig_update_rgblight(rgblight_config.raw);
|
||||||
|
xprintf("rgblight mode [EEPROM]: %u\n", rgblight_config.mode);
|
||||||
|
} else {
|
||||||
|
xprintf("rgblight mode [NOEEPROM]: %u\n", rgblight_config.mode);
|
||||||
|
}
|
||||||
if (rgblight_config.mode == 1) {
|
if (rgblight_config.mode == 1) {
|
||||||
#ifdef RGBLIGHT_ANIMATIONS
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
rgblight_timer_disable();
|
rgblight_timer_disable();
|
||||||
#endif
|
#endif
|
||||||
} else if (rgblight_config.mode >= 2 && rgblight_config.mode <= 24) {
|
} else if ((rgblight_config.mode >= 2 && rgblight_config.mode <= 24) ||
|
||||||
|
rgblight_config.mode == 35 ) {
|
||||||
// MODE 2-5, breathing
|
// MODE 2-5, breathing
|
||||||
// MODE 6-8, rainbow mood
|
// MODE 6-8, rainbow mood
|
||||||
// MODE 9-14, rainbow swirl
|
// MODE 9-14, rainbow swirl
|
||||||
@@ -236,6 +249,7 @@ void rgblight_mode(uint8_t mode) {
|
|||||||
// MODE 21-23, knight
|
// MODE 21-23, knight
|
||||||
// MODE 24, xmas
|
// MODE 24, xmas
|
||||||
// MODE 25-34, static rainbow
|
// MODE 25-34, static rainbow
|
||||||
|
// MODE 35 RGB cyclic
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ANIMATIONS
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
rgblight_timer_enable();
|
rgblight_timer_enable();
|
||||||
@@ -247,11 +261,20 @@ void rgblight_mode(uint8_t mode) {
|
|||||||
rgblight_timer_disable();
|
rgblight_timer_disable();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
|
rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rgblight_mode(uint8_t mode) {
|
||||||
|
rgblight_mode_eeprom_helper(mode, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_mode_noeeprom(uint8_t mode) {
|
||||||
|
rgblight_mode_eeprom_helper(mode, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void rgblight_toggle(void) {
|
void rgblight_toggle(void) {
|
||||||
xprintf("rgblight toggle: rgblight_config.enable = %u\n", !rgblight_config.enable);
|
xprintf("rgblight toggle [EEPROM]: rgblight_config.enable = %u\n", !rgblight_config.enable);
|
||||||
if (rgblight_config.enable) {
|
if (rgblight_config.enable) {
|
||||||
rgblight_disable();
|
rgblight_disable();
|
||||||
}
|
}
|
||||||
@@ -260,17 +283,34 @@ void rgblight_toggle(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rgblight_toggle_noeeprom(void) {
|
||||||
|
xprintf("rgblight toggle [NOEEPROM]: rgblight_config.enable = %u\n", !rgblight_config.enable);
|
||||||
|
if (rgblight_config.enable) {
|
||||||
|
rgblight_disable_noeeprom();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rgblight_enable_noeeprom();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void rgblight_enable(void) {
|
void rgblight_enable(void) {
|
||||||
rgblight_config.enable = 1;
|
rgblight_config.enable = 1;
|
||||||
eeconfig_update_rgblight(rgblight_config.raw);
|
// No need to update EEPROM here. rgblight_mode() will do that, actually
|
||||||
xprintf("rgblight enable: rgblight_config.enable = %u\n", rgblight_config.enable);
|
//eeconfig_update_rgblight(rgblight_config.raw);
|
||||||
|
xprintf("rgblight enable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable);
|
||||||
rgblight_mode(rgblight_config.mode);
|
rgblight_mode(rgblight_config.mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rgblight_enable_noeeprom(void) {
|
||||||
|
rgblight_config.enable = 1;
|
||||||
|
xprintf("rgblight enable [NOEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable);
|
||||||
|
rgblight_mode_noeeprom(rgblight_config.mode);
|
||||||
|
}
|
||||||
|
|
||||||
void rgblight_disable(void) {
|
void rgblight_disable(void) {
|
||||||
rgblight_config.enable = 0;
|
rgblight_config.enable = 0;
|
||||||
eeconfig_update_rgblight(rgblight_config.raw);
|
eeconfig_update_rgblight(rgblight_config.raw);
|
||||||
xprintf("rgblight disable: rgblight_config.enable = %u\n", rgblight_config.enable);
|
xprintf("rgblight disable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable);
|
||||||
#ifdef RGBLIGHT_ANIMATIONS
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
rgblight_timer_disable();
|
rgblight_timer_disable();
|
||||||
#endif
|
#endif
|
||||||
@@ -278,6 +318,29 @@ void rgblight_disable(void) {
|
|||||||
rgblight_set();
|
rgblight_set();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rgblight_disable_noeeprom(void) {
|
||||||
|
rgblight_config.enable = 0;
|
||||||
|
xprintf("rgblight disable [noEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable);
|
||||||
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
|
rgblight_timer_disable();
|
||||||
|
#endif
|
||||||
|
_delay_ms(50);
|
||||||
|
rgblight_set();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Deals with the messy details of incrementing an integer
|
||||||
|
uint8_t increment( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
|
||||||
|
int16_t new_value = value;
|
||||||
|
new_value += step;
|
||||||
|
return MIN( MAX( new_value, min ), max );
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t decrement( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) {
|
||||||
|
int16_t new_value = value;
|
||||||
|
new_value -= step;
|
||||||
|
return MIN( MAX( new_value, min ), max );
|
||||||
|
}
|
||||||
|
|
||||||
void rgblight_increase_hue(void) {
|
void rgblight_increase_hue(void) {
|
||||||
uint16_t hue;
|
uint16_t hue;
|
||||||
@@ -313,8 +376,8 @@ void rgblight_decrease_sat(void) {
|
|||||||
}
|
}
|
||||||
void rgblight_increase_val(void) {
|
void rgblight_increase_val(void) {
|
||||||
uint8_t val;
|
uint8_t val;
|
||||||
if (rgblight_config.val + RGBLIGHT_VAL_STEP > 255) {
|
if (rgblight_config.val + RGBLIGHT_VAL_STEP > RGBLIGHT_LIMIT_VAL) {
|
||||||
val = 255;
|
val = RGBLIGHT_LIMIT_VAL;
|
||||||
} else {
|
} else {
|
||||||
val = rgblight_config.val + RGBLIGHT_VAL_STEP;
|
val = rgblight_config.val + RGBLIGHT_VAL_STEP;
|
||||||
}
|
}
|
||||||
@@ -329,24 +392,32 @@ void rgblight_decrease_val(void) {
|
|||||||
}
|
}
|
||||||
rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, val);
|
rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, val);
|
||||||
}
|
}
|
||||||
|
void rgblight_increase_speed(void) {
|
||||||
|
rgblight_config.speed = increment( rgblight_config.speed, 1, 0, 3 );
|
||||||
|
eeconfig_update_rgblight(rgblight_config.raw);//EECONFIG needs to be increased to support this
|
||||||
|
}
|
||||||
|
|
||||||
void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) {
|
void rgblight_decrease_speed(void) {
|
||||||
inmem_config.raw = rgblight_config.raw;
|
rgblight_config.speed = decrement( rgblight_config.speed, 1, 0, 3 );
|
||||||
|
eeconfig_update_rgblight(rgblight_config.raw);//EECONFIG needs to be increased to support this
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_sethsv_noeeprom_old(uint16_t hue, uint8_t sat, uint8_t val) {
|
||||||
if (rgblight_config.enable) {
|
if (rgblight_config.enable) {
|
||||||
LED_TYPE tmp_led;
|
LED_TYPE tmp_led;
|
||||||
sethsv(hue, sat, val, &tmp_led);
|
sethsv(hue, sat, val, &tmp_led);
|
||||||
inmem_config.hue = hue;
|
|
||||||
inmem_config.sat = sat;
|
|
||||||
inmem_config.val = val;
|
|
||||||
// dprintf("rgblight set hue [MEMORY]: %u,%u,%u\n", inmem_config.hue, inmem_config.sat, inmem_config.val);
|
// dprintf("rgblight set hue [MEMORY]: %u,%u,%u\n", inmem_config.hue, inmem_config.sat, inmem_config.val);
|
||||||
rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b);
|
rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val) {
|
|
||||||
|
void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom) {
|
||||||
if (rgblight_config.enable) {
|
if (rgblight_config.enable) {
|
||||||
if (rgblight_config.mode == 1) {
|
if (rgblight_config.mode == 1) {
|
||||||
// same static color
|
// same static color
|
||||||
rgblight_sethsv_noeeprom(hue, sat, val);
|
LED_TYPE tmp_led;
|
||||||
|
sethsv(hue, sat, val, &tmp_led);
|
||||||
|
rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b);
|
||||||
} else {
|
} else {
|
||||||
// all LEDs in same color
|
// all LEDs in same color
|
||||||
if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) {
|
if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) {
|
||||||
@@ -371,11 +442,23 @@ void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val) {
|
|||||||
rgblight_config.hue = hue;
|
rgblight_config.hue = hue;
|
||||||
rgblight_config.sat = sat;
|
rgblight_config.sat = sat;
|
||||||
rgblight_config.val = val;
|
rgblight_config.val = val;
|
||||||
eeconfig_update_rgblight(rgblight_config.raw);
|
if (write_to_eeprom) {
|
||||||
xprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
|
eeconfig_update_rgblight(rgblight_config.raw);
|
||||||
|
xprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
|
||||||
|
} else {
|
||||||
|
xprintf("rgblight set hsv [NOEEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val) {
|
||||||
|
rgblight_sethsv_eeprom_helper(hue, sat, val, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) {
|
||||||
|
rgblight_sethsv_eeprom_helper(hue, sat, val, false);
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t rgblight_get_hue(void) {
|
uint16_t rgblight_get_hue(void) {
|
||||||
return rgblight_config.hue;
|
return rgblight_config.hue;
|
||||||
}
|
}
|
||||||
@@ -480,18 +563,11 @@ void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void rgblight_task(void) {
|
void rgblight_task(void) {
|
||||||
if (rgblight_inited == 1) { //modify for led_test
|
|
||||||
/* first call */
|
|
||||||
rgblight_inited = 2;
|
|
||||||
rgblight_enable();
|
|
||||||
rgblight_mode(2);
|
|
||||||
}
|
|
||||||
if (rgblight_timer_enabled) {
|
if (rgblight_timer_enabled) {
|
||||||
// mode = 1, static light, do nothing here
|
// mode = 1, static light, do nothing here
|
||||||
if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) {
|
if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) {
|
||||||
// mode = 2 to 5, breathing mode
|
// mode = 2 to 5, breathing mode
|
||||||
rgblight_effect_breathing(rgblight_config.mode - 2);
|
rgblight_effect_breathing(rgblight_config.mode - 2);
|
||||||
#if 0
|
|
||||||
} else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 8) {
|
} else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 8) {
|
||||||
// mode = 6 to 8, rainbow mood mod
|
// mode = 6 to 8, rainbow mood mod
|
||||||
rgblight_effect_rainbow_mood(rgblight_config.mode - 6);
|
rgblight_effect_rainbow_mood(rgblight_config.mode - 6);
|
||||||
@@ -507,7 +583,9 @@ void rgblight_task(void) {
|
|||||||
} else if (rgblight_config.mode == 24) {
|
} else if (rgblight_config.mode == 24) {
|
||||||
// mode = 24, christmas mode
|
// mode = 24, christmas mode
|
||||||
rgblight_effect_christmas();
|
rgblight_effect_christmas();
|
||||||
#endif
|
} else if (rgblight_config.mode == 35) {
|
||||||
|
// mode = 35, RGB cyclic
|
||||||
|
rgblight_effect_rgbcyclic();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -516,19 +594,19 @@ void rgblight_task(void) {
|
|||||||
void rgblight_effect_breathing(uint8_t interval) {
|
void rgblight_effect_breathing(uint8_t interval) {
|
||||||
static uint8_t pos = 0;
|
static uint8_t pos = 0;
|
||||||
static uint16_t last_timer = 0;
|
static uint16_t last_timer = 0;
|
||||||
|
float val;
|
||||||
|
|
||||||
if (timer_elapsed(last_timer) < pgm_read_word(&RGBLED_BREATHING_INTERVALS[interval])) {//modify for led_test
|
if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_BREATHING_INTERVALS[interval])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
last_timer = timer_read();
|
last_timer = timer_read();
|
||||||
|
|
||||||
|
|
||||||
//modify for led_test
|
// http://sean.voisen.org/blog/2011/10/breathing-led-with-arduino/
|
||||||
rgblight_config.hue = (pos*120)%360;
|
val = (exp(sin((pos/255.0)*M_PI)) - RGBLIGHT_EFFECT_BREATHE_CENTER/M_E)*(RGBLIGHT_EFFECT_BREATHE_MAX/(M_E-1/M_E));
|
||||||
rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
|
rgblight_sethsv_noeeprom_old(rgblight_config.hue, rgblight_config.sat, val);
|
||||||
pos = (pos + 1) % 3;
|
pos = (pos + 1) % 256;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
void rgblight_effect_rainbow_mood(uint8_t interval) {
|
void rgblight_effect_rainbow_mood(uint8_t interval) {
|
||||||
static uint16_t current_hue = 0;
|
static uint16_t current_hue = 0;
|
||||||
static uint16_t last_timer = 0;
|
static uint16_t last_timer = 0;
|
||||||
@@ -537,7 +615,7 @@ void rgblight_effect_rainbow_mood(uint8_t interval) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
last_timer = timer_read();
|
last_timer = timer_read();
|
||||||
rgblight_sethsv_noeeprom(current_hue, rgblight_config.sat, rgblight_config.val);
|
rgblight_sethsv_noeeprom_old(current_hue, rgblight_config.sat, rgblight_config.val);
|
||||||
current_hue = (current_hue + 1) % 360;
|
current_hue = (current_hue + 1) % 360;
|
||||||
}
|
}
|
||||||
void rgblight_effect_rainbow_swirl(uint8_t interval) {
|
void rgblight_effect_rainbow_swirl(uint8_t interval) {
|
||||||
@@ -662,5 +740,24 @@ void rgblight_effect_christmas(void) {
|
|||||||
}
|
}
|
||||||
rgblight_set();
|
rgblight_set();
|
||||||
}
|
}
|
||||||
#endif /* 0 */
|
|
||||||
|
void rgblight_effect_rgbcyclic(void) {
|
||||||
|
static uint8_t pos = 0;
|
||||||
|
static uint16_t last_timer = 0;
|
||||||
|
uint8_t g; uint8_t r; uint8_t b;
|
||||||
|
|
||||||
|
if (timer_elapsed(last_timer) < pgm_read_word(&RGBLED_RGBCYCLIC_INTERVALS[0])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
last_timer = timer_read();
|
||||||
|
g = r = b = 0;
|
||||||
|
switch( pos ) {
|
||||||
|
case 0: r = RGBLIGHT_LIMIT_VAL; break;
|
||||||
|
case 1: g = RGBLIGHT_LIMIT_VAL; break;
|
||||||
|
case 2: b = RGBLIGHT_LIMIT_VAL; break;
|
||||||
|
}
|
||||||
|
rgblight_setrgb(r, g, b);
|
||||||
|
pos = (pos + 1) % 3;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* RGBLIGHT_ANIMATIONS */
|
#endif /* RGBLIGHT_ANIMATIONS */
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
#define RGBLIGHT_H
|
#define RGBLIGHT_H
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ANIMATIONS
|
#ifdef RGBLIGHT_ANIMATIONS
|
||||||
#define RGBLIGHT_MODES 5
|
#define RGBLIGHT_MODES 35
|
||||||
#else
|
#else
|
||||||
#define RGBLIGHT_MODES 1
|
#define RGBLIGHT_MODES 1
|
||||||
#endif
|
#endif
|
||||||
@@ -74,14 +74,16 @@
|
|||||||
#include "ws2812.h"
|
#include "ws2812.h"
|
||||||
#endif
|
#endif
|
||||||
#include "rgblight_types.h"
|
#include "rgblight_types.h"
|
||||||
|
#include "rgblight_list.h"
|
||||||
|
|
||||||
extern LED_TYPE led[RGBLED_NUM];
|
extern LED_TYPE led[RGBLED_NUM];
|
||||||
|
|
||||||
extern const uint16_t RGBLED_BREATHING_INTERVALS[4] PROGMEM; //modify for led_test
|
extern const uint8_t RGBLED_BREATHING_INTERVALS[4] PROGMEM;
|
||||||
extern const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[3] PROGMEM;
|
extern const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[3] PROGMEM;
|
||||||
extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM;
|
extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM;
|
||||||
extern const uint8_t RGBLED_SNAKE_INTERVALS[3] PROGMEM;
|
extern const uint8_t RGBLED_SNAKE_INTERVALS[3] PROGMEM;
|
||||||
extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM;
|
extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM;
|
||||||
|
extern const uint16_t RGBLED_RGBCYCLIC_INTERVALS[1] PROGMEM;
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
uint32_t raw;
|
uint32_t raw;
|
||||||
@@ -91,6 +93,7 @@ typedef union {
|
|||||||
uint16_t hue :9;
|
uint16_t hue :9;
|
||||||
uint8_t sat :8;
|
uint8_t sat :8;
|
||||||
uint8_t val :8;
|
uint8_t val :8;
|
||||||
|
uint8_t speed :8;//EECONFIG needs to be increased to support this
|
||||||
};
|
};
|
||||||
} rgblight_config_t;
|
} rgblight_config_t;
|
||||||
|
|
||||||
@@ -112,6 +115,8 @@ void rgblight_increase_sat(void);
|
|||||||
void rgblight_decrease_sat(void);
|
void rgblight_decrease_sat(void);
|
||||||
void rgblight_increase_val(void);
|
void rgblight_increase_val(void);
|
||||||
void rgblight_decrease_val(void);
|
void rgblight_decrease_val(void);
|
||||||
|
void rgblight_increase_speed(void);
|
||||||
|
void rgblight_decrease_speed(void);
|
||||||
void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val);
|
void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val);
|
||||||
uint16_t rgblight_get_hue(void);
|
uint16_t rgblight_get_hue(void);
|
||||||
uint8_t rgblight_get_sat(void);
|
uint8_t rgblight_get_sat(void);
|
||||||
@@ -125,9 +130,21 @@ void eeconfig_update_rgblight(uint32_t val);
|
|||||||
void eeconfig_update_rgblight_default(void);
|
void eeconfig_update_rgblight_default(void);
|
||||||
void eeconfig_debug_rgblight(void);
|
void eeconfig_debug_rgblight(void);
|
||||||
|
|
||||||
|
void rgb_matrix_increase(void);
|
||||||
|
void rgb_matrix_decrease(void);
|
||||||
|
|
||||||
void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1);
|
void sethsv(uint16_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1);
|
||||||
void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1);
|
void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1);
|
||||||
|
|
||||||
void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val);
|
void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val);
|
||||||
|
void rgblight_mode_noeeprom(uint8_t mode);
|
||||||
|
void rgblight_toggle_noeeprom(void);
|
||||||
|
void rgblight_enable_noeeprom(void);
|
||||||
|
void rgblight_disable_noeeprom(void);
|
||||||
|
|
||||||
|
void rgblight_sethsv_eeprom_helper(uint16_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom);
|
||||||
|
void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom);
|
||||||
|
|
||||||
|
|
||||||
#define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF)
|
#define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF)
|
||||||
void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b);
|
void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b);
|
||||||
@@ -144,5 +161,6 @@ void rgblight_effect_rainbow_swirl(uint8_t interval);
|
|||||||
void rgblight_effect_snake(uint8_t interval);
|
void rgblight_effect_snake(uint8_t interval);
|
||||||
void rgblight_effect_knight(uint8_t interval);
|
void rgblight_effect_knight(uint8_t interval);
|
||||||
void rgblight_effect_christmas(void);
|
void rgblight_effect_christmas(void);
|
||||||
|
void rgblight_effect_rgbcyclic(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
#define USB_MAX_POWER_CONSUMPTION 100
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
#include "keymap.h"
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
/* Layer 0: Default Layer
|
||||||
|
* ,-----------------------------------------------------------.
|
||||||
|
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Del|Bsp|
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Enter |
|
||||||
|
* |------------------------------------------------------` |
|
||||||
|
* |SrCtl | A| S| D| F| G| H| J| K| L| ;| '| \| |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Shift | Z| X| C| V| B| N| M| ,| .| /| `|Up |Shi|
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |NCt|| #|Alt|CmT|CmT| LyrSpc |CGv|Iso|Gui|CSL||Rig|Dow|Lef|
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[0] = LAYOUT_JP(
|
||||||
|
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_DEL,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,
|
||||||
|
SRCH_CTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,KC_NUHS, KC_ENT,
|
||||||
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT, KC_SLSH,KC_NUBS, KC_UP, KC_RSFT,
|
||||||
|
NC_CTL, HSH_TLD,KC_LALT,CMD_TAB_CMD,CMD_TAB_CMD, LT(2, KC_SPC) , CMD_GRV_CMD, ISO_COUNTRY_CODE,KC_RGUI, CMD_SFT_L, KC_LEFT,KC_DOWN,KC_RGHT
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Layer 1: iPad mode (Fixed)
|
||||||
|
* ,-----------------------------------------------------------.
|
||||||
|
* | | | | | | | | | | | | | | | |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* | | | | | | | | | | | | | | |
|
||||||
|
* |------------------------------------------------------` |
|
||||||
|
* |CmdSpc| | | | | | | | | | | | | |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* | | | | | | | | | | | | | | |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* | || ~| |CAD| | |CmH| | | || | | |
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[1] = LAYOUT_JP(
|
||||||
|
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,
|
||||||
|
CMD_SPC,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS,KC_TRNS,CMD_ALT_D,KC_TRNS, KC_TRNS ,CMD_H,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Layer 2: HHKB mode (Space)
|
||||||
|
* ,-----------------------------------------------------------.
|
||||||
|
* |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* |Caps |DL0|DL1| | | | | |Psc|Slk|Pus|Up | | |
|
||||||
|
* |------------------------------------------------------` |
|
||||||
|
* | |VoD|VoU|Mut| | | |Bsp|Del|CSL|Lef|Rig| | |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* | | | |CAC| | | | | | |Dow| |PgU| |
|
||||||
|
* |-----------------------------------------------------------|
|
||||||
|
* | || ~| | | | | | | | ||Hom|PgD|End|
|
||||||
|
* `-----------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[2] = LAYOUT_JP(
|
||||||
|
KC_PWR, 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_INS,KC_DEL,
|
||||||
|
KC_CAPS, DF(0), DF(1),KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PSCR,KC_SLCK,KC_PAUS, KC_UP,KC_TRNS,
|
||||||
|
KC_TRNS, KC_VOLD,KC_VOLU,KC_MUTE,KC_TRNS,KC_TRNS,KC_TRNS,KC_BSPC, KC_DEL,CMD_SFT_L,KC_LEFT,KC_RGHT,KC_TRNS,KC_PENT,
|
||||||
|
KC_TRNS, KC_TRNS,KC_TRNS,CMD_ALT_C,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_DOWN,KC_TRNS,KC_PGUP,KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS ,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_HOME,KC_PGDN, KC_END
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
|
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch(keycode) {
|
||||||
|
case CMD_SPC:
|
||||||
|
mod_or_mod_with_macro(record, KC_LGUI, " ");
|
||||||
|
break;
|
||||||
|
case CMD_H:
|
||||||
|
mod_or_mod_with_macro(record, KC_RGUI, "H");
|
||||||
|
break;
|
||||||
|
case CMD_ALT_D:
|
||||||
|
mod_or_mod_with_macro(record, KC_LGUI, SS_LALT("D"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#include "dhertz.h"
|
||||||
|
|
||||||
|
enum dhertz_keycodes {
|
||||||
|
CMD_SPC = NEW_SAFE_RANGE,
|
||||||
|
CMD_H,
|
||||||
|
CMD_ALT_D,
|
||||||
|
};
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
OPT_DEFS += -DHHKB_JP
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
#undef RGBLED_NUM
|
#undef RGBLED_NUM
|
||||||
#define RGBLED_NUM 16 // Number of LEDs
|
#define RGBLED_NUM 18 // Number of LEDs
|
||||||
#define RGBLIGHT_ANIMATIONS
|
#define RGBLIGHT_ANIMATIONS
|
||||||
#define RGBLIGHT_HUE_STEP 12
|
#define RGBLIGHT_HUE_STEP 12
|
||||||
#define RGBLIGHT_SAT_STEP 12
|
#define RGBLIGHT_SAT_STEP 12
|
||||||
@@ -58,4 +58,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define PRODUCT Drashna Hacked Iris Rev.2
|
#define PRODUCT Drashna Hacked Iris Rev.2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define SHFT_LED1 6
|
||||||
|
#define SHFT_LED2 11
|
||||||
|
|
||||||
|
#define CTRL_LED1 7
|
||||||
|
#define CTRL_LED2 10
|
||||||
|
|
||||||
|
#define GUI_LED1 8
|
||||||
|
#define GUI_LED2 9
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -2,15 +2,6 @@
|
|||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
#include "drashna.h"
|
#include "drashna.h"
|
||||||
|
|
||||||
#ifdef INDICATOR_LIGHTS
|
|
||||||
extern userspace_config_t userspace_config;
|
|
||||||
|
|
||||||
uint8_t last_mod;
|
|
||||||
uint8_t last_led;
|
|
||||||
uint8_t last_osm;
|
|
||||||
bool has_mods_changed = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define KC_ALAP ALT_T(KC_APP)
|
#define KC_ALAP ALT_T(KC_APP)
|
||||||
#define KC_OSLG OSM(MOD_LGUI)
|
#define KC_OSLG OSM(MOD_LGUI)
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
@@ -55,7 +46,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
|
|
||||||
[_LOWER] = LAYOUT_wrapper(
|
[_LOWER] = LAYOUT_wrapper(
|
||||||
_______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______,
|
_______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______,
|
||||||
_______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
|
_______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______,
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______,
|
||||||
_______, _______, _______, _______, _______, _______
|
_______, _______, _______, _______, _______, _______
|
||||||
@@ -63,7 +54,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
|
|
||||||
[_RAISE] = LAYOUT_wrapper(
|
[_RAISE] = LAYOUT_wrapper(
|
||||||
_______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______,
|
_______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
KC_GRV, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, _______,
|
||||||
_______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
|
_______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______,
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______,
|
||||||
_______, _______, _______, _______, _______, _______
|
_______, _______, _______, _______, _______, _______
|
||||||
@@ -71,93 +62,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
|
|
||||||
[_ADJUST] = LAYOUT_wrapper(
|
[_ADJUST] = LAYOUT_wrapper(
|
||||||
KC_MAKE, _______, _______, _______, _______, _______, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RST,
|
KC_MAKE, _______, _______, _______, _______, _______, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RST,
|
||||||
VRSN, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, _______, _______, _______, _______, _______, EPRM,
|
VRSN, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, KC_NUKE, _______, _______, _______, _______, EPRM,
|
||||||
_______, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, _______,
|
_______, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN, TG(_MODS),
|
||||||
TG(_MODS),RGB_SMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY,
|
_______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY,
|
||||||
_______, _______, _______, _______, _______, _______
|
_______, _______, _______, _______, _______, _______
|
||||||
)
|
)
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void matrix_init_keymap(void) {
|
bool indicator_is_this_led_used(uint8_t index) {
|
||||||
|
switch (index) {
|
||||||
#ifdef INDICATOR_LIGHTS
|
#ifdef INDICATOR_LIGHTS
|
||||||
last_mod = get_mods();
|
case SHFT_LED1:
|
||||||
last_led = host_keyboard_leds();
|
case SHFT_LED2:
|
||||||
last_osm =get_oneshot_mods();
|
case CTRL_LED1:
|
||||||
|
case CTRL_LED2:
|
||||||
|
case GUI_LED1:
|
||||||
|
case GUI_LED2:
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
default:
|
||||||
|
return false;
|
||||||
uint32_t layer_state_set_keymap (uint32_t state) {
|
|
||||||
#ifdef INDICATOR_LIGHTS
|
|
||||||
uint8_t modifiders = get_mods();
|
|
||||||
uint8_t led_usb_state = host_keyboard_leds();
|
|
||||||
uint8_t one_shot = get_oneshot_mods();
|
|
||||||
|
|
||||||
|
|
||||||
if (modifiders & MODS_SHIFT_MASK || led_usb_state & (1<<USB_LED_CAPS_LOCK) || one_shot & MODS_SHIFT_MASK) {
|
|
||||||
rgblight_sethsv_at(0, 255, 255, 5);
|
|
||||||
rgblight_sethsv_at(0, 255, 255, 10);
|
|
||||||
}
|
}
|
||||||
if (modifiders & MODS_CTRL_MASK || one_shot & MODS_CTRL_MASK) {
|
|
||||||
rgblight_sethsv_at(51, 255, 255, 6);
|
|
||||||
rgblight_sethsv_at(51, 255, 255, 9);
|
|
||||||
}
|
|
||||||
if (modifiders & MODS_ALT_MASK || one_shot & MODS_ALT_MASK) {
|
|
||||||
rgblight_sethsv_at(120, 255, 255, 7);
|
|
||||||
rgblight_sethsv_at(120, 255, 255, 8);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void matrix_scan_keymap (void) {
|
|
||||||
|
|
||||||
#ifdef INDICATOR_LIGHTS
|
|
||||||
uint8_t current_mod = get_mods();
|
|
||||||
uint8_t current_led = host_keyboard_leds();
|
|
||||||
uint8_t current_osm =get_oneshot_mods();
|
|
||||||
|
|
||||||
if (last_mod == current_mod) {
|
|
||||||
last_mod = current_mod;
|
|
||||||
has_mods_changed = true;
|
|
||||||
}
|
|
||||||
if (last_led == current_led) {
|
|
||||||
last_led = current_led;
|
|
||||||
has_mods_changed = true;
|
|
||||||
}
|
|
||||||
if (last_osm == current_osm) {
|
|
||||||
last_osm = current_osm;
|
|
||||||
has_mods_changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (userspace_config.rgb_layer_change && has_mods_changed && biton32(layer_state) == 0) {
|
|
||||||
if (current_mod & MODS_SHIFT_MASK || current_led & (1<<USB_LED_CAPS_LOCK) || current_osm & MODS_SHIFT_MASK) {
|
|
||||||
rgblight_sethsv_at(0, 255, 255, 5);
|
|
||||||
rgblight_sethsv_at(0, 255, 255, 10);
|
|
||||||
} else {
|
|
||||||
rgblight_sethsv_default_helper(5);
|
|
||||||
rgblight_sethsv_default_helper(10);
|
|
||||||
}
|
|
||||||
if (current_mod & MODS_CTRL_MASK || current_osm & MODS_CTRL_MASK) {
|
|
||||||
rgblight_sethsv_at(51, 255, 255, 6);
|
|
||||||
rgblight_sethsv_at(51, 255, 255, 9);
|
|
||||||
} else {
|
|
||||||
rgblight_sethsv_default_helper(6);
|
|
||||||
rgblight_sethsv_default_helper(9);
|
|
||||||
}
|
|
||||||
if (current_mod & MODS_GUI_MASK || current_osm & MODS_GUI_MASK) {
|
|
||||||
rgblight_sethsv_at(120, 255, 255, 7);
|
|
||||||
rgblight_sethsv_at(120, 255, 255, 8);
|
|
||||||
} else {
|
|
||||||
rgblight_sethsv_default_helper(7);
|
|
||||||
rgblight_sethsv_default_helper(8);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,9 @@ TAP_DANCE_ENABLE = no
|
|||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
AUDIO_ENABLE = yes
|
AUDIO_ENABLE = yes
|
||||||
NKRO_ENABLE = yes
|
NKRO_ENABLE = yes
|
||||||
BACKLIGHT_ENABLE = no
|
BACKLIGHT_ENABLE = no
|
||||||
SWAP_HANDS_ENABLE = yes
|
SWAP_HANDS_ENABLE = no
|
||||||
|
|
||||||
INDICATOR_LIGHTS = yes
|
INDICATOR_LIGHTS = yes
|
||||||
|
MACROS_ENABLED = no
|
||||||
|
RGBLIGHT_TWINKLE = yes
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Danny Nguyen <[email protected]>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_USER_H
|
||||||
|
#define CONFIG_USER_H
|
||||||
|
|
||||||
|
#include "config_common.h"
|
||||||
|
|
||||||
|
/* Use I2C or Serial, not both */
|
||||||
|
|
||||||
|
#define USE_SERIAL
|
||||||
|
#undef USE_I2C
|
||||||
|
|
||||||
|
/* Select hand configuration */
|
||||||
|
|
||||||
|
// #define MASTER_LEFT
|
||||||
|
// #define MASTER_RIGHT
|
||||||
|
#define EE_HANDS
|
||||||
|
|
||||||
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
#undef RGBLED_NUM
|
||||||
|
#define RGBLED_NUM 16 // Number of LEDs
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
#define RGBLIGHT_HUE_STEP 12
|
||||||
|
#define RGBLIGHT_SAT_STEP 12
|
||||||
|
#define RGBLIGHT_VAL_STEP 12
|
||||||
|
#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2
|
||||||
|
#define RGBLIGHT_EFFECT_SNAKE_LENGTH 2
|
||||||
|
#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
|
||||||
|
|
||||||
|
#define RGBLIGHT_LIMIT_VAL 225
|
||||||
|
#endif // RGBLIGHT_ENABLE
|
||||||
|
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
#define C6_AUDIO
|
||||||
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
#define NO_MUSIC_MODE
|
||||||
|
#endif //RGBLIGHT_ENABLE
|
||||||
|
#endif //AUDIO_ENABLE
|
||||||
|
|
||||||
|
|
||||||
|
#undef PRODUCT
|
||||||
|
#ifdef KEYBOARD_iris_rev2
|
||||||
|
#define PRODUCT Drashna Hacked Iris Rev.2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define SHFT_LED1 5
|
||||||
|
#define SHFT_LED2 10
|
||||||
|
|
||||||
|
#define CTRL_LED1 6
|
||||||
|
#define CTRL_LED2 9
|
||||||
|
|
||||||
|
#define GUI_LED1 7
|
||||||
|
#define GUI_LED2 8
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
|
||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
#include "drashna.h"
|
||||||
|
|
||||||
|
#define KC_ALAP ALT_T(KC_APP)
|
||||||
|
#define KC_OSLG OSM(MOD_LGUI)
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
[_QWERTY] = LAYOUT_wrapper(
|
||||||
|
KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS,
|
||||||
|
KC_TAB , _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSLS,
|
||||||
|
KC_CCCV, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT,
|
||||||
|
KC_MLSF, _________________QWERTY_L3_________________, KC_ALAP, KC_OSLG, _________________QWERTY_R3_________________, KC_MRSF,
|
||||||
|
LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
|
||||||
|
),
|
||||||
|
[_COLEMAK] = LAYOUT_wrapper(
|
||||||
|
KC_ESC , ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS,
|
||||||
|
KC_TAB , _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, KC_BSLS,
|
||||||
|
KC_CCCV, _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, KC_QUOT,
|
||||||
|
KC_MLSF, _________________COLEMAK_L3________________, KC_ALAP, KC_OSLG, _________________COLEMAK_R3________________, KC_MRSF,
|
||||||
|
LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
|
||||||
|
),
|
||||||
|
[_DVORAK] = LAYOUT_wrapper(
|
||||||
|
KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS,
|
||||||
|
KC_TAB , _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, KC_BSLS,
|
||||||
|
KC_CCCV, _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, KC_QUOT,
|
||||||
|
KC_MLSF, _________________DVORAK_L3_________________, KC_ALAP, KC_OSLG, _________________DVORAK_R3_________________, KC_MRSF,
|
||||||
|
LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
|
||||||
|
),
|
||||||
|
[_WORKMAN] = LAYOUT_wrapper(
|
||||||
|
KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS,
|
||||||
|
KC_TAB , _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, KC_BSLS,
|
||||||
|
KC_CCCV, _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, KC_QUOT,
|
||||||
|
KC_MLSF, _________________WORKMAN_L3________________, KC_ALAP, KC_OSLG, _________________WORKMAN_R3________________, KC_MRSF,
|
||||||
|
LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
|
||||||
|
),
|
||||||
|
|
||||||
|
[_MODS] = LAYOUT_wrapper(
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
|
KC_LSFT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RSFT,
|
||||||
|
_______, _______, _______, _______, _______, _______
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
[_LOWER] = LAYOUT_wrapper(
|
||||||
|
_______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______,
|
||||||
|
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______,
|
||||||
|
_______, _______, _______, _______, _______, _______
|
||||||
|
),
|
||||||
|
|
||||||
|
[_RAISE] = LAYOUT_wrapper(
|
||||||
|
_______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______,
|
||||||
|
KC_GRV, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, _______,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______,
|
||||||
|
_______, _______, _______, _______, _______, _______
|
||||||
|
),
|
||||||
|
|
||||||
|
[_ADJUST] = LAYOUT_wrapper(
|
||||||
|
KC_MAKE, _______, _______, _______, _______, _______, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RST,
|
||||||
|
VRSN, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, KC_NUKE, _______, _______, _______, _______, EPRM,
|
||||||
|
_______, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN, TG(_MODS),
|
||||||
|
_______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY,
|
||||||
|
_______, _______, _______, _______, _______, _______
|
||||||
|
)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
bool indicator_is_this_led_used(uint8_t index) {
|
||||||
|
switch (index) {
|
||||||
|
#ifdef INDICATOR_LIGHTS
|
||||||
|
case SHFT_LED1:
|
||||||
|
case SHFT_LED2:
|
||||||
|
case CTRL_LED1:
|
||||||
|
case CTRL_LED2:
|
||||||
|
case GUI_LED1:
|
||||||
|
case GUI_LED2:
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
USER_NAME := drashna
|
||||||
|
|
||||||
|
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||||
|
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
|
||||||
|
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||||
|
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||||
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
|
TAP_DANCE_ENABLE = no
|
||||||
|
RGBLIGHT_ENABLE = yes
|
||||||
|
AUDIO_ENABLE = yes
|
||||||
|
NKRO_ENABLE = yes
|
||||||
|
BACKLIGHT_ENABLE = no
|
||||||
|
SWAP_HANDS_ENABLE = no
|
||||||
|
|
||||||
|
INDICATOR_LIGHTS = yes
|
||||||
|
MACROS_ENABLED = no
|
||||||
|
RGBLIGHT_TWINKLE = yes
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# krusli's Iris keymap
|
||||||
|
Based off the default and Planck keymaps.
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Danny Nguyen <[email protected]>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_USER_H
|
||||||
|
#define CONFIG_USER_H
|
||||||
|
|
||||||
|
#include "config_common.h"
|
||||||
|
|
||||||
|
// #define PREVENT_STUCK_MODIFIERS
|
||||||
|
|
||||||
|
/* Use I2C or Serial, not both */
|
||||||
|
|
||||||
|
#define USE_SERIAL
|
||||||
|
// #define USE_I2C
|
||||||
|
|
||||||
|
/* Select hand configuration */
|
||||||
|
|
||||||
|
#define MASTER_LEFT
|
||||||
|
// #define MASTER_RIGHT
|
||||||
|
// #define EE_HANDS
|
||||||
|
|
||||||
|
#undef RGBLED_NUM
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
#define RGBLED_NUM 12
|
||||||
|
#define RGBLIGHT_HUE_STEP 8
|
||||||
|
#define RGBLIGHT_SAT_STEP 8
|
||||||
|
#define RGBLIGHT_VAL_STEP 8
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
#include "iris.h"
|
||||||
|
#include "action_layer.h"
|
||||||
|
#include "eeconfig.h"
|
||||||
|
|
||||||
|
extern keymap_config_t keymap_config;
|
||||||
|
|
||||||
|
#define _QWERTY 0
|
||||||
|
#define _LOWER 1
|
||||||
|
#define _RAISE 2
|
||||||
|
#define _ADJUST 16
|
||||||
|
|
||||||
|
enum custom_keycodes {
|
||||||
|
QWERTY = SAFE_RANGE,
|
||||||
|
LOWER,
|
||||||
|
RAISE,
|
||||||
|
ADJUST,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define _______ KC_TRNS
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[_QWERTY] = LAYOUT(
|
||||||
|
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS,
|
||||||
|
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_LCTL, 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_HOME, KC_END, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
|
||||||
|
KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LALT
|
||||||
|
),
|
||||||
|
|
||||||
|
[_LOWER] = LAYOUT(
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR,
|
||||||
|
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_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_LEFT, KC_DOWN, KC_UP, KC_RGHT,
|
||||||
|
_______, _______, _______, _______, _______, _______
|
||||||
|
),
|
||||||
|
|
||||||
|
[_RAISE] = LAYOUT(
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR,
|
||||||
|
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_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_LEFT, KC_DOWN, KC_UP, KC_RGHT,
|
||||||
|
_______, _______, _______, _______, _______, _______
|
||||||
|
),
|
||||||
|
|
||||||
|
[_ADJUST] = LAYOUT(
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
|
RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, _______, _______, _______, _______, _______,
|
||||||
|
_______, _______, RGB_HUD, RGB_SAD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, _______,
|
||||||
|
BL_STEP, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
|
_______, _______, _______, _______, _______, _______
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
|
void persistent_default_layer_set(uint16_t default_layer) {
|
||||||
|
eeconfig_update_default_layer(default_layer);
|
||||||
|
default_layer_set(default_layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
|
case QWERTY:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
persistent_default_layer_set(1UL<<_QWERTY);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case LOWER:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
layer_on(_LOWER);
|
||||||
|
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||||
|
} else {
|
||||||
|
layer_off(_LOWER);
|
||||||
|
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case RAISE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
layer_on(_RAISE);
|
||||||
|
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||||
|
} else {
|
||||||
|
layer_off(_RAISE);
|
||||||
|
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case ADJUST:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
layer_on(_ADJUST);
|
||||||
|
} else {
|
||||||
|
layer_off(_ADJUST);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
RGBLIGHT_ENABLE = no
|
||||||
|
BACKLIGHT_ENABLE = no
|
||||||
|
|
||||||
|
ifndef QUANTUM_DIR
|
||||||
|
include ../../../../Makefile
|
||||||
|
endif
|
||||||
@@ -20,6 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include "config_common.h"
|
#include "config_common.h"
|
||||||
|
|
||||||
|
#define SOLENOID_ENABLE
|
||||||
|
#define SOLENOID_PIN C6
|
||||||
|
|
||||||
/* Use I2C or Serial, not both */
|
/* Use I2C or Serial, not both */
|
||||||
|
|
||||||
#define USE_SERIAL
|
#define USE_SERIAL
|
||||||
@@ -28,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
/* Select hand configuration */
|
/* Select hand configuration */
|
||||||
|
|
||||||
#define MASTER_LEFT
|
#define MASTER_LEFT
|
||||||
#define TAPPING_TERM 250
|
|
||||||
// #define MASTER_RIGHT
|
// #define MASTER_RIGHT
|
||||||
// #define EE_HANDS
|
// #define EE_HANDS
|
||||||
|
|
||||||
|
|||||||
@@ -1,145 +1,8 @@
|
|||||||
#include "iris.h"
|
#include QMK_KEYBOARD_H
|
||||||
#include "action_layer.h"
|
#include "mtdjr.h"
|
||||||
#include "eeconfig.h"
|
|
||||||
#include "action_macro.h"
|
|
||||||
#include <timer.h>
|
|
||||||
#include "pincontrol.h"
|
|
||||||
|
|
||||||
extern keymap_config_t keymap_config;
|
extern keymap_config_t keymap_config;
|
||||||
|
|
||||||
#define _QWERTY 0
|
|
||||||
#define _LOWER 1
|
|
||||||
#define _RAISE 2
|
|
||||||
#define _SUPER 3
|
|
||||||
#define _ADJUST 16
|
|
||||||
#define SOLENOID_DEFAULT_DWELL 12
|
|
||||||
#define SOLENOID_MAX_DWELL 100
|
|
||||||
#define SOLENOID_MIN_DWELL 4
|
|
||||||
#define SOLENOID_PIN C6
|
|
||||||
|
|
||||||
|
|
||||||
bool solenoid_enabled = false;
|
|
||||||
bool solenoid_on = false;
|
|
||||||
bool solenoid_buzz = false;
|
|
||||||
bool solenoid_buzzing = false;
|
|
||||||
uint16_t solenoid_start = 0;
|
|
||||||
uint8_t solenoid_dwell = SOLENOID_DEFAULT_DWELL;
|
|
||||||
|
|
||||||
|
|
||||||
void solenoid_buzz_on(void) {
|
|
||||||
solenoid_buzz = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void solenoid_buzz_off(void) {
|
|
||||||
solenoid_buzz = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void solenoid_dwell_minus(void) {
|
|
||||||
if (solenoid_dwell > 0) solenoid_dwell--;
|
|
||||||
}
|
|
||||||
|
|
||||||
void solenoid_dwell_plus(void) {
|
|
||||||
if (solenoid_dwell < SOLENOID_MAX_DWELL) solenoid_dwell++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void solenoid_toggle(void) {
|
|
||||||
solenoid_enabled = !solenoid_enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void solenoid_stop(void) {
|
|
||||||
digitalWrite(SOLENOID_PIN, PinLevelLow);
|
|
||||||
solenoid_on = false;
|
|
||||||
solenoid_buzzing = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void solenoid_fire(void) {
|
|
||||||
if (!solenoid_enabled) return;
|
|
||||||
|
|
||||||
if (!solenoid_buzz && solenoid_on) return;
|
|
||||||
if (solenoid_buzz && solenoid_buzzing) return;
|
|
||||||
|
|
||||||
solenoid_on = true;
|
|
||||||
solenoid_buzzing = true;
|
|
||||||
solenoid_start = timer_read();
|
|
||||||
digitalWrite(SOLENOID_PIN, PinLevelHigh);
|
|
||||||
}
|
|
||||||
|
|
||||||
void solenoid_check(void) {
|
|
||||||
uint16_t elapsed = 0;
|
|
||||||
|
|
||||||
if (!solenoid_on) return;
|
|
||||||
|
|
||||||
elapsed = timer_elapsed(solenoid_start);
|
|
||||||
|
|
||||||
//Check if it's time to finish this solenoid click cycle
|
|
||||||
if (elapsed > solenoid_dwell) {
|
|
||||||
solenoid_stop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Check whether to buzz the solenoid on and off
|
|
||||||
if (solenoid_buzz) {
|
|
||||||
if (elapsed / SOLENOID_MIN_DWELL % 2 == 0){
|
|
||||||
if (!solenoid_buzzing) {
|
|
||||||
solenoid_buzzing = true;
|
|
||||||
digitalWrite(SOLENOID_PIN, PinLevelHigh);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (solenoid_buzzing) {
|
|
||||||
solenoid_buzzing = false;
|
|
||||||
digitalWrite(SOLENOID_PIN, PinLevelLow);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void solenoid_setup(void) {
|
|
||||||
pinMode(SOLENOID_PIN, PinDirectionOutput);
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_init_user(void) {
|
|
||||||
solenoid_setup();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
solenoid_check();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
enum custom_keycodes {
|
|
||||||
QWERTY = SAFE_RANGE,
|
|
||||||
LOWER,
|
|
||||||
RAISE,
|
|
||||||
SUPER,
|
|
||||||
ADJUST,
|
|
||||||
SOL_TOG,
|
|
||||||
SOLENOID_DWELL_MINUS,
|
|
||||||
SOLENOID_DWELL_PLUS,
|
|
||||||
SOLENOID_BUZZ_ON,
|
|
||||||
SOLENOID_BUZZ_OFF,
|
|
||||||
TD_ESC = 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define KC_ KC_TRNS
|
|
||||||
#define _______ KC_TRNS
|
|
||||||
|
|
||||||
#define KC_LOWR LOWER
|
|
||||||
#define KC_RASE RAISE
|
|
||||||
#define KC_SUPR SUPER
|
|
||||||
#define KC_RST RESET
|
|
||||||
#define KC_BL_S BL_STEP
|
|
||||||
#define KC_EXC TD(TD_ESC)
|
|
||||||
#define SOLTOG SOLENOID_TOG
|
|
||||||
|
|
||||||
// Macro Declarations
|
|
||||||
#define UM_ROOT M(0)
|
|
||||||
#define UM_PPLY M(1)
|
|
||||||
#define UM_PSEF M(2)
|
|
||||||
#define KC_XCPY M(3)
|
|
||||||
#define KC_XINS M(4)
|
|
||||||
#define UM_CAD M(5)
|
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
[_QWERTY] = LAYOUT_kc(
|
[_QWERTY] = LAYOUT_kc(
|
||||||
@@ -152,7 +15,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||||
EQL, Z , X , C , V , B ,LGUI, LALT, N , M ,COMM,DOT ,SLSH,MINS,
|
EQL, Z , X , C , V , B ,LGUI, LALT, N , M ,COMM,DOT ,SLSH,MINS,
|
||||||
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
||||||
LCTL,RASE,SPC , SPC ,LOWR,SUPR
|
LCTL,RASE,SPC , SPC ,LOWR,xxxx
|
||||||
// `----+----+----' `----+----+----'
|
// `----+----+----' `----+----+----'
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -178,130 +41,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
, F9 ,F10 ,F11 ,F12 , , , , , , , ,
|
, F9 ,F10 ,F11 ,F12 , , , , , , , ,
|
||||||
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||||
, , ,XCPY,XINS, , , , , , , , ,PLUS,
|
, , ,XCPY,XINS, , , , , , , , , ,
|
||||||
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
||||||
, , , , ,
|
, , , , ,
|
||||||
// `----+----+----' `----+----+----'
|
// `----+----+----' `----+----+----'
|
||||||
),
|
),
|
||||||
|
|
||||||
[_SUPER] = LAYOUT(
|
[_ADJUST] = LAYOUT_kc(
|
||||||
//,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------.
|
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||||
SOL_TOG, UM_ROOT, UM_PPLY, UM_PSEF, _______, _______, _______, _______, _______, _______, _______, _______,
|
STOG,ROOT,PPLY,PSEF,xxxx,xxxx, xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,
|
||||||
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
_______, _______, _______, _______, _______, _______, _______, KC_LBRC, _______, _______, _______, _______,
|
xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, xxxx,xxxx,xxxx,xxxx,xxxx,BSLS,
|
||||||
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, UM_CAD ,
|
xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,
|
||||||
//|--------+--------+--------+--------+--------+--------+--------. ,--------|--------+--------+--------+--------+--------+--------|
|
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY,
|
xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx, xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,xxxx,
|
||||||
//`--------+--------+--------+----+---+--------+--------+--------/ \--------+--------+--------+---+----+--------+--------+--------'
|
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
||||||
_______, _______, _______, _______, _______, _______
|
xxxx, ,xxxx, xxxx, ,
|
||||||
// `--------+--------+--------' `--------+--------+--------'
|
// `----+----+----' `----+----+----'
|
||||||
)
|
)
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
void persistent_default_layer_set(uint16_t default_layer) {
|
|
||||||
eeconfig_update_default_layer(default_layer);
|
|
||||||
default_layer_set(default_layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
|
||||||
//Tap once for grave accent, twice for ESC
|
|
||||||
[TD_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_GRV, KC_ESC)
|
|
||||||
};
|
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
if (record->event.pressed) {
|
|
||||||
solenoid_fire();
|
|
||||||
}
|
|
||||||
switch (keycode) {
|
|
||||||
case QWERTY:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
persistent_default_layer_set(1UL<<_QWERTY);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case LOWER:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
layer_on(_LOWER);
|
|
||||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
|
||||||
} else {
|
|
||||||
layer_off(_LOWER);
|
|
||||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case RAISE:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
layer_on(_RAISE);
|
|
||||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
|
||||||
} else {
|
|
||||||
layer_off(_RAISE);
|
|
||||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case SUPER:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
layer_on(_SUPER);
|
|
||||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
|
||||||
} else {
|
|
||||||
layer_off(_SUPER);
|
|
||||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case SOLTOG:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
solenoid_toggle();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SOLENOID_DWELL_MINUS:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
solenoid_dwell_minus();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SOLENOID_DWELL_PLUS:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
solenoid_dwell_plus();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SOLENOID_BUZZ_ON:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
solenoid_buzz_on();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SOLENOID_BUZZ_OFF:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
solenoid_buzz_off();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
|
|
||||||
if (record->event.pressed) {
|
|
||||||
switch(id) {
|
|
||||||
case 0:
|
|
||||||
SEND_STRING("sudo su -\n");
|
|
||||||
return false; break;
|
|
||||||
case 1:
|
|
||||||
SEND_STRING("puppet apply /etc/puppetlabs/code/environments/production/manifests/site.pp\n");
|
|
||||||
return false; break;
|
|
||||||
case 2:
|
|
||||||
SEND_STRING("ps -ef | grep ");
|
|
||||||
return false; break;
|
|
||||||
case 3:
|
|
||||||
return MACRO(D(LCTL), T(INS), U(LCTL), END);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
return MACRO(D(LSFT), T(INS), U(LSFT), END);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
return MACRO(D(LCTL), D(RALT), T(DEL), END);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return MACRO_NONE;
|
|
||||||
};
|
};
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
RGBLIGHT_ENABLE = no
|
RGBLIGHT_ENABLE = no
|
||||||
BACKLIGHT_ENABLE = no
|
BACKLIGHT_ENABLE = no
|
||||||
TAP_DANCE_ENABLE = no
|
|
||||||
|
|
||||||
ifndef QUANTUM_DIR
|
ifndef QUANTUM_DIR
|
||||||
include ../../../../Makefile
|
include ../../../../Makefile
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ void matrix_init(void) {
|
|||||||
matrix_debouncing[row] = 0x00;
|
matrix_debouncing[row] = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
matrix_init_quantum(); // missing from original port by Luiz
|
matrix_init_quantum();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void) {
|
uint8_t matrix_scan(void) {
|
||||||
@@ -86,7 +86,7 @@ uint8_t matrix_scan(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
matrix_scan_quantum(); // also missing in original PS2AVRGB implementation
|
matrix_scan_quantum();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
|||||||
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
NKRO_ENABLE = no # USB Nkey Rollover
|
NKRO_ENABLE = no # USB Nkey Rollover
|
||||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
|
||||||
|
RGBLIGHT_ENABLE ?= yes # Enable keyboard RGB underglow
|
||||||
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
|
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
|
||||||
UNICODE_ENABLE = no # Unicode
|
UNICODE_ENABLE = no # Unicode
|
||||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# Lets Split Layout
|
||||||
|
|
||||||
|
Check out [user readme](../../../../users/bbaserdem/README.md) for more info.
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
**These commands depend on there being no other arduino connected!**
|
||||||
|
Also udev rules can be set instead of using sudo.
|
||||||
|
Please unplug all other usb devices.
|
||||||
|
|
||||||
|
To make the hex files;
|
||||||
|
```
|
||||||
|
make lets_split/rev2:bbaserdem
|
||||||
|
make lets_split/rev2:bbaserdem_right
|
||||||
|
```
|
||||||
|
|
||||||
|
For the left half, after plugging in and resetting; (from repo main directory)
|
||||||
|
```
|
||||||
|
sudo avrdude -p atmega32u4 -P "$(ls /dev/ttyACM*)" -c avr109 -D -U flash:w:.build/lets_split_rev2_bbaserdem.hex
|
||||||
|
sudo avrdude -p atmega32u4 -P "$(ls /dev/ttyACM*)" -c avr109 -U eeprom:w:keyboards/lets_split/eeprom-lefthand.eep
|
||||||
|
```
|
||||||
|
|
||||||
|
For the right half;
|
||||||
|
```
|
||||||
|
sudo avrdude -p atmgea34u4 -P "$(ls /dev/ttyACM*)" -c avr109 -D -U flash:w:.build/lets_split_rev2_bbaserdem_right.hex
|
||||||
|
sudo avrdude -p atmega32u4 -P "$(ls /dev/ttyACM*)" -c avr109 -U eeprom:w:keyboards/lets_split/eeprom-righhand.eep
|
||||||
|
```
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
#ifndef CONFIG_USER_H
|
||||||
|
#define CONFIG_USER_H
|
||||||
|
|
||||||
|
#include "../../config.h"
|
||||||
|
|
||||||
|
#define USE_SERIAL
|
||||||
|
#define EE_HANDS
|
||||||
|
|
||||||
|
// LED strip stuff
|
||||||
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
|
||||||
|
// Who thought it was a good idea to predefine these in the rev2/config.h ???
|
||||||
|
#ifdef RGBLED_NUM
|
||||||
|
#undef RGBLED_NUM
|
||||||
|
#endif
|
||||||
|
#define RGBLED_NUM 12
|
||||||
|
|
||||||
|
#define RGBLIGHT_HUE_STEP 6
|
||||||
|
#define RGBLIGHT_SAT_STEP 12
|
||||||
|
#define RGBLIGHT_VAL_STEP 20
|
||||||
|
#define RGBLIGHT_ANIMATIONS
|
||||||
|
#define RGBLIGHT_EFFECT_SNAKE_LENGTH 6
|
||||||
|
#define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 2000
|
||||||
|
#define RGBLIGHT_EFFECT_CHRISTMAS_STEP 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Let's Split - Dvorak turkish
|
||||||
|
* Keymap by @bbaserdem
|
||||||
|
* Dvorak layout with multiple features
|
||||||
|
* Most of the code is in the "user" directory.
|
||||||
|
* Check qmk_firmware/users/bbaserdem for the main part of the code
|
||||||
|
*/
|
||||||
|
#define KEYMAP(...) LAYOUT_ortho_4x12(__VA_ARGS__)
|
||||||
|
|
||||||
|
#include "lets_split.h"
|
||||||
|
#include "bbaserdem.h"
|
||||||
|
|
||||||
|
|
||||||
|
void matrix_init_keymap (void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t layer_state_set_keymap(uint32_t state) {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
// Main Dvorak layer
|
||||||
|
[_DV] = DVORAK,
|
||||||
|
// Turkish and special character overlay
|
||||||
|
[_AL] = ALTCHAR,
|
||||||
|
// Gaming layer
|
||||||
|
[_GA] = GAME,
|
||||||
|
// Numbers layer
|
||||||
|
[_NU] = NUMBERS,
|
||||||
|
// Settings layer
|
||||||
|
[_SE] = SETTINGS,
|
||||||
|
// Mouse emulation layer
|
||||||
|
[_MO] = MOUSE,
|
||||||
|
#ifdef AUDIO_ENABLE
|
||||||
|
[_MU] = MUSIC,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
# Build options
|
||||||
|
|
||||||
|
BACKLIGHT_ENABLE = no # Switch LEDs
|
||||||
|
MOUSEKEY_ENABLE = yes # Emulates mouse key using keypresses
|
||||||
|
RGBLIGHT_ENABLE = yes # LED strips
|
||||||
|
TAP_DANCE_ENABLE = no # Use multi-tap features
|
||||||
|
AUDIO_ENABLE = no # Audio stuff
|
||||||
|
|
||||||
|
ifndef QUANTUM_DIR
|
||||||
|
include ../../../../Makefile
|
||||||
|
endif
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# Lets Split - Right Half
|
||||||
|
|
||||||
|
Keymap for my right half, to be used as a numpad.
|
||||||
|
Check [main readme](../bbaserdem/README.md) for flashing info.
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#ifndef CONFIG_USER_H
|
||||||
|
#define CONFIG_USER_H
|
||||||
|
|
||||||
|
#include "../../config.h"
|
||||||
|
|
||||||
|
#define USE_SERIAL
|
||||||
|
#define EE_HANDS
|
||||||
|
|
||||||
|
#endif
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Let's Split - Dvorak turkish
|
||||||
|
* Keymap by @bbaserdem
|
||||||
|
* Dvorak layout with multiple features
|
||||||
|
* Most of the code is in the "user" directory.
|
||||||
|
* Check qmk_firmware/users/bbaserdem for the main part of the code
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "lets_split.h"
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
|
||||||
|
/* Navigation All Supered) Numpad
|
||||||
|
* ,-----------------------. ,-----------------------.
|
||||||
|
* | F4| ` | Q |Alt| L | > | | ) | - | + | = |Ent|Bkp|
|
||||||
|
* |---+---+---+---+---+---| |---+---+---+---+---+---|
|
||||||
|
* | F3| M |Ent|Ctl| K | ^ | | ( | * | 9 | 6 | 3 | . |
|
||||||
|
* |---+---+---+---+---+---| |---+---+---+---+---+---|
|
||||||
|
* | F2| T |Spc|Shf| J | v | | % | / | 8 | 5 | 2 | , |
|
||||||
|
* |---+---+---+---+---+---| |---+---+---+---+---+---|
|
||||||
|
* | F1| F | P |Tab| H | < | |Nlc|Tab| 7 | 4 | 1 | 0 |
|
||||||
|
* `-----------------------' `-----------------------'
|
||||||
|
*/
|
||||||
|
// Main Dvorak layer
|
||||||
|
[0] = KEYMAP(
|
||||||
|
LGUI(KC_F4), LGUI(KC_GRV), LGUI(KC_Q), LGUI(KC_LALT), LGUI(KC_L), LGUI(KC_RGHT),
|
||||||
|
KC_RPRN, KC_PMNS, KC_PPLS, KC_PEQL, KC_PENT, KC_BSPC,
|
||||||
|
LGUI(KC_F3), LGUI(KC_M), LGUI(KC_ENT), LGUI(KC_LCTL), LGUI(KC_K), LGUI(KC_UP),
|
||||||
|
KC_LPRN, KC_PAST, KC_P9, KC_P6, KC_P3, KC_PDOT,
|
||||||
|
LGUI(KC_F2), LGUI(KC_T), LGUI(KC_SPC), LGUI(KC_LSFT), LGUI(KC_J), LGUI(KC_DOWN),
|
||||||
|
KC_PERC, KC_PSLS, KC_P8, KC_P5, KC_P2, KC_PCMM,
|
||||||
|
LGUI(KC_F1), LGUI(KC_F), LGUI(KC_P), LGUI(KC_TAB), LGUI(KC_H), LGUI(KC_LEFT),
|
||||||
|
KC_NLCK, KC_TAB, KC_P7, KC_P4, KC_P1, KC_P0 )
|
||||||
|
};
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
# Build options
|
||||||
|
|
||||||
|
BACKLIGHT_ENABLE = no # Switch LEDs
|
||||||
|
MOUSEKEY_ENABLE = no # Emulates mouse key using keypresses
|
||||||
|
RGBLIGHT_ENABLE = no # LED strips
|
||||||
|
TAP_DANCE_ENABLE = no # Use multi-tap features
|
||||||
|
AUDIO_ENABLE = no # Audio stuff
|
||||||
|
BLUETOOTH_ENABLE = no # No bluetooth
|
||||||
|
COMMAND_ENABLE = no # Some bootmagic thing
|
||||||
|
BOOTMAGIC_ENABLE = no # Access to EEPROM settings, not needed
|
||||||
|
CONSOLE_ENABLE = no # Allows console output with a command
|
||||||
|
SLEEP_LED_ENABLE = no # Breathes LED's when computer is asleep. Untested.
|
||||||
|
NKRO_ENABLE = no # Default is 6KRO which is plenty
|
||||||
|
MIDI_ENABLE = no # Untested feature
|
||||||
|
FAUXCLICKY_ENABLE = no # Emulates clicks using speaker
|
||||||
|
KEY_LOCK_ENABLE = no # Allows locking any key. Not used
|
||||||
|
API_SYSEX_ENABLE = no # Allows OS to send signals.
|
||||||
|
KEY_LOCK_ENABLE = no # Allows locking any key. Not used
|
||||||
|
UNICODE_ENABLE = no # Used for unicode character emulation
|
||||||
|
EXTRAKEY_ENABLE = no # OS signals like volume control
|
||||||
|
|
||||||
|
ifndef QUANTUM_DIR
|
||||||
|
include ../../../../Makefile
|
||||||
|
endif
|
||||||
@@ -23,11 +23,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include "../../config.h"
|
#include "../../config.h"
|
||||||
|
|
||||||
|
#define SOLENOID_ENABLE
|
||||||
|
#define SOLENOID_PIN F4
|
||||||
|
|
||||||
/* Use I2C or Serial, not both */
|
/* Use I2C or Serial, not both */
|
||||||
|
|
||||||
// #define USE_SERIAL
|
// #define USE_SERIAL
|
||||||
#define USE_I2C
|
#define USE_I2C
|
||||||
#define TAPPING_TERM 250
|
|
||||||
/* Select hand configuration */
|
/* Select hand configuration */
|
||||||
|
|
||||||
// #define MASTER_LEFT
|
// #define MASTER_LEFT
|
||||||
|
|||||||
@@ -1,194 +1,81 @@
|
|||||||
#include "lets_split.h"
|
#include QMK_KEYBOARD_H
|
||||||
#include "action_layer.h"
|
#include "mtdjr.h"
|
||||||
#include "eeconfig.h"
|
|
||||||
#include "action_macro.h"
|
|
||||||
|
|
||||||
extern keymap_config_t keymap_config;
|
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 _LOWER 1
|
|
||||||
#define _RAISE 2
|
|
||||||
#define _ADJUST 16
|
|
||||||
|
|
||||||
enum custom_keycodes {
|
|
||||||
QWERTY = SAFE_RANGE,
|
|
||||||
LOWER,
|
|
||||||
RAISE,
|
|
||||||
ADJUST,
|
|
||||||
TD_ESC = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
// Fillers to make layering more clear
|
|
||||||
#define _______ KC_TRNS
|
|
||||||
#define XXXXXXX KC_NO
|
|
||||||
|
|
||||||
|
|
||||||
// Macro Declarations
|
|
||||||
#define UM_ROOT M(0)
|
|
||||||
#define UM_PPLY M(1)
|
|
||||||
#define UM_COPY M(2)
|
|
||||||
#define UM_INSR M(3)
|
|
||||||
#define UM_PSEF M(4)
|
|
||||||
|
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
/* Qwerty
|
/* Qwerty
|
||||||
* ,-----------------------------------------. ,-----------------------------------------.
|
* ,-----------------------------------------. ,-----------------------------------------.
|
||||||
* | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp |
|
* | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp |
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
* |Esc/~ | A | S | D | F | G | | H | J | K | L | ; | '/" |
|
* |Esc/~ | A | S | D | F | G | | H | J | K | L | ; | '/" |
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
* | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter |
|
* | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter |
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Left | Up | Down |Right |
|
* |Adjust| Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Left | Up | Down |Right |
|
||||||
* `-----------------------------------------' '-----------------------------------------'
|
* `-----------------------------------------' '-----------------------------------------'
|
||||||
*/
|
*/
|
||||||
[_QWERTY] = LAYOUT( \
|
[_QWERTY] = LAYOUT( \
|
||||||
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_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
|
||||||
TD(TD_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
|
KC_EXC, 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 , \
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||||
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_UP, KC_DOWN, KC_RGHT \
|
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_UP, KC_DOWN, KC_RGHT \
|
||||||
),
|
),
|
||||||
|
|
||||||
/* Lower
|
/* Lower
|
||||||
* ,-----------------------------------------. ,-----------------------------------------.
|
* ,-----------------------------------------. ,-----------------------------------------.
|
||||||
* | ~ | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp |
|
* | ~ | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp |
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
* | | | [ | ] | { | } | | | 4 | 5 | 6 | * | \ |
|
* | | | [ | ] | { | } | | | 4 | 5 | 6 | * | \ |
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
* |Shift | | | copy |insert| | | | 1 | 2 | 3 | + | - |
|
* |Shift | | | copy |insert| | | | 1 | 2 | 3 | + | - |
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space | |Space |Raise | 0 | . | = | _ |
|
* |Adjust| Ctrl | Alt | GUI |Lower |Space | |Space |Raise | 0 | . | = | _ |
|
||||||
* `-----------------------------------------' '-----------------------------------------'
|
* `-----------------------------------------' '-----------------------------------------'
|
||||||
*/
|
*/
|
||||||
[_LOWER] = LAYOUT( \
|
[_LOWER] = LAYOUT( \
|
||||||
KC_TILD, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, \
|
KC_TILD, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, \
|
||||||
XXXXXXX, XXXXXXX, KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, XXXXXXX, KC_4, KC_5, KC_6, KC_ASTR, KC_BSLS, \
|
XXXXXXX, XXXXXXX, KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, XXXXXXX, KC_4, KC_5, KC_6, KC_ASTR, KC_BSLS, \
|
||||||
_______, XXXXXXX, XXXXXXX, UM_COPY, UM_INSR, XXXXXXX, XXXXXXX, KC_1, KC_2, KC_3, KC_PLUS, KC_MINS, \
|
_______, XXXXXXX, XXXXXXX, KC_XCPY, KC_XINS, XXXXXXX, XXXXXXX, KC_1, KC_2, KC_3, KC_PLUS, KC_MINS, \
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_0, KC_DOT, KC_EQL, KC_UNDS \
|
_______, _______, _______, _______, _______, _______, _______, _______, KC_0, KC_DOT, KC_EQL, KC_UNDS \
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
/* Raise
|
/* Raise
|
||||||
* ,-----------------------------------------. ,-----------------------------------------.
|
* ,-----------------------------------------. ,-----------------------------------------.
|
||||||
* | ` | ! | @ | # | $ | % | | ^ | & | * | ( | ) | Bksp |
|
* | ` | ! | @ | # | $ | % | | ^ | & | * | ( | ) | Bksp |
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
* | | | | | | | | | | | | \ | | |
|
* | | | | | | | | | | | | \ | | |
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
* |Shift | | | | | | | | | | | | |
|
* |Shift | | | | | | | | | | | | |
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
* |Adjust| Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Next | Vol- | Vol+ | Play |
|
* |Adjust| Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Next | Vol- | Vol+ | Play |
|
||||||
* `-----------------------------------------' '-----------------------------------------'
|
* `-----------------------------------------' '-----------------------------------------'
|
||||||
*/
|
*/
|
||||||
[_RAISE] = LAYOUT( \
|
[_RAISE] = LAYOUT( \
|
||||||
KC_GRV, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \
|
KC_GRV, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \
|
||||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSLS, KC_PIPE,\
|
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSLS, KC_PIPE,\
|
||||||
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||||
),
|
),
|
||||||
|
|
||||||
/* Adjust (Lower + Raise)
|
/* Adjust (Lower + Raise)
|
||||||
* ,-----------------------------------------. ,-----------------------------------------.
|
* ,-----------------------------------------. ,-----------------------------------------.
|
||||||
* | | Reset| | | | | | ROOT | PPLY | PSEF | | | Del |
|
* | | Reset| | | | | | ROOT | PPLY | PSEF | | | Del |
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
* | | | |Aud on|Audoff| | | F1 | F2 | F3 | F4 | F5 | F6 |
|
* | | | |Aud on|Audoff| | | F1 | F2 | F3 | F4 | F5 | F6 |
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
* | | UNDO | CUT | COPY |PASTE | | | F7 | F8 | F9 | F10 | F11 | F12 |
|
* | | UNDO | CUT | COPY |PASTE | | | F7 | F8 | F9 | F10 | F11 | F12 |
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
||||||
* | | | | | | | | | | Home | | | End |
|
* | | | | | | | | | | Home | | | End |
|
||||||
* `-----------------------------------------' '-----------------------------------------'
|
* `-----------------------------------------' '-----------------------------------------'
|
||||||
*/
|
*/
|
||||||
[_ADJUST] = LAYOUT( \
|
[_ADJUST] = LAYOUT( \
|
||||||
_______, UM_ROOT, UM_PPLY, UM_PSEF, _______, _______, RESET, _______, _______, _______, _______, KC_DEL, \
|
KC_STOG, KC_ROOT, KC_PPLY, KC_PSEF, _______, _______, RESET, _______, _______, _______, _______, KC_DEL, \
|
||||||
_______, _______, _______, AU_ON, AU_OFF, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, \
|
_______, _______, _______, AU_ON, AU_OFF, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, \
|
||||||
_______, KC_UNDO, KC_CUT, UM_COPY, UM_INSR, _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
|
_______, KC_UNDO, KC_CUT, KC_XCPY, KC_XINS, _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, _______, _______, KC_END \
|
_______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, _______, _______, KC_END \
|
||||||
)
|
)
|
||||||
|
};
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef AUDIO_ENABLE
|
|
||||||
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void persistent_default_layer_set(uint16_t default_layer) {
|
|
||||||
eeconfig_update_default_layer(default_layer);
|
|
||||||
default_layer_set(default_layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
|
||||||
//Tap once for nothing, twice for ESC
|
|
||||||
[TD_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_NO, KC_ESC)
|
|
||||||
};
|
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
switch (keycode) {
|
|
||||||
case QWERTY:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
#ifdef AUDIO_ENABLE
|
|
||||||
PLAY_SONG(tone_qwerty);
|
|
||||||
#endif
|
|
||||||
persistent_default_layer_set(1UL<<_QWERTY);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case LOWER:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
layer_on(_LOWER);
|
|
||||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
|
||||||
} else {
|
|
||||||
layer_off(_LOWER);
|
|
||||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case RAISE:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
layer_on(_RAISE);
|
|
||||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
|
||||||
} else {
|
|
||||||
layer_off(_RAISE);
|
|
||||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case ADJUST:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
layer_on(_ADJUST);
|
|
||||||
} else {
|
|
||||||
layer_off(_ADJUST);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
|
|
||||||
if (record->event.pressed) {
|
|
||||||
switch(id) {
|
|
||||||
case 0:
|
|
||||||
SEND_STRING("sudo su -\n");
|
|
||||||
return false; break;
|
|
||||||
case 1:
|
|
||||||
SEND_STRING("puppet apply /etc/puppetlabs/code/environments/production/manifests/site.pp\n");
|
|
||||||
return false; break;
|
|
||||||
case 2:
|
|
||||||
return MACRO(D(LCTL), T(INS), U(LCTL), END);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
return MACRO(D(LSFT), T(INS), U(LSFT), END);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
SEND_STRING("ps -ef | grep ");
|
|
||||||
return false; break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return MACRO_NONE;
|
|
||||||
};
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
TAP_DANCE_ENABLE = yes
|
|
||||||
ifndef QUANTUM_DIR
|
ifndef QUANTUM_DIR
|
||||||
include ../../../../Makefile
|
include ../../../../Makefile
|
||||||
endif
|
endif
|
||||||
Loaded 100 of 225 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user