diff options
30 files changed, 914 insertions, 295 deletions
diff --git a/keyboard/atomic/Makefile b/keyboard/atomic/Makefile index 0d5baa9fa1..ed1d331766 100644 --- a/keyboard/atomic/Makefile +++ b/keyboard/atomic/Makefile @@ -39,7 +39,7 @@ #---------------------------------------------------------------------------- # Target file name (without extension). -TARGET = atomic_lufa +TARGET = planck_lufa # Directory common source filess exist TOP_DIR = ../.. @@ -47,20 +47,47 @@ TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . -# project specific files -SRC = keymap_common.c \ - matrix.c \ +# # project specific files +ifdef COMMON + + SRC = keymap_common.c \ led.c \ backlight.c ifdef KEYMAP - SRC := keymap_$(KEYMAP).c $(SRC) + SRC := common_keymaps/keymap_$(KEYMAP).c $(SRC) else - SRC := keymap_vlad.c $(SRC) + SRC := common_keymaps/keymap_jack.c $(SRC) endif -CONFIG_H = config.h +ifdef MATRIX + SRC := matrix_$(MATRIX).c $(SRC) +else + SRC := matrix_pcb.c $(SRC) +endif + +else + +SRC = extended_keymap_common.c \ + analog.c \ + led.c \ + backlight.c + +ifdef KEYMAP + SRC := extended_keymaps/extended_keymap_$(KEYMAP).c $(SRC) +else + SRC := extended_keymaps/extended_keymap_default.c $(SRC) +endif + +ifdef MATRIX + SRC := matrix_$(MATRIX).c $(SRC) +else + SRC := matrix_pcb.c $(SRC) +endif +endif + +CONFIG_H = config.h # MCU name #MCU = at90usb1287 @@ -120,11 +147,11 @@ MOUSEKEY_ENABLE = yes # Mouse keys(+4700) EXTRAKEY_ENABLE = yes # Audio control and System control(+450) CONSOLE_ENABLE = yes # Console for debug(+400) COMMAND_ENABLE = yes # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE #SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality - # Optimize size but this may cause error "relocation truncated to fit" #EXTRALDFLAGS = -Wl,--relax diff --git a/keyboard/atomic/Makefile.pjrc b/keyboard/atomic/Makefile.pjrc index 9655ff65a9..be83ba18b1 100644 --- a/keyboard/atomic/Makefile.pjrc +++ b/keyboard/atomic/Makefile.pjrc @@ -55,7 +55,7 @@ SRC = keymap_common.c \ ifdef KEYMAP SRC := keymap_$(KEYMAP).c $(SRC) else - SRC := keymap_poker.c $(SRC) + SRC := keymap_jack.c $(SRC) endif CONFIG_H = config.h diff --git a/keyboard/atomic/README 2.md b/keyboard/atomic/README 2.md deleted file mode 100644 index 510cb5c8b6..0000000000 --- a/keyboard/atomic/README 2.md +++ /dev/null @@ -1,141 +0,0 @@ -GH60 keyboard firmware -====================== -DIY compact keyboard designed and run by komar007 and Geekhack community. - -- Both Rev.A and Rev.B PCB are supported by one firmware binary(issue #64) - -## GH60 Resources -- [KOMAR's project page](http://blog.komar.be/projects/gh60-programmable-keyboard/) -- [Prototyping](http://geekhack.org/index.php?topic=34959.0) -- [Rev.A PCB test](http://geekhack.org/index.php?topic=37570.0) -- [Rev.B PCB test](http://geekhack.org/index.php?topic=50685.0) -- [Group buy](http://geekhack.org/index.php?topic=41464.0) - - -## Build -Move to this directory then just run `make` like: - - $ make - -Use `make -f Makefile.pjrc` if you want to use PJRC stack but I find no reason to do so now. - - -## Keymap -Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_<name>.c` and see keymap document(you can find in top README.md) and existent keymap files. - -To build firmware binary hex file with a certain keymap just do `make` with `KEYMAP` option like: - - $ make KEYMAP=[poker|poker_set|poker_bit|plain|hasu|spacefn|hhkb|<name>] - - -### 1 Poker -[keymap_poker.c](keymap_poker.c) emulates original Poker layers -while both [keymap_poker_bit.c](keymap_poker_bit.c) and [keymap_poker_set.c](keymap_poker_set.c) implements same layout in different way and they fix a minor issue of original Poker and enhance arrow keys. - - Fn + Esc = ` - Fn + {left, down, up, right} = {home, pgdown, pgup, end} - -#### 1.0 Default layer - ,-----------------------------------------------------------. - | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | - |-----------------------------------------------------------| - |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| - |-----------------------------------------------------------| - |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | - |-----------------------------------------------------------| - |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | - |-----------------------------------------------------------| - |Ctrl|Gui |Alt | Space |Fn |Gui |App |Ctrl| - `-----------------------------------------------------------' -#### 1.1 Poker Fn layer - ,-----------------------------------------------------------. - |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | - |-----------------------------------------------------------| - | |FnQ| Up| | | | | | |Cal| |Hom|Ins| | - |-----------------------------------------------------------| - | |Lef|Dow|Rig| | |Psc|Slk|Pau| |Tsk|End| | - |-----------------------------------------------------------| - | |Del| |Web|Mut|VoU|VoD| |PgU|PgD|Del| Up | - |-----------------------------------------------------------| - | | | | FnS |Fn |Left|Down|Righ| - `-----------------------------------------------------------' - - -### 2. Plain -Without any Fn layer this will be useful if you want to use key remapping tool like AHK on host. -See [keymap_plain.c](keymap_plain.c) for detail. - -#### 1.0 Plain Default layer - ,-----------------------------------------------------------. - |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | - |-----------------------------------------------------------| - |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| - |-----------------------------------------------------------| - |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | - |-----------------------------------------------------------| - |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | - |-----------------------------------------------------------| - |Ctrl|Gui |Alt | Space |Alt |Gui |App |Ctrl| - `-----------------------------------------------------------' - - -### 3. Hasu -This is my favorite keymap with HHKB Fn, Vi cursor and Mousekey layer. See [keymap_hasu.c](keymap_hasu.c) for detail. - - -### 4. SpaceFN -This layout proposed by spiceBar uses space bar to change layer with using Dual role key technique. See [keymap_spacefn.c](keymap_spacefn.c) and [SpaceFN discussion](http://geekhack.org/index.php?topic=51069.0). - -#### 4.0 Default layer - ,-----------------------------------------------------------. - |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | - |-----------------------------------------------------------| - |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| - |-----------------------------------------------------------| - |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | - |-----------------------------------------------------------| - |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | - |-----------------------------------------------------------| - |Ctrl|Gui |Alt | Space/Fn |Alt |Gui |App |Ctrl| - `-----------------------------------------------------------' -#### 4.1 SpaceFN layer - ,-----------------------------------------------------------. - |` | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delete | - |-----------------------------------------------------------| - | | | | | | | |Hom|Up |End|Psc|Slk|Pau|Ins | - |-----------------------------------------------------------| - | | | | | | |PgU|Lef|Dow|Rig| | | | - |-----------------------------------------------------------| - | | | | | |Spc|PgD|` |~ | | | | - |-----------------------------------------------------------| - | | | | Fn | | | | | - `-----------------------------------------------------------' - - -### 5. HHKB -[keymap_hhkb.c](keymap_hhkb.c) emulates original HHKB layers. -#### 5.0: Default layer - ,-----------------------------------------------------------. - |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `| - |-----------------------------------------------------------| - |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Bspc | - |-----------------------------------------------------------| - |Ctrl | A| S| D| F| G| H| J| K| L|Fn3| '|Return | - |-----------------------------------------------------------| - |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn | - |-----------------------------------------------------------| - | |Gui |Alt | Space | |Alt |Gui | | - `-----------------------------------------------------------' -#### 5.1: HHKB Fn layer - ,-----------------------------------------------------------. - |Pwr| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| - |-----------------------------------------------------------| - |Caps | | | | | | | |Psc|Slk|Pus|Up | | | - |-----------------------------------------------------------| - | |VoD|VoU|Mut|Ejc| | *| /|Hom|PgU|Lef|Rig|Enter | - |-----------------------------------------------------------| - | | | | | | | +| -|End|PgD|Dow| | | - |-----------------------------------------------------------| - | | | | | | | | | - `-----------------------------------------------------------' - diff --git a/keyboard/atomic/config.h b/keyboard/atomic/config.h index 41f7bd8b9f..fd286bb992 100644 --- a/keyboard/atomic/config.h +++ b/keyboard/atomic/config.h @@ -24,8 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define PRODUCT_ID 0x6060 #define DEVICE_VER 0x0001 #define MANUFACTURER Ortholinear Keyboards -#define PRODUCT Atomic Keyboard -#define DESCRIPTION t.m.k. keyboard firmware for Atomic +#define PRODUCT Atomic +#define DESCRIPTION A compact ortholinear keyboard /* key matrix size */ #define MATRIX_ROWS 5 diff --git a/keyboard/atomic/keymap_common.h b/keyboard/atomic/keymap_common.h index cfb0cb3611..7c167eb51a 100644 --- a/keyboard/atomic/keymap_common.h +++ b/keyboard/atomic/keymap_common.h @@ -33,52 +33,82 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; extern const uint16_t fn_actions[]; -// JCK: Semi-Standard layout -#define KEYMAP_JCK( \ - K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0E, \ - K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ - K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, K2E, \ - K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3C, K3D, K3E, \ - K40, K41, K43, K46, K4A, K4B, K4C, K4D, K4E \ -) { \ - { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_NO, KC_##K0E }, \ - { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E }, \ - { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_NO, KC_##K2D, KC_##K2E }, \ - { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_NO, KC_##K3C, KC_##K3D, KC_##K3E }, \ - { KC_##K40, KC_##K41, KC_NO, KC_##K43, KC_NO, KC_NO, KC_##K46, KC_NO, KC_NO, KC_NO, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E } \ -} -// ASK: Short Space layout -#define KEYMAP_ASK_MESSY( \ - K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0E, \ - K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ - K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, K2E, \ - K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3C, K3D, K3E, \ - K40, K41, K43, K44, K46, K48, K49, K4A, K4B, K4C, K4D, K4E \ +// MIT Layout +/* + * ,-----------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |-----------------------------------------------------------------------| + * | | | | | | | | | | | | | + * |-----------------------------------------------------------------------| + * | | | | | | | | | | | | | + * |-----------------------------------------------------------------------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------' + */ +#define KEYMAP( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \ ) { \ - { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_NO, KC_##K0E }, \ - { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E }, \ - { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_NO, KC_##K2D, KC_##K2E }, \ - { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_NO, KC_##K3C, KC_##K3D, KC_##K3E }, \ - { KC_##K40, KC_##K41, KC_NO, KC_##K43, KC_##K44, KC_NO, KC_##K46, KC_NO, KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E } \ + { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K35, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \ } -#define KEYMAP_ASK( \ - K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0E, \ - K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ - K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2E, \ - K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, K3E, \ - K40, K41, K43, K44, K46, K47, K48, K4A, K4B, K4C, K4D, K4E \ +// Grid Layout +/* + * ,-----------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |-----------------------------------------------------------------------| + * | | | | | | | | | | | | | + * |-----------------------------------------------------------------------| + * | | | | | | | | | | | | | + * |-----------------------------------------------------------------------| + * | | | | | | | | | | | | | + * `-----------------------------------------------------------------------' + */ +#define KEYMAP_GRID( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \ ) { \ - { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_NO, KC_##K0E }, \ - { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E }, \ - { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_NO, KC_##K2E }, \ - { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_NO, KC_##K3D, KC_##K3E }, \ - { KC_##K40, KC_##K41, KC_NO, KC_##K43, KC_##K44, KC_NO, KC_##K46, KC_##K47, KC_##K48, KC_NO, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E } \ + { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \ } +#define KEYMAP_REVERSE( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \ + ) { \ + { KC_##K0B, KC_##K0A, KC_##K09, KC_##K08, KC_##K07, KC_##K06, KC_##K05, KC_##K04, KC_##K03, KC_##K02, KC_##K01, KC_##K00 }, \ + { KC_##K1B, KC_##K1A, KC_##K19, KC_##K18, KC_##K17, KC_##K16, KC_##K15, KC_##K14, KC_##K13, KC_##K12, KC_##K11, KC_##K10 }, \ + { KC_##K2B, KC_##K2A, KC_##K29, KC_##K28, KC_##K27, KC_##K26, KC_##K25, KC_##K24, KC_##K23, KC_##K22, KC_##K21, KC_##K20 }, \ + { KC_##K3B, KC_##K3A, KC_##K39, KC_##K38, KC_##K37, KC_##K35, KC_##K35, KC_##K34, KC_##K33, KC_##K32, KC_##K31, KC_##K30 }, \ + } + +#define KEYMAP_AND_REVERSE(args...) KEYMAP(args), KEYMAP_REVERSE(args) + +#define KEYMAP_SWAP( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \ + ) { \ + { KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05 }, \ + { KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15 }, \ + { KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25 }, \ + { KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K35, KC_##K35, KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34 }, \ +} -// MLO: Semi-Grid layout +#define KEYMAP_AND_SWAP(args...) KEYMAP(args), KEYMAP_SWAP(args) // GRD: Grid layout @@ -97,7 +127,4 @@ extern const uint16_t fn_actions[]; } - -// PKR: Standard layout - #endif diff --git a/keyboard/atomic/keymap_plain.c b/keyboard/atomic/keymap_plain.c deleted file mode 100644 index e7f53649f0..0000000000 --- a/keyboard/atomic/keymap_plain.c +++ /dev/null @@ -1,46 +0,0 @@ -#include "keymap_common.h" - -// JCK: Semi-Standard layout - -const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* 0: qwerty */ - [0] = KEYMAP_JCK(GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSPC, \ - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, BSLS, DEL, \ - ESC, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, MPLY, \ - LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, VOLD, VOLU, \ - LCTL, LALT, LGUI, SPC, FN1, LEFT, DOWN, UP, RGHT), - [1] = KEYMAP_JCK(GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSPC, \ - TAB, Q, W, F, P, G, J, L, U, Y, SCLN, LBRC, RBRC, BSLS, DEL, \ - ESC, A, R, S, T, D, H, N, E, I, O, QUOT, ENT, MPLY, \ - LSFT, Z, X, C, V, B, K, M, COMM, DOT, SLSH, RSFT, VOLD, VOLU, \ - LCTL, LALT, LGUI, SPC, FN1, LEFT, DOWN, UP, RGHT), - [2] = KEYMAP_JCK(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, BSPC, \ - TAB, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, LBRC, RBRC, BSLS, DEL, \ - ESC, FN3, FN4, TRNS, TRNS, TRNS, TRNS, MINS, EQL, LBRC, RBRC, BSLS, ENT, MPLY, \ - LSFT, FN9, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, VOLD, VOLU, \ - LCTL, LALT, LGUI, SPC, TRNS, MNXT, VOLD, VOLU, MPLY), -}; -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(2), // to Fn overlay - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - - [9] = ACTION_MODS_KEY(MOD_LSFT | MOD_RSFT, KC_PAUSE), - - [10] = ACTION_MODS_KEY(MOD_LSFT, KC_1), - [11] = ACTION_MODS_KEY(MOD_LSFT, KC_2), - [12] = ACTION_MODS_KEY(MOD_LSFT, KC_3), - [13] = ACTION_MODS_KEY(MOD_LSFT, KC_4), - [14] = ACTION_MODS_KEY(MOD_LSFT, KC_5), - [15] = ACTION_MODS_KEY(MOD_LSFT, KC_6), - [16] = ACTION_MODS_KEY(MOD_LSFT, KC_7), - [17] = ACTION_MODS_KEY(MOD_LSFT, KC_8), - [18] = ACTION_MODS_KEY(MOD_LSFT, KC_9), - [19] = ACTION_MODS_KEY(MOD_LSFT, KC_0), - [20] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS), - [21] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL), - [22] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), - [23] = ACTION_MODS_KEY(MOD_LSFT, KC_LBRC), - [24] = ACTION_MODS_KEY(MOD_LSFT, KC_RBRC), - [28] = ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), -}; diff --git a/keyboard/atomic/keymap_ricky.c b/keyboard/atomic/keymap_ricky.c deleted file mode 100644 index fcc91a1fa5..0000000000 --- a/keyboard/atomic/keymap_ricky.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "keymap_common.h" - -// JCK: Semi-Standard layout - -const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* 0: qwerty */ - [0] = KEYMAP_JCK(GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSPC, \ - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, BSLS, PSCR, \ - CAPS, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, INS, \ - LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, DEL, \ - LCTL, LGUI, LALT, SPC, RALT, RCTL, LEFT, DOWN, RGHT) -}; -const uint16_t PROGMEM fn_actions[] = { -}; - diff --git a/keyboard/atomic/keymap_vlad.c b/keyboard/atomic/keymap_vlad.c deleted file mode 100644 index e56bcf1618..0000000000 --- a/keyboard/atomic/keymap_vlad.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "keymap_common.h" - -// JCK: Semi-Standard layout - -const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* 0: qwerty */ - [0] = KEYMAP_ASK(GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSPC, \ - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, BSLS, DEL, \ - CAPS, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, VOLU, \ - LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, VOLD, \ - LCTL, LGUI, LALT, LGUI, SPC, RGUI, RALT, RGUI, RCTL, LEFT, DOWN, RGHT) -}; -const uint16_t PROGMEM fn_actions[] = { -};
\ No newline at end of file diff --git a/keyboard/atomic/led.c b/keyboard/atomic/led.c index 2d52fbf1c3..2c05746607 100644 --- a/keyboard/atomic/led.c +++ b/keyboard/atomic/led.c @@ -22,4 +22,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void led_set(uint8_t usb_led) { + // // Using PE6 Caps Lock LED + // if (usb_led & (1<<USB_LED_CAPS_LOCK)) + // { + // // Output high. + // DDRE |= (1<<6); + // PORTE |= (1<<6); + // } + // else + // { + // // Output low. + // DDRE &= ~(1<<6); + // PORTE &= ~(1<<6); + // } } diff --git a/keyboard/atomic/matrix.c b/keyboard/atomic/matrix.c index fd233ff53f..01f66e90fb 100644 --- a/keyboard/atomic/matrix.c +++ b/keyboard/atomic/matrix.c @@ -1,5 +1,6 @@ /* -Copyright 2012 Jun Wako <wakojun@gmail.com> +Copyright 2012 Jun Wako +Generated by planckkeyboard.com (2014 Jack Humbert) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,7 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <stdbool.h> #include <avr/io.h> #include <util/delay.h> -#include "action_layer.h" #include "print.h" #include "debug.h" #include "util.h" @@ -43,7 +43,6 @@ static void init_cols(void); static void unselect_rows(void); static void select_row(uint8_t row); - inline uint8_t matrix_rows(void) { @@ -56,7 +55,6 @@ uint8_t matrix_cols(void) return MATRIX_COLS; } - void matrix_init(void) { // To use PORTF disable JTAG with writing JTD bit twice within four cycles. @@ -106,7 +104,6 @@ uint8_t matrix_scan(void) } } - return 1; } @@ -119,7 +116,7 @@ bool matrix_is_modified(void) inline bool matrix_is_on(uint8_t row, uint8_t col) { - return (matrix[row] & ((matrix_row_t)1<<col)); + return (matrix[row] & ((matrix_row_t)1<col)); } inline diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile index ad25854e6d..81c9be1e4b 100644 --- a/keyboard/planck/Makefile +++ b/keyboard/planck/Makefile @@ -60,7 +60,8 @@ ifdef COMMON SRC = keymap_common.c \ $(MATRIX) \ led.c \ - backlight.c + backlight.c \ + beeps.c ifdef KEYMAP SRC := common_keymaps/keymap_$(KEYMAP).c $(SRC) @@ -68,12 +69,19 @@ else SRC := common_keymaps/keymap_jack.c $(SRC) endif +ifdef MATRIX + SRC := matrix_$(MATRIX).c $(SRC) +else + SRC := matrix_pcb.c $(SRC) +endif + else SRC = extended_keymap_common.c \ $(MATRIX) \ led.c \ - backlight.c + backlight.c \ + beeps.c ifdef KEYMAP SRC := extended_keymaps/extended_keymap_$(KEYMAP).c $(SRC) @@ -81,6 +89,12 @@ else SRC := extended_keymaps/extended_keymap_default.c $(SRC) endif +ifdef MATRIX + SRC := matrix_$(MATRIX).c $(SRC) +else + SRC := matrix_pcb.c $(SRC) +endif + endif CONFIG_H = config.h diff --git a/keyboard/planck/analog.c b/keyboard/planck/analog.c new file mode 100644 index 0000000000..49b84ee0e8 --- /dev/null +++ b/keyboard/planck/analog.c @@ -0,0 +1,53 @@ +// Simple analog to digitial conversion + +#include <avr/io.h> +#include <avr/pgmspace.h> +#include <stdint.h> +#include "analog.h" + + +static uint8_t aref = (1<<REFS0); // default to AREF = Vcc + + +void analogReference(uint8_t mode) +{ + aref = mode & 0xC0; +} + + +// Arduino compatible pin input +int16_t analogRead(uint8_t pin) +{ +#if defined(__AVR_ATmega32U4__) + static const uint8_t PROGMEM pin_to_mux[] = { + 0x00, 0x01, 0x04, 0x05, 0x06, 0x07, + 0x25, 0x24, 0x23, 0x22, 0x21, 0x20}; + if (pin >= 12) return 0; + return adc_read(pgm_read_byte(pin_to_mux + pin)); +#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) + if (pin >= 8) return 0; + return adc_read(pin); +#else + return 0; +#endif +} + +// Mux input +int16_t adc_read(uint8_t mux) +{ +#if defined(__AVR_AT90USB162__) + return 0; +#else + uint8_t low; + + ADCSRA = (1<<ADEN) | ADC_PRESCALER; // enable ADC + ADCSRB = (1<<ADHSM) | (mux & 0x20); // high speed mode + ADMUX = aref | (mux & 0x1F); // configure mux input + ADCSRA = (1<<ADEN) | ADC_PRESCALER | (1<<ADSC); // start the conversion + while (ADCSRA & (1<<ADSC)) ; // wait for result + low = ADCL; // must read LSB first + return (ADCH << 8) | low; // must read MSB only once! +#endif +} + + diff --git a/keyboard/planck/analog.h b/keyboard/planck/analog.h new file mode 100644 index 0000000000..9b95a93bef --- /dev/null +++ b/keyboard/planck/analog.h @@ -0,0 +1,36 @@ +#ifndef _analog_h_included__ +#define _analog_h_included__ + +#include <stdint.h> + +void analogReference(uint8_t mode); +int16_t analogRead(uint8_t pin); +int16_t adc_read(uint8_t mux); + +#define ADC_REF_POWER (1<<REFS0) +#define ADC_REF_INTERNAL ((1<<REFS1) | (1<<REFS0)) +#define ADC_REF_EXTERNAL (0) + +// These prescaler values are for high speed mode, ADHSM = 1 +#if F_CPU == 16000000L +#define ADC_PRESCALER ((1<<ADPS2) | (1<<ADPS1)) +#elif F_CPU == 8000000L +#define ADC_PRESCALER ((1<<ADPS2) | (1<<ADPS0)) +#elif F_CPU == 4000000L +#define ADC_PRESCALER ((1<<ADPS2)) +#elif F_CPU == 2000000L +#define ADC_PRESCALER ((1<<ADPS1) | (1<<ADPS0)) +#elif F_CPU == 1000000L +#define ADC_PRESCALER ((1<<ADPS1)) +#else +#define ADC_PRESCALER ((1<<ADPS0)) +#endif + +// some avr-libc versions do not properly define ADHSM +#if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) +#if !defined(ADHSM) +#define ADHSM (7) +#endif +#endif + +#endif diff --git a/keyboard/planck/beeps.c b/keyboard/planck/beeps.c new file mode 100644 index 0000000000..13e46e1daf --- /dev/null +++ b/keyboard/planck/beeps.c @@ -0,0 +1,238 @@ +#include "beeps.h" +#include <math.h> +#include <avr/pgmspace.h> +#include <avr/interrupt.h> +#include <avr/io.h> + +#define PI 3.14159265 +#define CHANNEL OCR1C + +volatile uint16_t sample; +uint16_t lastSample; + +const int sounddata_length=200; + +const unsigned char sounddata_data[] PROGMEM = {128, +128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, +128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, +128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, +128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, +128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, +128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, +128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, +128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, +128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, +128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 127, 129, 128, 127, 133, +117, 109, 125, 121, 116, 132, 140, 126, 114, 114, 116, 120, 114, 93, 73, 66, 76, 116, 142, 129, +128, 129, 120, 119, 118, 104, 87, 123, 181, 194, 196, 198, 189, 176, 160, 162, 172, 164, 164, 183, +197, 188, 168, 167, 170, 165, 185, 209, 206, 196, 196, 199, 185, 162, 156, 167, 176, 173, 170, 166, +151, 142, 140, 134, 130, 127, 113, 86, 67, 66, 69, 75, 73, 75, 86, 90, 91, 84, 65, 48, +41, 30, 26, 56, 91, 88, 72, 70, 73, 82, 89, 73, 57, 60, 74, 89, 92, 77, 63, 60, +53, 47, 56, 64, 63, 61, 56, 54, 52, 36, 16, 22, 51, 66, 67, 70, 76, 88, 99, 92, +77, 74, 85, 100, 106, 97, 83, 85, 96, 108, 133, 160, 164}; + +void delay_us(int count) { + while(count--) { + _delay_us(1); + } +} + +void beeps() { + // DDRB |= (1<<7); + // PORTB &= ~(1<<7); + + // // Use full 16-bit resolution. + // ICR1 = 0xFFFF; + + // // I could write a wall of text here to explain... but TL;DW + // // Go read the ATmega32u4 datasheet. + // // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on + + // // Pin PB7 = OCR1C (Timer 1, Channel C) + // // Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0 + // // (i.e. start high, go low when counter matches.) + // // WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0 + // // Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1 + + // TCCR1A = _BV(COM1C1) | _BV(WGM11); // = 0b00001010; + // TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; + + + // // Turn off PWM control on PB7, revert to output low. + // // TCCR1A &= ~(_BV(COM1C1)); + // // CHANNEL = ((1 << level) - 1); + + // // Turn on PWM control of PB7 + // TCCR1A |= _BV(COM1C1); + // // CHANNEL = level << OFFSET | 0x0FFF; + // // CHANNEL = 0b1010101010101010; + + // float x = 12; + // float y = 24; + // float length = 50; + // float scale = 1; + + // // int f1 = 1000000/440; + // // int f2 = 1000000/880; + // // for (uint32_t i = 0; i < length * 1000; i++) { + // // // int frequency = 1/((sin(PI*2*i*scale*pow(2, x/12.0))*.5+1 + sin(PI*2*i*scale*pow(2, y/12.0))*.5+1) / 2); + + // // ICR1 = f1; // Set max to the period + // // OCR1C = f1 >> 1; // Set compare to half the period + // // // _delay_us(10); + // // } + // int frequency = 1000000/440; + // ICR1 = frequency; // Set max to the period + // OCR1C = frequency >> 1; // Set compare to half the period + // _delay_us(500000); + + // TCCR1A &= ~(_BV(COM1C1)); + // CHANNEL = 0; +play_notes(); + + + // play_note(55*pow(2, 0/12.0), 1); + // play_note(55*pow(2, 12/12.0), 1); + // play_note(55*pow(2, 24/12.0), 1); + // play_note(55*pow(2, 0/12.0), 1); + // play_note(55*pow(2, 12/12.0), 1); + // play_note(55*pow(2, 24/12.0), 1); + + // play_note(0, 4); + + // play_note(55*pow(2, 0/12.0), 8); + // play_note(55*pow(2, 12/12.0), 4); + // play_note(55*pow(2, 10/12.0), 4); + // play_note(55*pow(2, 12/12.0), 8); + // play_note(55*pow(2, 10/12.0), 4); + // play_note(55*pow(2, 7/12.0), 2); + // play_note(55*pow(2, 8/12.0), 2); + // play_note(55*pow(2, 7/12.0), 16); + // play_note(0, 4); + // play_note(55*pow(2, 3/12.0), 8); + // play_note(55*pow(2, 5/12.0), 4); + // play_note(55*pow(2, 7/12.0), 4); + // play_note(55*pow(2, 7/12.0), 8); + // play_note(55*pow(2, 5/12.0), 4); + // play_note(55*pow(2, 3/12.0), 4); + // play_note(55*pow(2, 2/12.0), 16); + + +} + +void play_note(float freq, int length) { + DDRB |= (1<<7); + PORTB &= ~(1<<7); + + if (freq > 0) { + int frequency = 1000000/freq; + ICR1 = frequency; // Set max to the period + OCR1C = frequency >> 1; // Set compare to half the period + + TCCR1A = _BV(COM1C1) | _BV(WGM11); // = 0b00001010; + TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; + } + + for (int i = 0; i < length; i++) { + _delay_us(50000); + } + + TCCR1A &= ~(_BV(COM1C1)); +} + +// This is called at 8000 Hz to load the next sample. +ISR(TIMER1_COMPA_vect) { + if (sample >= sounddata_length) { + if (sample == sounddata_length + lastSample) { + TIMSK1 &= ~_BV(OCIE1A); + + // Disable the per-sample timer completely. + TCCR1B &= ~_BV(CS10); + } + else { + OCR1C = sounddata_length + lastSample - sample; + } + } + else { + OCR1C = pgm_read_byte(&sounddata_data[sample]); + } + + ++sample; +} + +void play_notes() { + + + // Set up Timer 2 to do pulse width modulation on the speaker + // pin. + + DDRB |= (1<<7); + PORTB &= ~(1<<7); + + // Use internal clock (datasheet p.160) + // ASSR &= ~(_BV(EXCLK) | _BV(AS2)); + + // Set fast PWM mode (p.157) + TCCR1A |= _BV(WGM21) | _BV(WGM20); + TCCR1B &= ~_BV(WGM22); + + // Do non-inverting PWM on pin OC2A (p.155) + // On the Arduino this is pin 11. + TCCR1A = (TCCR2A | _BV(COM2A1)) & ~_BV(COM2A0); + TCCR1A &= ~(_BV(COM2B1) | _BV(COM2B0)); + // No prescaler (p.158) + TCCR1B = (TCCR1B & ~(_BV(CS12) | _BV(CS11))) | _BV(CS10); + + // Set initial pulse width to the first sample. + OCR1A = pgm_read_byte(&sounddata_data[0]); + + + + + cli(); + + // Set CTC mode (Clear Timer on Compare Match) (p.133) + // Have to set OCR1A *after*, otherwise it gets reset to 0! + TCCR2B = (TCCR2B & ~_BV(WGM13)) | _BV(WGM12); + TCCR2A = TCCR2A & ~(_BV(WGM11) | _BV(WGM10)); + + // No prescaler (p.134) + TCCR2B = (TCCR2B & ~(_BV(CS12) | _BV(CS11))) | _BV(CS10); + + // Set the compare register (OCR1A). + // OCR1A is a 16-bit register, so we have to do this with + // interrupts disabled to be safe. + // OCR2A = F_CPU / SAMPLE_RATE; // 16e6 / 8000 = 2000 + OCR2A = 2000; + + // Enable interrupt when TCNT1 == OCR1A (p.136) + TIMSK1 |= _BV(OCIE2A); + + sample = 0; + sei(); +} + +void note(int x, float length) { + DDRB |= (1<<1); + int t = (int)(440*pow(2,-x/12.0)); // starting note + for (int y = 0; y < length*1000/t; y++) { // note length + PORTB |= (1<<1); + delay_us(t); + PORTB &= ~(1<<1); + delay_us(t); + } + PORTB &= ~(1<<1); +} + +void true_note(float x, float y, float length) { + for (uint32_t i = 0; i < length * 50; i++) { + uint32_t v = (uint32_t) (round(sin(PI*2*i*640000*pow(2, x/12.0))*.5+1 + sin(PI*2*i*640000*pow(2, y/12.0))*.5+1) / 2 * pow(2, 8)); + for (int u = 0; u < 8; u++) { + if (v & (1 << u) && !(PORTB&(1<<1))) + PORTB |= (1<<1); + else if (PORTB&(1<<1)) + PORTB &= ~(1<<1); + } + } + PORTB &= ~(1<<1); +}
\ No newline at end of file diff --git a/keyboard/planck/beeps.h b/keyboard/planck/beeps.h new file mode 100644 index 0000000000..3e3c634ff5 --- /dev/null +++ b/keyboard/planck/beeps.h @@ -0,0 +1,9 @@ +#include <stdint.h> +#include <stdbool.h> +#include <avr/io.h> +#include <util/delay.h> + +void note(int x, float length); +void beeps(); +void true_note(float x, float y, float length); +void play_note(float freq, int length);
\ No newline at end of file diff --git a/keyboard/planck/common_keymaps/keymap_paul.c b/keyboard/planck/common_keymaps/keymap_paul.c new file mode 100644 index 0000000000..49c90e0196 --- /dev/null +++ b/keyboard/planck/common_keymaps/keymap_paul.c @@ -0,0 +1,49 @@ +#include "keymap_common.h" + +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = KEYMAP( /* Paul */ + TAB, Q, W, E, R, T, Y, U, I, O, P, BSPC, + FN1, A, S, D, F, G, H, J, K, L, SCLN, QUOT, + LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, ENT, + ESC, LCTL, LALT, LGUI, FN2, SPC, FN3, LEFT, DOWN, UP, RGHT), +[1] = KEYMAP( /* Paul FN */ + TRNS, TRNS, TRNS, FN8, FN9, TRNS, TRNS, TRNS, TRNS, MUTE, VOLD, VOLU, + FN1, TRNS, TRNS, HOME, END, TRNS, TRNS, TRNS, TRNS, MPRV, MPLY, MNXT, + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, UP, TRNS, + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, LEFT, DOWN, RGHT), +[2] = KEYMAP( /* Paul LOWER */ + FN22, FN10, FN11, FN12, FN13, FN14, FN15, FN16, FN17, FN18, FN19, BSPC, + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN20, FN21, FN23, FN24, FN28, + TRNS, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, TRNS, + TRNS, TRNS, TRNS, TRNS, FN2, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS), +[3] = KEYMAP( /* Paul RAISE */ + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, BSPC, + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MINS, EQL, LBRC, RBRC, BSLS, + TRNS, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, TRNS, + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN3, TRNS, TRNS, TRNS, TRNS), +}; +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(1), // to Fn1 overlay (FN) + [2] = ACTION_LAYER_MOMENTARY(2), // to Fn2 overlay (LOWER) + [3] = ACTION_LAYER_MOMENTARY(3), // to Fn3 overlay (RAISE) + + [8] = ACTION_MODS_KEY(MOD_LSFT, KC_HOME), + [9] = ACTION_MODS_KEY(MOD_LSFT, KC_END), + [10] = ACTION_MODS_KEY(MOD_LSFT, KC_1), + [11] = ACTION_MODS_KEY(MOD_LSFT, KC_2), + [12] = ACTION_MODS_KEY(MOD_LSFT, KC_3), + [13] = ACTION_MODS_KEY(MOD_LSFT, KC_4), + [14] = ACTION_MODS_KEY(MOD_LSFT, KC_5), + [15] = ACTION_MODS_KEY(MOD_LSFT, KC_6), + [16] = ACTION_MODS_KEY(MOD_LSFT, KC_7), + [17] = ACTION_MODS_KEY(MOD_LSFT, KC_8), + [18] = ACTION_MODS_KEY(MOD_LSFT, KC_9), + [19] = ACTION_MODS_KEY(MOD_LSFT, KC_0), + [20] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS), + [21] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL), + [22] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), + [23] = ACTION_MODS_KEY(MOD_LSFT, KC_LBRC), + [24] = ACTION_MODS_KEY(MOD_LSFT, KC_RBRC), + [28] = ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), + +}; diff --git a/keyboard/planck/extended_keymap_common.c b/keyboard/planck/extended_keymap_common.c index 841b249431..ade8508444 100644 --- a/keyboard/planck/extended_keymap_common.c +++ b/keyboard/planck/extended_keymap_common.c @@ -24,7 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "debug.h" #include "backlight.h" - static action_t keycode_to_action(uint16_t keycode); @@ -70,6 +69,9 @@ action_t action_for_key(uint8_t layer, keypos_t key) } else if (keycode == RESET) { bootloader_jump(); return; + } else if (keycode > RESET) { + // MIDI + return; } switch (keycode) { diff --git a/keyboard/planck/extended_keymap_common.h b/keyboard/planck/extended_keymap_common.h index 21d8978b7b..2dce4a2fac 100644 --- a/keyboard/planck/extended_keymap_common.h +++ b/keyboard/planck/extended_keymap_common.h @@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "action_macro.h" #include "report.h" #include "host.h" -#include "print.h" +// #include "print.h" #include "debug.h" #ifdef BOOTMAGIC_ENABLE @@ -174,4 +174,6 @@ extern const uint16_t fn_actions[]; #define RESET 0x5000 +#define MIDI(n) n | 0x6000 + #endif diff --git a/keyboard/planck/extended_keymaps/extended_keymap_david.c b/keyboard/planck/extended_keymaps/extended_keymap_david.c new file mode 100644 index 0000000000..fe9f3937a5 --- /dev/null +++ b/keyboard/planck/extended_keymaps/extended_keymap_david.c @@ -0,0 +1,76 @@ +#include "extended_keymap_common.h" +#include "beeps.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* Qwerty */ + {KC_Q, KC_W, KC_E, KC_R, KC_T, KC_BSPC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {KC_A, KC_S, KC_D, KC_F, KC_G, KC_ENT, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {KC_Z, KC_X, KC_C, KC_V, KC_B, KC_ESC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {M(10), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + // Space is repeated to accommadate for both spacebar wiring positions +}, +[1] = { /* Colemak */ + {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, + {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, +[2] = { /* RAISE */ + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), RESET, M(0), M(1), M(2), KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_TRNS, KC_F11, KC_F12, M(0), M(1), M(2), M(3), M(4), M(5), M(6), M(7), KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, +[3] = { /* LOWER */ + {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), RESET, M(0), M(1), M(2), S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, + {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +} +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE + [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER + + [3] = ACTION_DEFAULT_LAYER_SET(0), + [4] = ACTION_DEFAULT_LAYER_SET(1), + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + if (record->event.pressed) { + switch(id) { + case 0: + true_note(12, 12, 20); + break; + case 1: + true_note(14, 14, 20); + break; + case 2: + true_note(16, 16, 20); + break; + case 3: + true_note(17, 17, 20); + break; + case 4: + true_note(19, 19, 20); + break; + case 5: + true_note(21, 21, 20); + break; + case 6: + true_note(23, 23, 20); + break; + case 7: + true_note(24, 24, 20); + break; + case 10: + + break; + } + } + return MACRO_NONE; +}; diff --git a/keyboard/planck/extended_keymaps/extended_keymap_default.c b/keyboard/planck/extended_keymaps/extended_keymap_default.c index c35b283675..8bf1a0c87b 100644 --- a/keyboard/planck/extended_keymaps/extended_keymap_default.c +++ b/keyboard/planck/extended_keymaps/extended_keymap_default.c @@ -5,7 +5,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, - {BL_STEP, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {M(0), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} // Space is repeated to accommadate for both spacebar wiring positions }, [1] = { /* Colemak */ @@ -16,19 +16,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }, [2] = { /* RAISE */ {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, - {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS}, + {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_TRNS, KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, [3] = { /* LOWER */ {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, - {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, + {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} } }; - const uint16_t PROGMEM fn_actions[] = { [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER @@ -41,10 +40,15 @@ const uint16_t PROGMEM fn_actions[] = { const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { // MACRODOWN only works in this function - switch(id) { - case 0: - return MACRODOWN(T(CM_T), END); - break; - } + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + ACTION_BACKLIGHT_STEP(); + } else { + unregister_code(KC_RSFT); + } + break; + } return MACRO_NONE; }; diff --git a/keyboard/planck/extended_keymaps/extended_keymap_dzobert.c b/keyboard/planck/extended_keymaps/extended_keymap_dzobert.c new file mode 100644 index 0000000000..6b3864b6c6 --- /dev/null +++ b/keyboard/planck/extended_keymaps/extended_keymap_dzobert.c @@ -0,0 +1,49 @@ +#include "extended_keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* Qwerty */ + {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_TAB}, + {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_BSPC}, + {KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {KC_FN4, KC_RSFT, KC_LGUI, KC_LSFT, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + // Space is repeated to accommadate for both spacebar wiring positions +}, +[1] = { /* Colemak */ + {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_TAB}, + {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_BSPC}, + {KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {KC_FN3, KC_RSFT, KC_LGUI, KC_LSFT, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, +[2] = { /* RAISE */ + {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12}, + {KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_DEL}, + {KC_TRNS, KC_GRV, KC_MINS, KC_EQL, KC_QUOT, S(KC_QUOT), S(KC_LBRC), S(KC_RBRC), KC_LBRC, KC_RBRC, KC_BSLS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_HOME, KC_PGUP, KC_PGDN, KC_END} +}, +[3] = { /* LOWER */ + {KC_POWER,KC_PSCR, KC_SLCK, KC_PAUSE, KC_NLCK, KC_EXECUTE, KC_MENU, KC_APP, KC_7, KC_8, KC_9, KC_KP_SLASH}, + {KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_CAPS, KC_CANCEL, KC_UNDO, KC_AGAIN, KC_4, KC_5, KC_6, KC_KP_ASTERISK}, + {KC_TRNS, KC_INSERT,KC_CUT, KC_COPY, KC_PASTE, KC_BSLS, KC_9, KC_0, KC_1, KC_2, KC_3, KC_KP_MINUS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_0, KC_KP_DOT, KC_KP_ENTER, KC_KP_PLUS} +} +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE + [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER + + [3] = ACTION_DEFAULT_LAYER_SET(0), + [4] = ACTION_DEFAULT_LAYER_SET(1), + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + return MACRODOWN(T(CM_T), END); + break; + } + return MACRO_NONE; +};
\ No newline at end of file diff --git a/keyboard/planck/extended_keymaps/extended_keymap_kyle.c b/keyboard/planck/extended_keymaps/extended_keymap_kyle.c new file mode 100644 index 0000000000..b7b7fcb76b --- /dev/null +++ b/keyboard/planck/extended_keymaps/extended_keymap_kyle.c @@ -0,0 +1,49 @@ +#include "extended_keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* Qwerty */ + {KC_ESC, 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_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_RCTL, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + // Space is repeated to accommadate for both spacebar wiring positions +}, +[1] = { /* Colemak */ + {KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, + {KC_TAB, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, + {KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, +[2] = { /* RAISE */ + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, +[3] = { /* LOWER */ + {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), LSFT(RSFT(KC_D)), KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, + {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, + {BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +} +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE + [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER + + [3] = ACTION_DEFAULT_LAYER_SET(0), + [4] = ACTION_DEFAULT_LAYER_SET(1), + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + return MACRODOWN(T(CM_T), END); + break; + } + return MACRO_NONE; +}; diff --git a/keyboard/planck/extended_keymaps/extended_keymap_leo.c b/keyboard/planck/extended_keymaps/extended_keymap_leo.c new file mode 100644 index 0000000000..0c8b9e3156 --- /dev/null +++ b/keyboard/planck/extended_keymaps/extended_keymap_leo.c @@ -0,0 +1,46 @@ +#include "extended_keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* BASE */ + {KC_ESC, KC_LBRC, KC_QUOT, KC_SCLN, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, + {KC_TAB, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENT}, + {KC_LSFT, KC_DOT, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_COMM}, + {KC_LCTL, KC_LALT, KC_LGUI, FUNC(3), FUNC(2), KC_SPC, KC_SPC, FUNC(1), FUNC(3), KC_RGUI, KC_RALT, KC_RCTL} +}, +[2] = { /* RAISE */ + {RALT(KC_RBRC), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, S(KC_RBRC)}, + {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, +[3] = { /* LOWER */ + {S(KC_EQL),S(KC_1),S(KC_2),S(KC_3),RALT(KC_5),S(KC_5), S(KC_6), S(KC_7),RALT(KC_7),RALT(KC_0),S(KC_0), KC_MINS}, + {KC_TRNS,RALT(KC_2),S(KC_SLSH),KC_NUBS,S(KC_NUBS),RALT(KC_MINS),RALT(KC_NUBS), KC_NUHS, S(KC_8), S(KC_9), S(KC_MINS), KC_SLSH}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RALT(KC_8), RALT(KC_9), KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +}, +[4] = { /* META */ + {KC_TRNS, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_DEL}, + {KC_TRNS, KC_RGHT, KC_DOWN, KC_LEFT, KC_PGUP, KC_TRNS, KC_PGUP, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGDN, KC_TRNS, KC_PGDN, KC_TRNS, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} +} +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE + [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER + [3] = ACTION_LAYER_MOMENTARY(4), // to META + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + return MACRODOWN(T(CM_T), END); + break; + } + return MACRO_NONE; +}; diff --git a/keyboard/planck/extended_keymaps/extended_keymap_max.c b/keyboard/planck/extended_keymaps/extended_keymap_max.c new file mode 100644 index 0000000000..daad22dffe --- /dev/null +++ b/keyboard/planck/extended_keymaps/extended_keymap_max.c @@ -0,0 +1,49 @@ +#include "extended_keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* Qwerty */ + {KC_ESC, 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_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, 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_QUOT}, + {KC_LCTL, BL_STEP, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + // Space is repeated to accommadate for both spacebar wiring positions +}, +[1] = { /* Colemak */ + {KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, + {KC_TAB, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT }, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT}, + {KC_LCTL, BL_STEP, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, +[2] = { /* RAISE */ + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_TRNS}, + {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_BSLS}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +}, +[3] = { /* LOWER */ + {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, + {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), KC_TRNS}, + {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, S(KC_BSLS)}, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} +} +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE + [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER + + [3] = ACTION_DEFAULT_LAYER_SET(0), + [4] = ACTION_DEFAULT_LAYER_SET(1), + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + return MACRODOWN(T(CM_T), END); + break; + } + return MACRO_NONE; +}; diff --git a/keyboard/planck/extended_keymaps/extended_keymap_numpad.c b/keyboard/planck/extended_keymaps/extended_keymap_numpad.c new file mode 100644 index 0000000000..721fd496b0 --- /dev/null +++ b/keyboard/planck/extended_keymaps/extended_keymap_numpad.c @@ -0,0 +1,26 @@ +#include "extended_keymap_common.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +[0] = { /* Qwerty */ + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_KP_MINUS, KC_KP_PLUS, KC_KP_PLUS, KC_KP_ENTER, KC_KP_ENTER}, + {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_KP_ASTERISK, KC_KP_9, KC_KP_6, KC_KP_3, KC_KP_DOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_KP_SLASH, KC_KP_8, KC_KP_5, KC_KP_2, KC_KP_0}, + {BL_STEP, KC_LCTL, KC_LALT, KC_LGUI, KC_NO, KC_SPC, KC_SPC, KC_NUMLOCK, KC_KP_7, KC_KP_4, KC_KP_1, KC_KP_0} + // Space is repeated to accommadate for both spacebar wiring positions +} +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + return MACRODOWN(T(CM_T), END); + break; + } + return MACRO_NONE; +};
\ No newline at end of file diff --git a/keyboard/planck/flash-pcb.sh b/keyboard/planck/flash-pcb.sh new file mode 100755 index 0000000000..2ae15458c0 --- /dev/null +++ b/keyboard/planck/flash-pcb.sh @@ -0,0 +1,3 @@ +dfu-programmer atmega32u4 erase --force +dfu-programmer atmega32u4 flash planck_pcb.hex +dfu-programmer atmega32u4 reset
\ No newline at end of file diff --git a/keyboard/planck/keymap_common.h b/keyboard/planck/keymap_common.h index 4a0bcfbb08..d46df92876 100644 --- a/keyboard/planck/keymap_common.h +++ b/keyboard/planck/keymap_common.h @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "action_macro.h" #include "report.h" #include "host.h" -#include "print.h" +// #include "print.h" #include "debug.h" #include "keymap.h" diff --git a/keyboard/planck/matrix_center.c b/keyboard/planck/matrix_center.c index 8e34130d6f..2a603f334b 100644 --- a/keyboard/planck/matrix_center.c +++ b/keyboard/planck/matrix_center.c @@ -23,10 +23,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <avr/io.h> #include <util/delay.h> #include "action_layer.h" -#include "print.h" +// #include "print.h" #include "debug.h" #include "util.h" #include "matrix.h" +#include "analog.h" #ifndef DEBOUNCE @@ -40,9 +41,14 @@ static matrix_row_t matrix_debouncing[MATRIX_ROWS]; static matrix_row_t read_cols(void); static void init_cols(void); +static void init_encoder(void); +static void init_pot(void); static void unselect_rows(void); static void select_row(uint8_t row); - +int16_t analogRead(uint8_t pin); +uint8_t state; +int32_t position; +int16_t value; inline uint8_t matrix_rows(void) @@ -61,6 +67,8 @@ void matrix_init(void) // initialize row and col unselect_rows(); init_cols(); + init_encoder(); + init_pot(); // initialize matrix state: all keys off for (uint8_t i=0; i < MATRIX_ROWS; i++) { @@ -69,6 +77,50 @@ void matrix_init(void) } } +static void init_encoder(void) +{ + DDRC &= ~(1<<6 | 1<<7); + PORTC |= (1<<6 | 1<<7); + + uint8_t s = 0; + _delay_ms(1); + if (PINC&(1<<6)) s |= 1; + if (PINC&(1<<7)) s |= 2; + state = s; + position = 0; +} + +void read_encoder(void) +{ + uint8_t s = state & 3; + if (PINC&(1<<6)) s |= 4; + if (PINC&(1<<7)) s |= 8; + state = (s >> 2); + switch (s) { + case 1: case 7: case 8: case 14: + position++; + break; + case 2: case 4: case 11: case 13: + position--; + break; + case 3: case 12: + position += 2; + break; + case 6: case 9: + position -= 2; + break; + } +} + +#define HEX(n) (((n) < 10) ? ((n) + '0') : ((n) + 'A' - 10)) + +static void init_pot(void) +{ + // DDRD &= ~(1<<4); + // PORTD |= (1<<4); + // DIDR2 = (1<<0); +} + uint8_t matrix_scan(void) { for (uint8_t i = 0; i < MATRIX_ROWS; i++) { @@ -95,6 +147,21 @@ uint8_t matrix_scan(void) } } + read_encoder(); + if (position >= 2) { + register_code(KC_AUDIO_VOL_UP); + unregister_code(KC_AUDIO_VOL_UP); + position = 0; + } else if (position <= -2) { + register_code(KC_AUDIO_VOL_DOWN); + unregister_code(KC_AUDIO_VOL_DOWN); + position = 0; + } + + // uint16_t val = analogRead(11); + + // debug("analogRead: "); debug_hex(val); debug("\n"); + return 1; } diff --git a/keyboard/planck/matrix_handwired.c b/keyboard/planck/matrix_handwired.c index 2f2dbdb108..2ae69c3c80 100644 --- a/keyboard/planck/matrix_handwired.c +++ b/keyboard/planck/matrix_handwired.c @@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <stdbool.h> #include <avr/io.h> #include <util/delay.h> -#include "print.h" +// #include "print.h" #include "debug.h" #include "util.h" #include "matrix.h" diff --git a/keyboard/planck/matrix_pcb.c b/keyboard/planck/matrix_pcb.c index 11a7376d86..6f6ccd5c1c 100644 --- a/keyboard/planck/matrix_pcb.c +++ b/keyboard/planck/matrix_pcb.c @@ -23,13 +23,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <stdbool.h> #include <avr/io.h> #include <util/delay.h> -#include "print.h" +// #include "print.h" #include "debug.h" #include "util.h" #include "matrix.h" #include "backlight.h" // TODO fix this dependency - #ifndef DEBOUNCE # define DEBOUNCE 10 #endif @@ -67,7 +66,7 @@ void matrix_init(void) // Turn status LED on DDRE |= (1<<6); PORTE |= (1<<6); - + // initialize row and col unselect_rows(); init_cols(); |