diff --git a/.gitignore b/.gitignore index bae2658b00..49eb2d5587 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ tags *~ build/ *.bak +.vagrant/ diff --git a/HAND-WIRE.md b/HAND-WIRE.md new file mode 100644 index 0000000000..3f4d75b272 --- /dev/null +++ b/HAND-WIRE.md @@ -0,0 +1,323 @@ +# Quantum Hand-wiring Guide + +Parts list: +* *x* keyswitches (MX, Matias, Gateron, etc) +* *x* diodes +* Keyboard plate (metal, plastic, cardboard, etc) +* Wire (strained for wiring to the Teensy, anything for the rows/columns) +* Soldering iron set at 600ºF or 315ºC (if temperature-controlled) +* Resin-cored solder (leaded or lead-free) +* Adequate ventilation/a fan +* Tweezers (optional) +* Wire cutters/snippers + +## How the matrix works (why we need diodes) + +The microcontroller (in this case, the Teensy 2.0) will be setup up via the firmware to send a logical 1 to the columns, one at a time, and read from the rows, all at once - this process is called matrix scanning. The matrix is a bunch of open switches that, by default, don't allow any current to pass through - the firmware will read this as no keys being pressed. As soon as you press one key down, the logical 1 that was coming from the column the keyswitch is attached to gets passed through the switch and to the corresponding row - check out the following 2x2 example: + + Column 0 being scanned Column 1 being scanned + x x + col0 col1 col0 col1 + | | | | + row0 ---(key0)---(key1) row0 ---(key0)---(key1) + | | | | + row1 ---(key2)---(key3) row1 ---(key2)---(key3) + +The `x` represents that the column/row associated has a value of 1, or is HIGH. Here, we see that no keys are being pressed, so no rows get an `x`. For one keyswitch, keep in mind that one side of the contacts is connected to its row, and the other, its column. + +When we press `key0`, `col0` gets connected to `row0`, so the values that the firmware receives for that row is `0b01` (the `0b` here means that this is a bit value, meaning all of the following digits are bits - 0 or 1 - and represent the keys in that column). We'll use this notation to show when a keyswitch has been pressed, to show that the column and row are being connected: + + Column 0 being scanned Column 1 being scanned + x x + col0 col1 col0 col1 + | | | | + x row0 ---(-+-0)---(key1) row0 ---(-+-0)---(key1) + | | | | + row1 ---(key2)---(key3) row1 ---(key2)---(key3) + +We can now see that `row0` has an `x`, so has the value of 1. As a whole, the data the firmware receives when `key0` is pressed is + + col0: 0b01 + col1: 0b00 + │└row0 + └row1 + +A problem arises when you start pressing more than one key at a time. Looking at our matrix again, it should become pretty obvious: + + Column 0 being scanned Column 1 being scanned + x x + col0 col1 col0 col1 + | | | | + x row0 ---(-+-0)---(-+-1) x row0 ---(-+-0)---(-+-1) + | | | | + x row1 ---(key2)---(-+-3) x row1 ---(key2)---(-+-3) + + Remember that this ^ is still connected to row1 + +The data we get from that is: + + col0: 0b11 + col1: 0b11 + │└row0 + └row1 + +Which isn't accurate, since we only have 3 keys pressed down, not all 4. This behavior is called ghosting, and only happens in odd scenarios like this, but can be much more common on a bigger keyboard. The way we can get around this is by placing a diode after the keyswitch, but before it connects to its row. A diode only allows current to pass through one way, which will protect our other columns/rows from being activated in the previous example. We'll represent a dioded matrix like this; + + Column 0 being scanned Column 1 being scanned + x x + col0 col1 col0 col1 + │ │ | │ + (key0) (key1) (key0) (key1) + ! │ ! │ ! | ! │ + row0 ─────┴────────┘ │ row0 ─────┴────────┘ │ + │ │ | │ + (key2) (key3) (key2) (key3) + ! ! ! ! + row1 ─────┴────────┘ row1 ─────┴────────┘ + +In practical applications, the black line of the diode will be placed facing the row, and away from the keyswitch - the `!` in this case is the diode, where the gap represents the black line. A good way to remember this is to think of this symbol: `>|` + +Now when we press the three keys, invoking what would be a ghosting scenario: + + Column 0 being scanned Column 1 being scanned + x x + col0 col1 col0 col1 + │ │ │ │ + (┌─┤0) (┌─┤1) (┌─┤0) (┌─┤1) + ! │ ! │ ! │ ! │ + x row0 ─────┴────────┘ │ x row0 ─────┴────────┘ │ + │ │ │ │ + (key2) (┌─┘3) (key2) (┌─┘3) + ! ! ! ! + row1 ─────┴────────┘ x row1 ─────┴────────┘ + +Things act as they should! Which will get us the following data: + + col0: 0b01 + col1: 0b11 + │└row0 + └row1 + +The firmware can then use this correct data to detect what it should do, and eventually, what signals it needs to send to the OS. + +## The actual hand-wiring + +### Getting things in place + +When starting this, you should have all of your stabilisers and keyswitches already installed (and optionally keycaps). If you're using a Cherry-type stabiliser (plate-mounted only, obviously), you'll need to install that before your keyswitches. If you're using Costar ones, you can installed them afterwards. + +To make things easier on yourself, make sure all of the keyswitches are oriented the same way (if they can be - not all layouts support this). Despite this, it's important to remember that the contacts on the keyswitches are completely symmetrical. We'll be using the keyswitch's left side contact for wiring the rows, and the right side one for wiring the columns. + +Get your soldering iron heated-up and collect the rest of the materials from the part list at the beginning of the guide. Place your keyboard so that the bottoms of the keyswitches are accessible - it may be a good idea to place it on a cloth to protect your keyswitches/keycaps. + +Before continuing, plan out where you're going to place your Teensy. If you're working with a board that has a large (6.25u) spacebar, it may be a good idea to place it in-between switches against the plate. Otherwise, you may want to trim some of the leads on the keyswitches where you plan on putting it - this will make it a little harder to solder the wire/diodes, but give you more room to place the Teensy. + +### Preparing the diodes + +It's a little easier to solder the diodes in place if you bend them at a 90º angle immediately after the black line - this will help to make sure you put them on the right way (direction matters), and in the correct position. The diodes will look like this when bent (with longer leads): + + ┌─────┬─┐ + ───┤ │ ├─┐ + └─────┴─┘ │ + │ + +We'll be using the long lead at the bent end to connect it to the elbow (bent part) of the next diode, creating the row. + +### Soldering the diodes + +Starting at the top-left switch, place the diode (with tweezers if you have them) on the switch so that the diode itself is vertically aligned, and the black line is facing toward you. The straight end of the diode should be touching the left contact on the switch, and the bent end should be facing to the right and resting on the switch there, like this: + + │o + ┌┴┐ o + │ │ O + ├─┤ + └┬┘ + └───────────── + +Letting the diode rest, grab your solder, and touch both it and the soldering iron to the left contact at the same time - the rosin in the solder should make it easy for the solder to flow over both the diode and the keyswitch contact. The diode may move a little, and if it does, carefully position it back it place by grabbing the bent end of the diode - the other end will become hot very quickly. If you find that it's moving too much, using needle-nose pliers of some sort may help to keep the diode still when soldering. + +The smoke that the rosin releases is harmful, so be careful not to breath it or get it in your eyes/face. + +After soldering things in place, it may be helpful to blow on the joint to push the smoke away from your face, and cool the solder quicker. You should see the solder develop a matte (not shiney) surface as it solidifies. Keep in mind that it will still be very hot afterwards, and will take a couple minutes to be cool to touch. Blow on it will accelerate this process. + +When the first diode is complete, the next one will need to be soldered to both the keyswitch, and the previous diode at the new elbow. That will look something like this: + + │o │o + ┌┴┐ o ┌┴┐ o + │ │ O │ │ O + ├─┤ ├─┤ + └┬┘ └┬┘ + └────────────────┴───────────── + +After completing a row, use the wire cutters to trim the excess wire from the tops of the diodes, and from the right side on the final switch. This process will need to completed for each row you have. + +When all of the diodes are completely soldered, it's a good idea to quickly inspect each one to ensure that your solder joints are solid and sturdy - repairing things after this is possible, but more difficult. + +### Soldering the columns + +You'll have some options in the next process - it's a good idea to insulate the column wires (since the diodes aren't), but if you're careful enough, you can use exposed wires for the columns - it's not recommended, though. If you're using single-cored wire, stripping the plastic off of the whole wire and feeding it back on is probably the best option, but can be difficult depending on the size and materials. You'll want to leave parts of the wire exposed where you're going to be solder it onto the keyswitch. + +If you're using stranded wire, it's probably easiest to just use a lot of small wires to connect each keyswitch along the column. It's possible to use one and melt through the insulation, but this isn't recommended, will produce even more harmful fumes, and can ruin your soldering iron. + +Before beginning to solder, it helps to have your wire pre-bent (if using single-cored), or at least have an idea of how you're going to route the column (especially if you're making a staggered board). Where you go in particular doesn't matter too much, as we'll be basing our keymap definitions on how it was wired - just make sure every key in a particular row is in a unique column, and that they're in order from left to right. + +If you're not using any insulation, you can try to keep the column wires elevated, and solder them near the tips of the keyswitch contacts - if the wires are sturdy enough, they won't short out to the row wiring an diodes. + +### Wiring things to the Teensy + +Now that the matrix itself is complete, it's time to connect what you've done to the Teensy. You'll be needing the number of pins equal to your number of columns + your number of rows. There are some pins on the Teensy that are special, like D6 (the LED on the chip), or some of the UART, SPI, I2C, or PWM channels, but only avoid those if you're planning something in addition to a keyboard. If you're unsure about wanting to add something later, you should have enough pins in total to avoid a couple. + +The pins you'll absolutely have to avoid are: GND, VCC, AREF, and RST - all the others are usable and accessible in the firmware. + +Place the Teensy where you plan to put it - you'll have to cut wires to length in the next step, and you'll want to make sure they reach. + +Starting with the first column on the right side, measure out how much wire you'll need to connect it to the first pin on the Teensy - it helps to pick a side that you'll be able to work down, to keep the wires from overlapping too much. It may help to leave a little bit of slack so things aren't too tight. Cut the piece of wire, and solder it to the Teensy, and then the column - you can solder it anywhere along the column, but it may be easiest at the keyswitch. Just be sure the wire doesn't separate from the keyswitch when soldering. + +As you move from column to column, it'll be helpful to write the locations of the pins down. We'll use this data to setup the matrix in the future. + +When you're done with the columns, start with the rows in the same process, from top to bottom, and write them all down. Again, you can solder anywhere along the row, as long as it's after the diode - soldering before the diode (on the keyswitch side) will cause that row not to work. + +As you move along, be sure that the Teensy is staying in place - recutting and soldering the wires is a pain! + +### Getting some basic firmware set-up + +From here, you should have a working keyboard with the correct firmware. Before we attach the Teensy permanently to the keyboard, let's quickly get some firmware loaded onto the Teensy so we can test each keyswitch. + +To start out, download [the firmware](https://github.com/jackhumbert/qmk_firmware/) - we'll be using my (Jack's) fork of TMK called QMK/Quantum. We'll be doing a lot from the Terminal/command prompt, so get that open, along with a decent text editor like [Sublime Text](http://www.sublimetext.com/). + +The first thing we're going to do is create a new project using the script in the root directory of the firmware. In your terminal, run this command with `` replaced by the name of your project - it'll need to be different from any other project in the `keyboard/` folder: + + ./new_project.sh + +You'll want to navigate to the `keyboard//` folder by typing, like the print-out from the script specifies: + + cd keyboard/ + +#### config.h + +The first thing we're going to want to modify is the `config.h` file. On line 32 and 33, you'll see `MATRIX_ROWS` and `MATRIX_COLS` - set both these variables to however many rows and columns you have on your keyboard. + +On line 38 and 39 you'll see the `COLS` and `ROWS` definitions - this is where you'll enter the pins you used, in order (left-to-right when looking at the top of the keyboard, but right-to-left when looking at the bottom). + +There are some other variables that you'll be able to modify (lines 23-29), but it's not necessary to do that now (or ever, really). + +#### \.h + +The next file you'll want to look at is `.h`. You're going to want to rewrite the `KEYMAP` definition - the format and syntax here is extremely important, so pay attention to how things are setup. The first half of the definition are considered the arguments - this is the format that you'll be following in your keymap later on, so you'll want to have as many k*xy* variables here as you do keys. The second half is the part that the firmware actually looks at, and will contain gaps depending on how you wired your matrix. + +We'll dive into how this will work with the following example. Say we have a keyboard like this: + + ┌───┬───┬───┐ + │ │ │ │ + ├───┴─┬─┴───┤ + │ │ │ + └─────┴─────┘ + +This can be described by saying the top row is 3 1u keys, and the bottom row is 2 1.5u keys. The difference between the two rows is important, because the bottom row has an unused column spot (3 v 2). Let's say that this is how we wired the columns: + + ┌───┬───┬───┐ + │ ┋ │ ┋ │ ┋ │ + ├─┋─┴─┬─┴─┋─┤ + │ ┋ │ ┋ │ + └─────┴─────┘ + +The middle column is unused on the bottom row in this example. Our `KEYMAP` definition would look like this: + + #define KEYMAP( \ + k00, k01, k02, \ + k10, k11, \ + ) \ + { \ + { k00, k01, k02 }, \ + { k10, KC_NO, k11 }, \ + } + +Notice how the top half is spaced to resemble our physical layout - this helps us understand which keys are associated with which columns. The bottom half uses the keycode `KC_NO` where there is no keyswitch wired in. It's easiest to keep the bottom half aligned in a grid to help us make sense of how the firmware actually sees the wiring. + +Let's say that instead, we wired our keyboard like this (a fair thing to do): + + ┌───┬───┬───┐ + │ ┋ │ ┋│ ┋ │ + ├─┋─┴─┬┋┴───┤ + │ ┋ │┋ │ + └─────┴─────┘ + +This would require our `KEYMAP` definition to look like this: + + #define KEYMAP( \ + k00, k01, k02, \ + k10, k11, \ + ) \ + { \ + { k00, k01, k02 }, \ + { k10, k11, KC_NO }, \ + } + +Notice how the `k11` and `KC_NO` switched places to represent the wiring, and the unused final column on the bottom row. Sometimes it'll make more sense to put a keyswitch on a particular column, but in the end, it won't matter, as long as all of them are accounted for. You can use this process to write out the `KEYMAP` for your entire keyboard - be sure to remember that your keyboard is actually backwards when looking at the underside of it. + +#### keymaps/default.c + +This is the actual keymap for your keyboard, and the main place you'll make changes as you perfect your layout. `default.c` is the file that gets pull by default when typing `make`, but you can make other files as well, and specify them by typing `make KEYMAP=`, which will pull `keymaps/.c`. + +The basis of a keymap is its layers - by default, layer 0 is active. You can activate other layers, the highest of which will be referenced first. Let's start with our base layer. + +Using our previous example, let's say we want to create the following layout: + + ┌───┬───┬───┐ + │ A │ 1 │ H │ + ├───┴─┬─┴───┤ + │ TAB │ SPC │ + └─────┴─────┘ + +This can be accomplished by using the following `keymaps` definition: + + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = KEYMAP( /* Base */ + KC_A, KC_1, KC_H, \ + KC_TAB, KC_SPC \ + ), + }; + +Note that the layout of the keycodes is similar to the physical layout of our keyboard - this make it much easier to see what's going on. A lot of the keycodes should be fairly obvious, but for a full list of them, check out [tmk_code/doc/keycode.txt](https://github.com/jackhumbert/qmk_firmware/blob/master/tmk_core/doc/keycode.txt) - there are also a lot of aliases to condense your keymap file. + +It's also important to use the `KEYMAP` function we defined earlier - this is what allows the firmware to associate our intended readable keymap with the actual wiring. + +#### Compiling your firmware + +After you've written out your entire keymap, you're ready to get the firmware compiled and onto your Teensy. Before compiling, you'll need to get your [development environment set-up](https://github.com/jackhumbert/qmk_firmware/blob/master/keyboard/planck/PCB_GUIDE.md#setting-up-the-environment) - you can skip the dfu-programmer instructions, but you'll need to download and install the [Teensy Loader](https://www.pjrc.com/teensy/loader.html) to get the firmware on your Teensy. + +Once everything is installed, running `make` in the terminal should get you some output, and eventually a `.hex` file in that folder. If you're having trouble with this step, see the end of the guide for the trouble-shooting section. + +Once you have your `.hex` file, open up the Teensy loader application, and click the file icon. From here, navigate to your `QMK/keyboard//` folder, and select the `.hex` file. Plug in your keyboard and press the button on the Teensy - you should see the LED on the device turn off once you do. The Teensy Loader app will change a little, and the buttons should be clickable - click the download button (down arrow), and then the reset button (right arrow), and your keyboard should be ready to go! + +#### Testing your firmware + +Carefully flip your keyboard over, open up a new text document, and try typing - you should get the characters that you put into your keymap. Test each key, and note the ones that aren't working. Here's a quick trouble-shooting guide for non-working keys: + +0. Flip the keyboard back over and short the keyswitch's contacts with a piece wire - this will eliminate the possibility of the keyswitch being bad and needing to be replaced. +1. Check the solder points on the keyswitch - these need to be plump and whole. If you touch it with a moderate amount of force and it comes apart, it's not strong enough. +2. Check the solder joints on the diode - if the diode is loose, part of your row may register, while the other may not. +3. Check the solder joints on the columns - if your column wiring is loose, part or all of the column may not work. +4. Check the solder joints on both sides of the wires going to/from the Teensy - the wires need to be fully soldered and connect to both sides. +5. Check the .h file for errors and incorrectly placed `KC_NO`s - if you're unsure where they should be, instead duplicate a k*xy* variable. +6. Check to make sure you actually compiled the firmware and flashed the Teensy correctly. Unless you got error messages in the terminal, or a pop-up during flashing, you probably did everything correctly. + +If you've done all of these things, keep in mind that sometimes you might have had multiple things affecting the keyswitch, so it doesn't hurt to test the keyswitch by shorting it out at the end. + +#### Securing the Teensy, finishing your hardware, getting fancier firmware + +Now that you have a working board, it's time to get things in their permanent positions. I've often used liberal amounts of hot glue to secure and insulate things, so if that's your style, start spreading that stuff like butter. Otherwise, double-sided tape is always an elegant solution, and electrical tape is a distant second. Due to the nature of these builds, a lot of this part is up to you and how you planned (or didn't plan) things out. + +There are a lot of possibilities inside the firmware - check out the [README](https://github.com/jackhumbert/qmk_firmware/blob/master/README.md) for a full feature list, and dive into the different project (Planck, Ergodox EZ, etc) to see how people use all of them. You can always stop by [the OLKB subreddit for help!](http://reddit.com/r/olkb) + +## Trouble-shooting compiling + +### Windows + +#### fork: Resource temporarily unavailable + +http://www.avrfreaks.net/forum/windows-81-compilation-error + +### Mac + +### Linux diff --git a/QUICK_START.md b/QUICK_START.md new file mode 100644 index 0000000000..6be377db3c --- /dev/null +++ b/QUICK_START.md @@ -0,0 +1,25 @@ +# Quick Start Directions + +This project includes a Vagrantfile that will allow you to build a new firmware for your keyboard very easily without major changes to your primary operating system. This also ensures that when you clone the project and perform a build, you have the exact same environment as anyone else using the Vagrantfile to build. This makes it much easier for people to help you troubleshoot any issues you encounter. + +## Requirements + +Using the Vagrantfile in this repository requires you have [Vagrant](http://www.vagrantup.com/) as well as [VirtualBox](https://www.virtualbox.org/) (or [VMware Workstation](https://www.vmware.com/products/workstation) and [Vagrant VMware plugin](http://www.vagrantup.com/vmware) but the (paid) VMware plugin requires a licensed copy of VMware Workstation/Fusion). + +*COMPATIBILITY NOTICE* Certain versions of Virtualbox 5 appear to have an incompatibility with the Virtualbox extensions installed in the boxes in this Vagrantfile. If you encounter any issues with the /vagrant mount not succeeding, please upgrade your version of Virtualbox to at least 5.0.12. + +Other than having Vagrant and Virtualbox installed and possibly a restart of your computer afterwards, you can simple run a 'vagrant up' anywhere inside the folder where you checked out this project and it will start a Linux virtual machine that contains all the tools required to build this project. There is a post Vagrant startup hint that will get you off on the right foot, otherwise you can also reference the build documentation below. + +Build Firmware and Program Controller +------------------------------------- +See [doc/build.md](tmk_core/doc/build.md), or the README in the particular keyboard/* folder. + +Change your keymap +------------------ +See [doc/keymap.md](tmk_core/doc/keymap.md). + +## Flashing the firmware + +The "easy" way to flash the firmware is using a tool from your host OS like the Teensy programming app. [ErgoDox EZ](keyboard/ergodox_ez/README.md) gives a great example. + +If you want to program via the command line you can uncomment the ['modifyvm'] lines in the Vagrantfile to enable the USB passthrough into Linux and then program using the command line tools like dfu-util/dfu-programmer or you can install the Teensy CLI version. diff --git a/README.md b/README.md index 55fb76798b..2ed05e76e2 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ The documentation below explains QMK customizations and elaborates on some of th ## Getting started * **If you're looking to customize a keyboard that currently runs QMK or TMK** , find your keyboard's directory under `/keyboard/` and read the README file. This will get you all set up. +* Read the [QUICK_START.md](QUICK_START.md) if you want to hit the ground running with minimal fuss or you aren't a technical person and you just want to build the firmware with the least amount of hassle possible. * If you're looking to apply this firmware to an entirely new hardware project (a new kind of keyboard), you can create your own Quantum-based project by using `./new_project.sh `, which will create `/keyboard/` with all the necessary components for a Quantum project. You have access to a bunch of goodies! Check out the Makefile to enable/disable some of the features. Uncomment the `#` to enable them. Setting them to `no` does nothing and will only confuse future you. @@ -46,6 +47,7 @@ Your keymap can include shortcuts to common operations (called "function actions * `RGUI(kc)` - applies right GUI (command/win) to *kc* * `HYPR(kc)` - applies Hyper (all modifiers) to *kc* * `MEH(kc)` - applies Meh (all modifiers except Win/Cmd) to *kc* +* `LCAG(kc)` - applies CtrlAltGui to *kc* You can also chain these, like this: @@ -89,6 +91,7 @@ We've added shortcuts to make common modifier/tap (mod-tap) mappings more compac * `ALT_T(kc)` - is LALT when held and *kc* when tapped * `GUI_T(kc)` - is LGUI when held and *kc* when tapped * `ALL_T(kc)` - is Hyper (all mods) when held and *kc* when tapped. To read more about what you can do with a Hyper key, see [this blog post by Brett Terpstra](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/) + * `LCAG_T(kc)` - is CtrlAltGui when held and *kc* when tapped * `MEH_T(kc)` - is like Hyper, but not as cool -- does not include the Cmd/Win key, so just sends Alt+Ctrl+Shift. ### Temporarily setting the default layer @@ -175,3 +178,23 @@ This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happeni ## Bluetooth functionality This requires [some hardware changes](https://www.reddit.com/r/MechanicalKeyboards/comments/3psx0q/the_planck_keyboard_with_bluetooth_guide_and/?ref=search_posts), but can be enabled via the Makefile. The firmware will still output characters via USB, so be aware of this when charging via a computer. It would make sense to have a switch on the Bluefruit to turn it off at will. + +## International Characters on Windows + +[AutoHotkey](https://autohotkey.com) allows Windows users to create custom hotkeys amont others. + +The method does not require Unicode support in the keyboard itself but depends instead of AutoHotkey running in the background. + +First you need to select a modifier combination that is not in use by any of your programs. +CtrlAltWin is not used very widely and should therefore be perfect for this. +There is a macro defined for a mod-tab combo `LCAG_T`. +Add this mod-tab combo to a key on your keyboard, e.g.: `LCAG_T(KC_TAB)`. +This makes the key behave like a tab key if pressed and released immediately but changes it to the modifier if used with another key. + +In the default script of AutoHotkey you can define custom hotkeys. + + <^. #define MOUSEKEY_MAX_SPEED 3 #define MOUSEKEY_TIME_TO_MAX 10 +#define TAPPING_TOGGLE 1 + #define COLS (int []){ F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } #define ROWS (int []){ D0, D5, B5, B6 } diff --git a/keyboard/ergodox_ez/keymaps/keymap_andrew_osx.hex b/keyboard/ergodox_ez/keymaps/andrew_osx/andrew_osx.hex similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_andrew_osx.hex rename to keyboard/ergodox_ez/keymaps/andrew_osx/andrew_osx.hex diff --git a/keyboard/ergodox_ez/keymaps/keymap_andrew_osx.c b/keyboard/ergodox_ez/keymaps/andrew_osx/keymap.c similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_andrew_osx.c rename to keyboard/ergodox_ez/keymaps/andrew_osx/keymap.c diff --git a/keyboard/ergodox_ez/keymaps/coderkun_neo2/coderkun_neo2.hex b/keyboard/ergodox_ez/keymaps/coderkun_neo2/coderkun_neo2.hex new file mode 100644 index 0000000000..c4804d4830 Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/coderkun_neo2/coderkun_neo2.hex differ diff --git a/keyboard/ergodox_ez/keymaps/coderkun_neo2/keymap.c b/keyboard/ergodox_ez/keymaps/coderkun_neo2/keymap.c new file mode 100644 index 0000000000..bec67e7d4c --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/coderkun_neo2/keymap.c @@ -0,0 +1,137 @@ +#include "ergodox_ez.h" +#include "debug.h" +#include "action_layer.h" +#include "keymap_extras/keymap_neo2.h" + +// Layer names +#define BASE 0 // default layer +#define FMU 1 // FMU layer + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Layer 0 (default) + * ┌───────┬─────┬─────┬─────┬─────┬─────┬─────┐ ┌─────┬─────┬─────┬─────┬─────┬─────┬───────┐ + * │ TAB │ 1 │ 2 │ 3 │ 4 │ 5 │ ` │ │ ´ │ 6 │ 7 │ 8 │ 9 │ 0 │ BKSPC │ + * ├───────┼─────┼─────┼─────┼─────┼─────┼─────┤ ├─────┼─────┼─────┼─────┼─────┼─────┼───────┤ + * │ Y │ X │ V │ L │ C │ W │ HOM │ │ END │ K │ H │ G │ F │ Q │ ß │ + * ├───────┼─────┼─────┼─────╆─────╅─────┤ E │ │ ├─────╆─────╅─────┼─────┼─────┼───────┤ + * │ Mod3 │ U │ I │ A │ E │ O ├─────┤ ├─────┤ S │ N │ R │ T │ D │ Mod3 │ + * ├───────┼─────┼─────┼─────╄─────╃─────┤ TL2 │ │ TL3 ├─────╄─────╃─────┼─────┼─────┼───────┤ + * │ LSHFT │ Ü │ Ö │ Ä │ P │ Z │ │ │ │ B │ M │ , │ . │ J │ Shift │ + * └─┬─────┼─────┼─────┼─────┼─────┼─────┴─────┘ └─────┴─────┼─────┼─────┼─────┼─────┼─────┬─┘ + * │ CTL │ ALT │ MO1 │ Win │ Mod4│ │ Mod4│ Win │ MO1 │ Alt │ CTL │ + * └─────┴─────┴─────┴─────┴─────┘ ┌─────┬─────┐ ┌─────┬─────┐ └─────┴─────┴─────┴─────┴─────┘ + * │ ← │ ↑ │ │ ↓ │ → │ + * ┌─────┼─────┼─────┤ ├─────┼─────┼─────┐ + * │ │ │ ─ │ │ ─ │ │ │ + * │ SPC │ RTN ├─────┤ ├─────┤ RTN │ SPC │ + * │ │ │ HYP │ │ MEH │ │ │ + * └─────┴─────┴─────┘ └─────┴─────┴─────┘ + */ +[BASE] = KEYMAP( + // left hand + KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, KC_EQL, + NEO_Y, NEO_X, NEO_V, NEO_L, NEO_C, NEO_W, KC_HOME, + NEO_L1_L, NEO_U, NEO_I, NEO_A, NEO_E, NEO_O, + KC_LSFT, NEO_UE, NEO_OE, NEO_AE, NEO_P, NEO_Z, KC_TRNS, + KC_LCTL, KC_LALT,MO(FMU),KC_LGUI,NEO_L2_L, + KC_LEFT, KC_UP, + KC_MINS, + KC_SPC, KC_ENT, ALL_T(KC_NO), + // right hand + DE_ACUT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_END, NEO_K, NEO_H, NEO_G, NEO_F, NEO_Q, NEO_SS, + NEO_S, NEO_N, NEO_R, NEO_T, NEO_D, NEO_L1_R, + KC_TRNS, NEO_B, NEO_M, KC_COMM,KC_DOT, NEO_J, KC_RSFT, + NEO_L2_R,KC_RGUI,MO(FMU),KC_RALT,KC_RCTL, + KC_DOWN, KC_RGHT, + KC_MINS, + MEH_T(KC_NO),KC_ENT,KC_SPC + ), +/* Layer 1 (F-keys, Mouse and Unicode) + * ┌───────┬─────┬─────┬─────┬─────┬─────┬─────┐ ┌─────┬─────┬─────┬─────┬─────┬─────┬───────┐ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├───────┼─────┼─────┼─────┼─────┼─────┼─────┤ ├─────┼─────┼─────┼─────┼─────┼─────┼───────┤ + * │ │ │ │ │ ✕ │ │ │ │ │ │ F9 │ F10 │ F11 │ F12 │ │ + * ├───────┼─────┼─────┼─────╆─────╅─────┤ │ │ ├─────╆─────╅─────┼─────┼─────┼───────┤ + * │ │ │ │ │ ✓ │ ├─────┤ ├─────┤ │ F5 │ F6 │ F7 │ F8 │ │ + * ├───────┼─────┼─────┼─────╄─────╃─────┤ │ │ ├─────╄─────╃─────┼─────┼─────┼───────┤ + * │ │ │ │ │ │ │ │ │ │ │ F1 │ F2 │ F3 │ F4 │ │ + * └─┬─────┼─────┼─────┼─────┼─────┼─────┴─────┘ └─────┴─────┼─────┼─────┼─────┼─────┼─────┬─┘ + * │ │ │(MO1)│ │ │ │ │ │(MO1)│ │ │ + * └─────┴─────┴─────┴─────┴─────┘ ┌─────┬─────┐ ┌─────┬─────┐ └─────┴─────┴─────┴─────┴─────┘ + * │ Ms← │ Ms↑ │ │ Ms↓ │ Ms→ │ + * ┌─────┼─────┼─────┤ ├─────┼─────┼─────┐ + * │ │ │ MLC │ │ MRC │ │ │ + * │ │ ├─────┤ ├─────┤ │ │ + * │ │ │ │ │ │ │ │ + * └─────┴─────┴─────┘ └─────┴─────┴─────┘ + */ +[FMU] = KEYMAP( + // left hand + KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,UC(0x2713),KC_TRNS,KC_TRNS, + KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,UC(0x2715),KC_TRNS, + KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_MS_L, KC_MS_U, + KC_BTN1, + KC_TRNS,KC_TRNS, KC_TRNS, + // right hand + KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS, KC_TRNS,KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, + KC_TRNS,KC_F5, KC_F6, KC_F7, KC_F8, KC_TRNS, + KC_TRNS, KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_MS_D, KC_MS_R, + KC_BTN2, + KC_TRNS, KC_TRNS,KC_TRNS + ), +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_TAP_TOGGLE(FMU) +}; + + +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: + if (record->event.pressed) { + register_code(KC_RSFT); + } + else { + unregister_code(KC_RSFT); + } + break; + } + + return MACRO_NONE; +}; + + +// Runs just one time when the keyboard initializes. +void * matrix_init_user(void) { +}; + + +// Runs constantly in the background, in a loop. +void * matrix_scan_user(void) +{ + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + case FMU: + ergodox_right_led_1_on(); + default: + ergodox_board_led_off(); + break; + } + +}; diff --git a/keyboard/ergodox_ez/keymaps/colemak/colemak.hex b/keyboard/ergodox_ez/keymaps/colemak/colemak.hex new file mode 100644 index 0000000000..cd3bf781af Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/colemak/colemak.hex differ diff --git a/keyboard/ergodox_ez/keymaps/colemak/keymap.c b/keyboard/ergodox_ez/keymaps/colemak/keymap.c new file mode 100644 index 0000000000..ee72c42635 --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/colemak/keymap.c @@ -0,0 +1,184 @@ +#include "ergodox_ez.h" +#include "debug.h" +#include "action_layer.h" + +#define BASE 0 // default layer +#define SYMB 1 // symbols +#define MDIA 2 // media keys + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Basic layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Del | Q | W | F | P | G | L1 | | L1 | J | L | U | Y | ; | \ | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | BkSp | A | R | S | T | D |------| |------| H | N | E | I |O / L2| ' | + * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| + * | LShift |Z/Ctrl| X | C | V | B | | | | K | M | , | . |//Ctrl| RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | App | LGui | | Alt |Ctrl/Esc| + * ,------|------|------| |------+--------+------. + * | | | Home | | PgUp | | | + * | Space|Backsp|------| |------| Tab |Enter | + * | |ace | End | | PgDn | | | + * `--------------------' `----------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* +[BASE] = KEYMAP( // layer 0 : default + // left hand + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, + KC_DELT, KC_Q, KC_W, KC_F, KC_P, KC_G, TG(SYMB), + KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, + KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), + LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT,KC_RGHT, + ALT_T(KC_APP), KC_LGUI, + KC_HOME, + KC_SPC,KC_BSPC,KC_END, + // right hand + KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + TG(SYMB), KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS, + KC_H, KC_N, KC_E, KC_I, LT(MDIA, KC_O), KC_QUOT, + MEH_T(KC_NO),KC_K, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, + KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1, + KC_LALT, CTL_T(KC_ESC), + KC_PGUP, + KC_PGDN,KC_TAB, KC_ENT + ), +/* Keymap 1: Symbol Layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | . | 0 | = | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// SYMBOLS +[SYMB] = KEYMAP( + // left hand + KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, + KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS, + KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV, + KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS, + // right hand + KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12, + KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS, + KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, + KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS +), +/* Keymap 2: Media and mouse keys + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | MsUp | | | | | | | | | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | | | | | | | Prev | Next | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | |Brwser| + * | | |------| |------| |Back | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// MEDIA AND MOUSE +[MDIA] = KEYMAP( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + // right hand + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, + KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, + KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_WBAK +), +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols) +}; + +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: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + +// Runs just one time when the keyboard initializes. +void * matrix_init_user(void) { + +}; + +// Runs constantly in the background, in a loop. +void * matrix_scan_user(void) { + + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + // TODO: Make this relevant to the ErgoDox EZ. + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + default: + // none + break; + } + +}; diff --git a/keyboard/ergodox_ez/keymaps/colemak/readme.md b/keyboard/ergodox_ez/keymaps/colemak/readme.md new file mode 100644 index 0000000000..e28b2f0856 --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/colemak/readme.md @@ -0,0 +1,4 @@ +# ErgoDox EZ Colemak Configuration + +Colemak layout with same layers as default ergodox ez keymap. + diff --git a/keyboard/ergodox_ez/keymaps/keymap_dave.hex b/keyboard/ergodox_ez/keymaps/dave/dave.hex similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_dave.hex rename to keyboard/ergodox_ez/keymaps/dave/dave.hex diff --git a/keyboard/ergodox_ez/keymaps/keymap_dave.c b/keyboard/ergodox_ez/keymaps/dave/keymap.c similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_dave.c rename to keyboard/ergodox_ez/keymaps/dave/keymap.c diff --git a/keyboard/ergodox_ez/keymaps/default/default.hex b/keyboard/ergodox_ez/keymaps/default/default.hex new file mode 100644 index 0000000000..eedabc2db5 Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/default/default.hex differ diff --git a/keyboard/ergodox_ez/keymaps/keymap_default.png b/keyboard/ergodox_ez/keymaps/default/default.png similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_default.png rename to keyboard/ergodox_ez/keymaps/default/default.png diff --git a/keyboard/ergodox_ez/keymaps/keymap_default_highres.png b/keyboard/ergodox_ez/keymaps/default/default_highres.png similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_default_highres.png rename to keyboard/ergodox_ez/keymaps/default/default_highres.png diff --git a/keyboard/ergodox_ez/keymaps/keymap_default.c b/keyboard/ergodox_ez/keymaps/default/keymap.c similarity index 99% rename from keyboard/ergodox_ez/keymaps/keymap_default.c rename to keyboard/ergodox_ez/keymaps/default/keymap.c index 762e118b05..b2f0a051d5 100644 --- a/keyboard/ergodox_ez/keymaps/keymap_default.c +++ b/keyboard/ergodox_ez/keymaps/default/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [BASE] = KEYMAP( // layer 0 : default // left hand KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, - KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(1), + KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT,KC_RGHT, @@ -42,7 +42,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_SPC,KC_BSPC,KC_END, // right hand KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, - TG(1), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),KC_QUOT, MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1, @@ -114,7 +114,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `--------------------' `--------------------' */ // MEDIA AND MOUSE -KEYMAP( +[MDIA] = KEYMAP( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, diff --git a/keyboard/ergodox_ez/keymaps/default/readme.md b/keyboard/ergodox_ez/keymaps/default/readme.md new file mode 100644 index 0000000000..a1a8ad44f8 --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/default/readme.md @@ -0,0 +1,5 @@ +# ErgoDox EZ Default Configuration + +This is what we ship with out of the factory. :) The image says it all: + +![Default](default_highres.png) diff --git a/keyboard/ergodox_ez/keymaps/keymap_default_osx.hex b/keyboard/ergodox_ez/keymaps/default_osx/default_osx.hex similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_default_osx.hex rename to keyboard/ergodox_ez/keymaps/default_osx/default_osx.hex diff --git a/keyboard/ergodox_ez/keymaps/keymap_default_osx_highres.png b/keyboard/ergodox_ez/keymaps/default_osx/default_osx_highres.png similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_default_osx_highres.png rename to keyboard/ergodox_ez/keymaps/default_osx/default_osx_highres.png diff --git a/keyboard/ergodox_ez/keymaps/keymap_default_osx.c b/keyboard/ergodox_ez/keymaps/default_osx/keymap.c similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_default_osx.c rename to keyboard/ergodox_ez/keymaps/default_osx/keymap.c diff --git a/keyboard/ergodox_ez/keymaps/default_osx/readme.md b/keyboard/ergodox_ez/keymaps/default_osx/readme.md new file mode 100644 index 0000000000..aa749aac90 --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/default_osx/readme.md @@ -0,0 +1,8 @@ +# The OSX Friendly Version of the Default Firmware + +So, I took the default firmware and just made a couple of tweaks that make it easier to use with OS X: + +1. The Cmd key is now on the right side, making Cmd+Space easier. +2. The media keys work on OSX (But not on Windows). + +![default osx](default_osx_highres.png) diff --git a/keyboard/ergodox_ez/keymaps/dragon788/dragon788.hex b/keyboard/ergodox_ez/keymaps/dragon788/dragon788.hex new file mode 100644 index 0000000000..36adaad1dc Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/dragon788/dragon788.hex differ diff --git a/keyboard/ergodox_ez/keymaps/dragon788/keymap.c b/keyboard/ergodox_ez/keymaps/dragon788/keymap.c new file mode 100644 index 0000000000..d18ce73bfe --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/dragon788/keymap.c @@ -0,0 +1,229 @@ +#include "ergodox_ez.h" +#include "debug.h" +#include "action_layer.h" + +#define BASE 0 // default layer +#define SYMB 1 // symbols +#define MDIA 2 // media keys +#define PLVR 3 // Plover layer + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Basic layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | = | 1 | 2 | 3 | 4 | 5 | LGui | |Plover| 6 | 7 | 8 | 9 | 0 | - | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Tab | Q | W | E | R | T | L1 | | L2 | Y | U | I | O | P | \ | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * |Esc/Ctrl| A | S | D | F | G |------| |------| H | J | K | L | ; | '"/Ctrl| + * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| + * | LShift | Z | X | C | V | B | | | | N | M | , | . | / | RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | ~L1 | Grv | '" | Left |Rgt/L2| | Up/L2| Down | [ | ] | ~L1 | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | App | Home | | PgUp |Ctrl/Esc| + * ,------|------|------| |------+--------+------. + * | | | End | | PgDn | | | + * |Backsp|Delete|------| |------| Enter |Space | + * | ace | | LAlt | |TabCtl| | | + * `--------------------' `----------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* +[BASE] = KEYMAP( // layer 0 : default + // left hand + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LGUI, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(1), + CTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), + KC_FN1, KC_GRV, KC_QUOT,KC_LEFT, LT(MDIA, KC_RGHT), + KC_APP, KC_HOME, + KC_END, + KC_BSPC,KC_DELT,KC_LALT, + // right hand + TG(3), KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + TG(2), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H, KC_J, KC_K, KC_L, KC_SCLN, CTL_T(KC_QUOT), + MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, + LT(MDIA, KC_UP), KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1, + KC_PGUP, CTL_T(KC_ESC), + KC_PGDN, + CTL_T(KC_TAB),KC_ENT, KC_SPC + ), +/* Keymap 1: Symbol Layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | . | 0 | = | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | Calc | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// SYMBOLS +[SYMB] = KEYMAP( + // left hand + KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, + KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS, + KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV, + KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS, + // right hand + KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12, + KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS, + KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, + KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS, + KC_TRNS, KC_CALC, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS +), +/* Keymap 2: Media and mouse keys + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | Rclk | Lclk | | | | | | Lclk | Rclk | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | |MsLeft| MsUp |MsDown|MsRght|------| |------|MsLeft|MsDown| MsUp |MsRght| | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | | | | | | | | | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | Lclk | Rclk | | | | | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | Prev | |VolUp | | + * ,------|------|------| |------+------+------. + * | | | Play | | Mute |Brwser|Brwser| + * | Lclk | Rclk |------| |------|Fwd |Back | + * | | | Next | |VolDn | | | + * `--------------------' `--------------------' + */ +// MEDIA AND MOUSE +KEYMAP( + RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN2, KC_BTN1, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_U, KC_MS_D, KC_MS_R, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_MPRV, + KC_MPLY, + KC_BTN1, KC_BTN2, KC_MNXT, + // right hand + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, KC_TRNS, KC_TRNS, KC_TRNS, + KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_VOLU, KC_TRNS, + KC_MUTE, + KC_VOLD, KC_WBAK, KC_WFWD +), + +/* Keymap 4: Steno for Plover from https://github.com/shayneholmes/tmk_keyboard/commit/11290f8489013018f778627db725160c745e75bd + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | q | w | e | r | t |------| |------| y | u | i | o | p | [ | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | a | s | d | f | g | | | | h | j | k | l | ; | ' | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | c | v |------| |------| n | m | + * | | | | | | | | + * `--------------------' `--------------------' + */ + +[PLVR] = KEYMAP( // layout: layer 4: Steno for Plover + // left hand + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_NO, KC_1, KC_2, KC_3, KC_4, KC_5, KC_NO, + KC_NO, KC_Q, KC_W, KC_E, KC_R, KC_T, + KC_NO, KC_A, KC_S, KC_D, KC_F, KC_G, KC_NO, + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_FN4, KC_NO, + KC_NO, + KC_C, KC_V, KC_NO, + // right hand + KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, + KC_NO, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS, + KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, + KC_NO, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_NO, KC_N, KC_M +), + +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols) +}; + +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: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + +// Runs just one time when the keyboard initializes. +void * matrix_init_user(void) { + +}; + +// Runs constantly in the background, in a loop. +void * matrix_scan_user(void) { + + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + // TODO: Make this relevant to the ErgoDox EZ. + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + default: + // none + break; + } + +}; diff --git a/keyboard/ergodox_ez/keymaps/dvorak/dvorak.hex b/keyboard/ergodox_ez/keymaps/dvorak/dvorak.hex new file mode 100644 index 0000000000..8e1ac3f21b Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/dvorak/dvorak.hex differ diff --git a/keyboard/ergodox_ez/keymaps/keymap_dvorak.png b/keyboard/ergodox_ez/keymaps/dvorak/dvorak.png similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_dvorak.png rename to keyboard/ergodox_ez/keymaps/dvorak/dvorak.png diff --git a/keyboard/ergodox_ez/keymaps/keymap_dvorak.c b/keyboard/ergodox_ez/keymaps/dvorak/keymap.c similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_dvorak.c rename to keyboard/ergodox_ez/keymaps/dvorak/keymap.c diff --git a/keyboard/ergodox_ez/keymaps/erez_experimental/erez_experimental.hex b/keyboard/ergodox_ez/keymaps/erez_experimental/erez_experimental.hex new file mode 100644 index 0000000000..d18d061b96 Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/erez_experimental/erez_experimental.hex differ diff --git a/keyboard/ergodox_ez/keymaps/erez_experimental/keymap.c b/keyboard/ergodox_ez/keymaps/erez_experimental/keymap.c new file mode 100644 index 0000000000..667078517c --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/erez_experimental/keymap.c @@ -0,0 +1,190 @@ +#include "ergodox_ez.h" +#include "debug.h" +#include "action_layer.h" + +#define BASE 0 // default layer +#define SYMB 1 // symbols +#define MDIA 2 // media keys + +/* About this file: This is just an experimental keymap for my own use, with some ideas I'm testing out. +* Changlog: +* Jan 19: * Made J into dual-action key (Alt when held down), to make Alt-tab more ergonomic. +* * Made ' into dual-action key (Win/Cmd when held down). +*/ + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Basic layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | BkSp | A | S | D | F | G |------| |------| H | Alt/J| K | L |; / L2| LGui/' | + * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| + * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | App | LGui | | Alt |Ctrl/Esc| + * ,------|------|------| |------+--------+------. + * | | | Home | | PgUp | | | + * | Space|Backsp|------| |------| Tab |Enter | + * | |ace | End | | PgDn | | | + * `--------------------' `----------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* +[BASE] = KEYMAP( // layer 0 : default + // left hand + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, + KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), + KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), + LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT,KC_RGHT, + ALT_T(KC_APP), KC_LGUI, + KC_HOME, + KC_SPC,KC_BSPC,KC_END, + // right hand + KC_RGHT, KC_6,KC_7, KC_8, KC_9, KC_0, KC_MINS, + TG(SYMB), KC_Y,KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H,ALT_T(KC_J),KC_K, KC_L, LT(MDIA,KC_SCLN),GUI_T(KC_QUOT), + MEH_T(KC_NO),KC_N,KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, + KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1, + KC_LALT, CTL_T(KC_ESC), + KC_PGUP, + KC_PGDN,KC_TAB, KC_ENT + ), +/* Keymap 1: Symbol Layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | . | 0 | = | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// SYMBOLS +[SYMB] = KEYMAP( + // left hand + KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, + KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS, + KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV, + KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS, + // right hand + KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12, + KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS, + KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, + KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS +), +/* Keymap 2: Media and mouse keys + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | MsUp | | | | | | | | | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | | | | | | | Prev | Next | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | |Brwser| + * | | |------| |------| |Back | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// MEDIA AND MOUSE +[MDIA] = KEYMAP( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + // right hand + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, + KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, + KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_WBAK +), +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols) +}; + +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: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + +// Runs just one time when the keyboard initializes. +void * matrix_init_user(void) { + +}; + +// Runs constantly in the background, in a loop. +void * matrix_scan_user(void) { + + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + // TODO: Make this relevant to the ErgoDox EZ. + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + default: + // none + break; + } + +}; diff --git a/keyboard/ergodox_ez/keymaps/erez_experimental/readme.md b/keyboard/ergodox_ez/keymaps/erez_experimental/readme.md new file mode 100644 index 0000000000..1ec3400696 --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/erez_experimental/readme.md @@ -0,0 +1,11 @@ +# Erez's experimental layout + +This is my personal layout which I use to test out ideas which may or may not make it onto the default layout we ship with. It's based off the default layout, with various tweaks. + +Changelog: + +## Jan 19, 2016: + +* Made J into dual-action key (Alt when held down), to make Alt-tab more ergonomic. +* Made ' into dual-action key (Win/Cmd when held down). + diff --git a/keyboard/ergodox_ez/keymaps/german/german.hex b/keyboard/ergodox_ez/keymaps/german/german.hex new file mode 100644 index 0000000000..a2f30d7cb6 Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/german/german.hex differ diff --git a/keyboard/ergodox_ez/keymaps/keymap_german.c b/keyboard/ergodox_ez/keymaps/german/keymap.c similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_german.c rename to keyboard/ergodox_ez/keymaps/german/keymap.c diff --git a/keyboard/ergodox_ez/keymaps/j3rn/j3rn.hex b/keyboard/ergodox_ez/keymaps/j3rn/j3rn.hex new file mode 100644 index 0000000000..61af86e722 Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/j3rn/j3rn.hex differ diff --git a/keyboard/ergodox_ez/keymaps/j3rn/keymap.c b/keyboard/ergodox_ez/keymaps/j3rn/keymap.c new file mode 100644 index 0000000000..ddc64e55e7 --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/j3rn/keymap.c @@ -0,0 +1,186 @@ +#include "ergodox_ez.h" +#include "debug.h" +#include "action_layer.h" + +#define BASE 0 // default layer +#define SYMB 1 // symbols +#define MDIA 2 // media keys + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Basic layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | Grv | 1 | 2 | 3 | 4 | 5 | [ | | ] | 6 | 7 | 8 | 9 | 0 | BkSp | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Tab | Q | W | E | R | T | - | | = | Y | U | I | O | P | \ | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * |Ctrl/Esc| A | S | D | F | G |------| |------| H | J | K | L |; / L2| ' | + * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| + * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | ~L1 | '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | App | Home | | PgUp |Ctrl/Esc| + * ,------|------|------| |------+--------+------. + * | | | End | | PgDn | | | + * |Space | LGui |------| |------| Tab |Enter | + * | | |Shift | | Alt | | | + * `--------------------' `----------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* +[BASE] = KEYMAP( // layer 0 : default + // left hand + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LBRC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_MINS, + CTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), + KC_FN1, KC_QUOT, LALT(KC_LSFT), KC_LEFT,KC_RGHT, + + ALT_T(KC_APP), KC_HOME, + KC_END, + KC_SPC, KC_LGUI, KC_LSHIFT, + // right hand + KC_RBRC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, + KC_EQL, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),KC_QUOT, + MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, + KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1, + + KC_PGUP, CTL_T(KC_ESC), + KC_PGDN, + KC_LALT, KC_TAB, KC_ENT + ), +/* Keymap 1: Symbol Layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | . | 0 | = | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// SYMBOLS +[SYMB] = KEYMAP( + // left hand + KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, + KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS, + KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV, + KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS, + // right hand + KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12, + KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS, + KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, + KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS +), +/* Keymap 2: Media and mouse keys + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | MsUp | | | | | | | | | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | | | | | | | Prev | Next | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | |Brwser| + * | | |------| |------| |Back | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// MEDIA AND MOUSE +KEYMAP( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + // right hand + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, + KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, + KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_WBAK +), +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols) +}; + +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: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + +// Runs just one time when the keyboard initializes. +void * matrix_init_user(void) { + +}; + +// Runs constantly in the background, in a loop. +void * matrix_scan_user(void) { + + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + // TODO: Make this relevant to the ErgoDox EZ. + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + default: + // none + break; + } + +}; diff --git a/keyboard/ergodox_ez/keymaps/j3rn/readme.md b/keyboard/ergodox_ez/keymaps/j3rn/readme.md new file mode 100644 index 0000000000..b0c4d267bd --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/j3rn/readme.md @@ -0,0 +1,28 @@ +# J3RN's Mac-centric Ergodox EZ keymap + +## Motivation + +Essentially, I wanted to switch to a layout that was less jarring than the default Ergodox EZ layout, and did not require finger gymnastics to perform common OS X shortcuts (most of which involve the CMD (LGui) key). + +## How is it different from the default Ergodox EZ layout? + +This layout more closely resembles that of the Mac keyboard, and has some other goodness baked in. Here is a rundown of what that means: + +### Mac-like changes + +- **The key to the left of "1" is "~" instead of "=".** +- **The key to the right of "0" is Backspace instead of "-"** (misleadingly labeled "delete" on the Mac's keyboard). There was no room to fit in "-" and "=" between "0" and Backspace, unfortunately. +- **The key to the left of "Q" is Tab instead of Delete.** +- **The rightmost big key on the left thumb is CMD (LGui) instead of Backspace.** + +### Other changes + +- **The button to the left of "A" is Ctrl/Esc instead of Backspace.** This is actually how I have the keyboard on my Macbook set up to be, since it's loads more convenient than a CAPS LOCK key. This is the Ctrl key I find myself using most. +- **The key to the right of "5" and the key to left of "6" are "[" and "]", respectively, instead of Left and Right.** There is a more convenient set of Left and Right already present. Truth be told, I don't really use these keys, as they are a stretch to reach. +- **The Toggle L1 keys have been replaced by the otherwise displaced "-" and "=".** They are laid out, left-to-right, in the same order as on the Mac keyboard. Honestly, they are not terribly conveniently placed, and their placement might change in a later version. I found that I did not toggle L1 frequently at all, and found using the momentary keys to access L1 to fit my workflow better. +- **The "~"/L1 key in the bottom-left is now just momentary L1.** The "~" key was moved to the top-left as mentioned before, and I like to keep my multi-use keys to a minimum due to the latency for them to switch from "press" to "hold." +- **The Home and End buttons have been shifted up on the left thumb, and Shift inserted below them.** This makes doing Shift-5 and other such combinations less painful. +- **The Page Up and Page Down buttons have been shifted up on the right thumb, and Alt was moved from above them to below them.** I use Alt more than Page Up or Page Down (mostly in terminal applications), and thought that it deserved a more accessible location. + + +**I'm always open to feedback and/or suggestions!** diff --git a/keyboard/ergodox_ez/keymaps/jack/jack.hex b/keyboard/ergodox_ez/keymaps/jack/jack.hex new file mode 100644 index 0000000000..5651572ab0 Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/jack/jack.hex differ diff --git a/keyboard/ergodox_ez/keymaps/keymap_jack.c b/keyboard/ergodox_ez/keymaps/jack/keymap.c similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_jack.c rename to keyboard/ergodox_ez/keymaps/jack/keymap.c diff --git a/keyboard/ergodox_ez/keymaps/jgarr/jgarr.hex b/keyboard/ergodox_ez/keymaps/jgarr/jgarr.hex new file mode 100644 index 0000000000..f87413b56d Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/jgarr/jgarr.hex differ diff --git a/keyboard/ergodox_ez/keymaps/keymap_jgarr.c b/keyboard/ergodox_ez/keymaps/jgarr/keymap.c similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_jgarr.c rename to keyboard/ergodox_ez/keymaps/jgarr/keymap.c diff --git a/keyboard/ergodox_ez/keymaps/kastyle/kastyle.hex b/keyboard/ergodox_ez/keymaps/kastyle/kastyle.hex new file mode 100644 index 0000000000..8c5409ac62 Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/kastyle/kastyle.hex differ diff --git a/keyboard/ergodox_ez/keymaps/keymap_kastyle.c b/keyboard/ergodox_ez/keymaps/kastyle/keymap.c similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_kastyle.c rename to keyboard/ergodox_ez/keymaps/kastyle/keymap.c diff --git a/keyboard/ergodox_ez/keymaps/keymap_default.hex b/keyboard/ergodox_ez/keymaps/keymap_default.hex deleted file mode 100644 index 72e7da00cc..0000000000 Binary files a/keyboard/ergodox_ez/keymaps/keymap_default.hex and /dev/null differ diff --git a/keyboard/ergodox_ez/keymaps/keymap_default_osx.png b/keyboard/ergodox_ez/keymaps/keymap_default_osx.png deleted file mode 100644 index f8f6eb9a72..0000000000 Binary files a/keyboard/ergodox_ez/keymaps/keymap_default_osx.png and /dev/null differ diff --git a/keyboard/ergodox_ez/keymaps/keymap_osx_de.hex b/keyboard/ergodox_ez/keymaps/keymap_osx_de.hex deleted file mode 100644 index b77029e69a..0000000000 Binary files a/keyboard/ergodox_ez/keymaps/keymap_osx_de.hex and /dev/null differ diff --git a/keyboard/ergodox_ez/keymaps/keymap_osx_de_highres.png b/keyboard/ergodox_ez/keymaps/keymap_osx_de_highres.png deleted file mode 100644 index c16436f2c3..0000000000 Binary files a/keyboard/ergodox_ez/keymaps/keymap_osx_de_highres.png and /dev/null differ diff --git a/keyboard/ergodox_ez/keymaps/kines-ish/keymap.c b/keyboard/ergodox_ez/keymaps/kines-ish/keymap.c new file mode 100644 index 0000000000..20cb53241f --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/kines-ish/keymap.c @@ -0,0 +1,184 @@ +#include "ergodox_ez.h" +#include "debug.h" +#include "action_layer.h" + +#define BASE 0 // default layer +#define SYMB 1 // symbols +#define MDIA 2 // media keys + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Basic layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Tab | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | Caps | A | S | D | F | G |------| |------| H | J | K | L | ; | ' | + * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| + * | LShift | Z | X | C | V | B | | | | N | M | , | . | / | RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | Esc | Grv |Insert| Left | Right| | Up | Down | [ | ] | L2 | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | Ctrl | Alt | | LGui | Ctrl | + * ,------|------|------| |------+------+------. + * | | | Home | | PgUp | | | + * |Backsp| Del |------| |------| Enter| Space| + * |ace | | End | | PgDn | | | + * `--------------------' `--------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* +[BASE] = KEYMAP( // layer 0 : default + // left hand + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), + KC_ESC, KC_GRV, KC_INS, KC_LEFT, KC_RGHT, + KC_LCTL,KC_LALT, + KC_HOME, + KC_BSPC,KC_DEL,KC_END, + // right hand + KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, + KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN2, + KC_LGUI, KC_RCTL, + KC_PGUP, + KC_PGDN, KC_ENT, KC_SPC + ), +/* Keymap 1: Symbol Layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | PrScr | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | ScrLk | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | Pause | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | . | 0 | = | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// SYMBOLS +[SYMB] = KEYMAP( + // left hand + KC_PSCR,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, + KC_SLCK,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS, + KC_PAUS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV, + KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS, + // right hand + KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12, + KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS, + KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, + KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS +), +/* Keymap 2: Media and mouse keys + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | MsUp | | | | | | | | | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | | | | | | | Prev | Next | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | |Brwser| + * | | |------| |------| |Back | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// MEDIA AND MOUSE +[MDIA] = KEYMAP( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + // right hand + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, + KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, + KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_WBAK +), +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols) +}; + +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: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + +// Runs just one time when the keyboard initializes. +void * matrix_init_user(void) { + +}; + +// Runs constantly in the background, in a loop. +void * matrix_scan_user(void) { + + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + // TODO: Make this relevant to the ErgoDox EZ. + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + default: + // none + break; + } + +}; diff --git a/keyboard/ergodox_ez/keymaps/kines-ish/kines-ish.hex b/keyboard/ergodox_ez/keymaps/kines-ish/kines-ish.hex new file mode 100644 index 0000000000..eea5130bde Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/kines-ish/kines-ish.hex differ diff --git a/keyboard/ergodox_ez/keymaps/kines-ish/readme.md b/keyboard/ergodox_ez/keymaps/kines-ish/readme.md new file mode 100644 index 0000000000..5d39a0590d --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/kines-ish/readme.md @@ -0,0 +1,19 @@ +This keymap attempts to match the Kinesis Contoured (aka Advantage) default +layout as closely as possible. See +http://www.kinesis-ergo.com/wp-content/uploads/2013/06/advantage_layout_win.pdf + +Apart from the obvious mappings, this keymap also: + +* removes the dual-purpose momentary layer/normal keys: Z, /, and Grv; + because the author--coming from a Kinesis keyboard--finds the delays and + accidental modifiers to be more disconcerting than helpful. + +* puts Esc in the bottom left since there's no place for it in the top + left to match the Kinesis. + +* changes the bottom-right key into an L2 toggle since there's otherwise no + way to get to L2. + +* adds PrScr, ScrLk and Pause to the L1 keymap, down the left side, since + they're present on the Kinesis but not available in the default + ergodox_ez keymap. diff --git a/keyboard/ergodox_ez/keymaps/osx_de/keymap.c b/keyboard/ergodox_ez/keymaps/osx_de/keymap.c new file mode 100644 index 0000000000..69acd9b951 --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/osx_de/keymap.c @@ -0,0 +1,299 @@ +#include "ergodox_ez.h" +#include "debug.h" +#include "action_layer.h" +#include "keymap_extras/keymap_german_osx.h" + +#define BASE 0 // default layer +#define SYMB 1 // symbols +#define MDIA 2 // media keys +#define CRSR 3 // media keys +#define NUMB 4 // number keys + +#define M_CTRL_CMDV 1 +#define M_CTRL_CMDC 2 +#define M_MEH_SH_ACUT 3 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Basic layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ESC | 1 | 2 | 3 | 4 | 5 |CMD-V | |CMD-C | 6 | 7 | 8 | 9 | 0 | ß | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | TAB | Q | W | E | R | T | CMD | | CMD | Z | U | I | O | P | ü | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | LALT | A | S | D | F | G |------| |------| H | J | K | L | ö | ä/RALT| + * |--------+------+------+------+------+------| LALT | | RALT |------+------+------+------+------+--------| + * | LShift |Y/Ctrl| X | C | V | B | | | | N | M | , | . |-/Ctrl| RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | ! | ? | | | | | \ | [ | ] | | | # | F12 | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | # | $ | \ | / | . |------| |------| / | ( | ) | { | } | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | ^ | % | | | ~ | | | | & | < | > | " | ' | ? | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | . | ! | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// SYMBOLS +[SYMB] = KEYMAP( + // left hand + KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, + KC_TRNS,DE_LESS,DE_MORE,DE_EXLM,DE_QST, KC_TRNS,KC_TRNS, + KC_TRNS,DE_HASH,DE_DLR, DE_BSLS,DE_SLSH,KC_DOT, + KC_TRNS,KC_TRNS,DE_LESS,DE_PERC,DE_PIPE,DE_TILD,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_DEL,KC_TRNS, + // right hand + KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_TRNS, LALT(LSFT(KC_7)), LALT(KC_5), LALT(KC_6), LALT(KC_7), DE_HASH, KC_F12, + DE_SLSH, DE_LPRN, DE_RPRN, LALT(KC_8), LALT(KC_9), KC_TRNS, + KC_TRNS, DE_AMPR, KC_GRV, LSFT(KC_GRV), DE_DQOT, DE_QUOT, DE_QST, + KC_TRNS,KC_DOT, KC_EXLM, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS +), +/* Keymap 2: Media and mouse keys + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | Mute | | | | | | Play | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | Lclk | MsUp | Rclk | WlUp | | | | | | | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | |MsLeft|MsDown|MsRght| WlDw |------| |------|VolUp | | | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | MClk | | | |VolDn | | Prev | Next | Up | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | Left | Down | Right | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | |Brwser| + * | | |------| |------| |Back | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// MEDIA AND MOUSE +KEYMAP( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_BTN1, KC_MS_U, KC_BTN2, KC_WH_U, KC_TRNS, + KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_D, + KC_TRNS, KC_TRNS, KC_WH_L, KC_WH_D, KC_WH_R, KC_BTN3, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + // right hand + KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_VOLU, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_VOLD, KC_TRNS, KC_MPRV, KC_MNXT, KC_UP, KC_TRNS, + KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_WBAK +), +// ADNW-KOY layer +/* Keymap 3: ADNW-Koy layer + * ADNW-Koy is a special layout designed to be ergonomic. Was created using software to determine the most ergonomic way to type German and English texts. + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | | | | | - | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | K | . | O | , | Y | | | | V | G | C | L | ß | Z | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | H | A | E | I | U |------| |------| D | T | R | N | S | F/L2 | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | |X/Ctrl| Q | Ä | Ü | Ö | | | | B | P | W | M |J/Ctrl| RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + case 1: + if (record->event.pressed) { + start = timer_read(); + return MACRO(D(LCTRL), END); + } else { + if (timer_elapsed(start) > 150) { + return MACRO(U(LCTRL), END); + } else { + return MACRO(U(LCTRL), D(LGUI), T(V), U(LGUI), END); + } + } + break; + case 2: + if (record->event.pressed) { + start = timer_read(); + return MACRO(D(LCTRL),END); + } else { + if (timer_elapsed(start) > 150){ + return MACRO(U(LCTRL),END); + } else { + return MACRO(U(LCTRL),D(LGUI),T(C),U(LGUI),END); + } + } + break; + case 3: + if (record->event.pressed) { + start = timer_read(); + return MACRO(D(LCTRL),D(LSFT),D(LALT),END); + } else { + if (timer_elapsed(start) > 150){ + return MACRO(U(LCTRL),U(LSFT),U(LALT),END); + } else { + return MACRO(U(LCTRL),U(LALT),T(EQL),U(LSFT),END); //cannot use DE_ACUT here, as macro needs KC_ prefix + } + } + break; + } + return MACRO_NONE; +}; + +// Runs just one time when the keyboard initializes. +void * matrix_init_user(void) { + +}; + +// Runs constantly in the background, in a loop. +void * matrix_scan_user(void) { + + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + // TODO: Make this relevant to the ErgoDox EZ. + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + case 3: + ergodox_right_led_3_on(); + break; + case 4: + ergodox_right_led_1_on(); + ergodox_right_led_3_on(); + //ergodox_board_led_on(); + break; + default: + // none + break; + } + +}; diff --git a/keyboard/ergodox_ez/keymaps/osx_de/osx_de.hex b/keyboard/ergodox_ez/keymaps/osx_de/osx_de.hex new file mode 100644 index 0000000000..2c83055b0d Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/osx_de/osx_de.hex differ diff --git a/keyboard/ergodox_ez/keymaps/osx_de/osx_de_highres.png b/keyboard/ergodox_ez/keymaps/osx_de/osx_de_highres.png new file mode 100644 index 0000000000..1d5226974f Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/osx_de/osx_de_highres.png differ diff --git a/keyboard/ergodox_ez/keymaps/keymap_osx_de_README.md b/keyboard/ergodox_ez/keymaps/osx_de/readme.md similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_osx_de_README.md rename to keyboard/ergodox_ez/keymaps/osx_de/readme.md diff --git a/keyboard/ergodox_ez/keymaps/keymap_osx_de.c b/keyboard/ergodox_ez/keymaps/osx_de_adnw_koy/keymap.c similarity index 78% rename from keyboard/ergodox_ez/keymaps/keymap_osx_de.c rename to keyboard/ergodox_ez/keymaps/osx_de_adnw_koy/keymap.c index 0a0ae75fcb..fb8635118b 100644 --- a/keyboard/ergodox_ez/keymaps/keymap_osx_de.c +++ b/keyboard/ergodox_ez/keymaps/osx_de_adnw_koy/keymap.c @@ -9,24 +9,28 @@ #define BASE 0 // default layer #define SYMB 1 // symbols #define MDIA 2 // media keys -#define CRSR 3 // media keys +#define ADNW 3 // media keys #define NUMB 4 // number keys const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -/* Keymap 0: Basic layer +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* + +/* Keymap 0: ADNW-Koy layer + * ADNW-Koy is a special layout designed to be ergonomic. Was created using software to determine the most ergonomic way to type German and English texts. * * ,--------------------------------------------------. ,--------------------------------------------------. - * | ESC | 1 | 2 | 3 | 4 | 5 |Lctrl | |Rctrl | 6 | 7 | 8 | 9 | 0 | ß | + * | ESC | 1 | 2 | 3 | 4 | 5 |Lctrl | |Rctrl | 6 | 7 | 8 | 9 | 0 | - | * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| - * | TAB | Q | W | E | R | T | CMD | | CMD | Z | U | I | O | P | ü | + * | TAB | K | . | O | , | Y | CMD | | CMD | V | G | C | L | ß | Z | * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| - * | L3 | A | S | D | F | G |------| |------| H | J | K | L | ö | ä/L2 | + * | ADNW | H | A | E | I | U |------| |------| D | T | R | N | S | F/L2 | * |--------+------+------+------+------+------| LALT | | RALT |------+------+------+------+------+--------| - * | LShift |Y/Ctrl| X | C | V | B | | | | N | M | , | . |-/Ctrl| RShift | + * | LShift |X/Ctrl| Q | Ä | Ü | Ö | | | | B | P | W | M |J/Ctrl| RShift | * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' - * |event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + +// Runs just one time when the keyboard initializes. +void * matrix_init_user(void) { + +}; + +// Runs constantly in the background, in a loop. +void * matrix_scan_user(void) { + + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + // TODO: Make this relevant to the ErgoDox EZ. + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + default: + // none + break; + } + +}; diff --git a/keyboard/ergodox_ez/keymaps/plover/plover.hex b/keyboard/ergodox_ez/keymaps/plover/plover.hex new file mode 100644 index 0000000000..53b0747d7e Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/plover/plover.hex differ diff --git a/keyboard/ergodox_ez/keymaps/keymap_software_neo2.c b/keyboard/ergodox_ez/keymaps/software_neo2/keymap.c similarity index 100% rename from keyboard/ergodox_ez/keymaps/keymap_software_neo2.c rename to keyboard/ergodox_ez/keymaps/software_neo2/keymap.c diff --git a/keyboard/ergodox_ez/keymaps/software_neo2/software_neo2.hex b/keyboard/ergodox_ez/keymaps/software_neo2/software_neo2.hex new file mode 100644 index 0000000000..8cf730c8f4 Binary files /dev/null and b/keyboard/ergodox_ez/keymaps/software_neo2/software_neo2.hex differ diff --git a/keyboard/ergodox_ez/keymaps/tm2030/README.md b/keyboard/ergodox_ez/keymaps/tm2030/README.md new file mode 100644 index 0000000000..096939dc28 --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/tm2030/README.md @@ -0,0 +1,136 @@ +# TypeMatrix™ 2030 inspired layout + +This is a [TypeMatrix™ 2030](http://typematrix.com/2030/features.php) inspired layout for the ErgoDox EZ. The _TypeMatrix_ is a nice small ergonomic keyboard with a matrix layout, and it provides several nice features like `enter`, `backspace` and `delete` at the center, bigger `shift` keys and international `cut`, `copy` and `paste` keys. + +The idea in this ErgoDox layout is to make it is as close as possible to the TM2030, such that it would be easy to switch between the TM and the ErgoDox. No _fancy_ features have been implemented, as this is intended to be a base for further customization if desired. Some keys have been duplicated in order to accomodate for most people. + +Most of the TM2030 features are supported except +* automatic window switching (alt-tab key, at the left of the space key) +* show desktop key (at the right of the space key) +* 102/106 modes + +Dvorak mode is even supported by pressing [`Magic`](/TMK_README.md#magic-commands)+`1` (`Magic` is by default `LShift`+`RShift`) + +Some keys had to be moved around to fit into the ErgoDox, especially the `F1`-`F12` keys and the arrow keys. + +## Base Layer +This is the default layer, close to the TM with the following differences: + + - Top row (with the `F`-keys) and rightmost column (with application shortcuts) are removed, the corresponding keys are displaced elsewhere. + - Bottom-left keys are reorganized on a single row as: `Ctrl`, `fn`, `Gui`, `Play`, `App`/`Alt`. + - `shuffle` and `desktop` are not supported. + - `right-shift` is moved on `'`, `\` and on the right thumb (the latter is actually the only _true_ `right-shift`, and must be used in the `Magic` key combination). + - `right-ctrl` is moved on `End`. + - `]` is moved in place of the dash (`-`). + - Dash (`-`) and `=` are moved on bottom right row. + - Arrows and `PgUp`/`PgDn` are moved on the thumbs. + +``` +,--------------------------------------------------. ,--------------------------------------------------. +| ` | 1 | 2 | 3 | 4 | 5 | Del | | Del | 6 | 7 | 8 | 9 | 0 | ] | +|--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| +| Tab | Q | W | E | R | T |Backsp| |Backsp| Y | U | I | O | P | [ | +|--------+------+------+------+------+------|ace | |ace |------+------+------+------+------+--------| +| LShift | A | S | D | F | G |------| |------| H | J | K | L | ; | '/Shift| +|--------+------+------+------+------+------|Enter | |Enter |------+------+------+------+------+--------| +| LShift | Z | X | C | V | B | | | | N | M | , | . | / | \/Shift| +`--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + |LCtrl | fn | LGui | Play |App/Alt| | RAlt | - | Home | = |End/Ctl| + `-----------------------------------' `-----------------------------------' + ,--------------. ,-------------. + |Esc/Alt| num | | Left |Right | + ,------+-------+------| |------+------+------. + | | | PgUp | | Up | | | + |Space |LShift |------| |------|RShift|Space | + | | | PgDn | | Down | | | + `---------------------' `--------------------' +``` + +### Layer Switching +- Use `num` to toggle the Numeric Layer. +- Hold `fn` to temporarily activate the Numeric & Fn Layers. + +As on the original TM 2030, when `num` layer is activated, holding `fn` disables it but enables the other `fn` keys. + +## Dvorak Layer +Same as Layer 0 but with _Dvorak_ layout, to use with QWERTY OS layout. + +Enable Dvorak layout with [`Magic`](/TMK_README.md#magic-commands+`1` (`LShift`+`RShift`+`1`), disable with `Magic`-`0`. + +The middle (green) led indicates when the Dvorak layer is activated. + + ,--------------------------------------------------. ,--------------------------------------------------. + | ` | 1 | 2 | 3 | 4 | 5 | Del | | Del | 6 | 7 | 8 | 9 | 0 | = | + |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + | Tab | ' | , | . | P | Y |Backsp| |Backsp| F | G | C | R | L | / | + |--------+------+------+------+------+------|ace | |ace |------+------+------+------+------+--------| + | LShift | A | O | E | U | I |------| |------| D | H | T | N | S | -/Shift| + |--------+------+------+------+------+------|Enter | |Enter |------+------+------+------+------+--------| + | LShift | ; | Q | J | K | X | | | | B | M | W | V | Z | \/Shift| + `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + |LCtrl | fn | LGui | Play |App/Alt| | RAlt | [ | Home | ] |End/Ctl| + `-----------------------------------' `-----------------------------------' + ,--------------. ,-------------. + |Esc/Alt| num | | Left |Right | + ,------+-------+------| |------+------+------. + | | | PgUp | | Up | | | + |Space |LShift |------| |------|RShift|Space | + | | | PgDn | | Down | | | + `---------------------' `--------------------' + +## Numeric Layer +Numeric layer close to the TM when toggling `num`, with the following differences: + +- Numpad is displaced by 1 to the top left. +- Arrows are displaced by 1 to the left. +- Provides access to `F1`-`F12`, `caps-lock` and `num-lock`. + +The numeric layer is indicated with the left (red) led. Caps-lock is indicated with the right (blue) led. + + ,--------------------------------------------------. ,--------------------------------------------------. + | | F1 | F2 | F3 | F4 | F5 | | | | | | Tab | / | * | - | + |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + | | F6 | F7 | F8 | F9 | F10 | | | | | Home | 7 | 8 | 9 | + | + |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + | | F11 | F12 | | | |------| |------| Up | End | 4 | 5 | 6 | + | + |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + | | | | | | | | | Left | Down | Right| 1 | 2 | 3 |KpEnter | + `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + | | | | | | | | 0 | 00 | . |Etr/Ctl| + `----------------------------------' `-----------------------------------' + ,-------------. ,-------------. + | | | |n.lock|c.lock| + ,------|------|------| |------+------+------. + | | | | | | | | + | | |------| |------| | | + | | | | | | | | + `--------------------' `--------------------' + +## Fn Layer +Activated simultaneously with the Numeric layer when holding the `fn` key. As on the TM, it provides access to the following features: +- `cut`, `copy` and `paste` +- `volume up`, `volume down` and `mute` — as opposed to the TM, these are only on left hand +- `previous track` and `next track` +- `calculator`, `mail` and `browser home` +- `insert`, `power`, `sleep`, `wake`, `print screen`, `scroll-lock` and `pause` + +Note: the `eject` key does not work due to jackhumbert/qmk_firmware#82 + + ,--------------------------------------------------. ,--------------------------------------------------. + | | | | | | |Insert| |Insert|Eject |Power |Sleep | Wake |PrtScr|ScrollLk| + |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + | | | | | | |VolUp | | | | | | | | Pause | + |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + | | | | Calc | Mail |Browsr|------| |------| | | | | | | + |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + | | | cut | copy |paste | Mute |VolDn | | | | | | | | | + `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + | | | | | | | | | | | | + `----------------------------------' `----------------------------------' + ,-------------. ,-------------. + | | | | | | + ,------|------|------| |------+------+------. + | | | | | Next | | | + | Mute | |------| |------| | | + | | | | | Prev | | | + `--------------------' `--------------------' diff --git a/keyboard/ergodox_ez/keymaps/tm2030/keymap.c b/keyboard/ergodox_ez/keymaps/tm2030/keymap.c new file mode 100644 index 0000000000..cbdf0ae00e --- /dev/null +++ b/keyboard/ergodox_ez/keymaps/tm2030/keymap.c @@ -0,0 +1,258 @@ +/* TypeMatrix-2030-like keymap */ +#include "ergodox_ez.h" +#include "debug.h" +#include "action_layer.h" +#include "led.h" + +#define BASE 0 // default layer +#define DVRK 1 // Dvorak layer +#define NUMR 8 // numeric layer +#define FNLR 9 // fn layer + +#define MDBL0 1 +#define MFNLR 2 +#define MCUT 3 +#define MCOPY 4 +#define MPSTE 5 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Basic layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | Del | | Del | 6 | 7 | 8 | 9 | 0 | ] | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Tab | Q | W | E | R | T |Backsp| |Backsp| Y | U | I | O | P | [ | + * |--------+------+------+------+------+------|ace | |ace |------+------+------+------+------+--------| + * | LShift | A | S | D | F | G |------| |------| H | J | K | L | ; | '/Shift| + * |--------+------+------+------+------+------|Enter | |Enter |------+------+------+------+------+--------| + * | LShift | Z | X | C | V | B | | | | N | M | , | . | / | \/Shift| + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |LCtrl | fn | LGui | Play |App/Alt| | RAlt | - | Home | = |End/Ctl| + * `-----------------------------------' `-----------------------------------' + * ,--------------. ,-------------. + * |Esc/Alt| num | | Left |Right | + * ,------+-------+------| |------+------+------. + * | | | PgUp | | Up | | | + * |Space |LShift |------| |------|RShift|Space | + * | | | PgDn | | Down | | | + * `---------------------' `--------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* +[BASE] = KEYMAP( // layer 0 : default + // left hand + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_DELT, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_BSPC, + KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_ENT, + KC_LCTL, M(MFNLR), KC_LGUI,KC_MPLY,ALT_T(KC_APP), + + ALT_T(KC_ESC), TG(NUMR), + KC_PGUP, + KC_SPC, KC_LSFT, KC_PGDN, + + // right hand + KC_DELT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_RBRC, + KC_BSPC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, + KC_H, KC_J, KC_K, KC_L, KC_SCLN, SFT_T(KC_QUOT), + KC_ENT, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_T(KC_BSLS), + KC_RALT, KC_MINS, KC_HOME, KC_EQL, CTL_T(KC_END), + + KC_LEFT, KC_RGHT, + KC_UP, + KC_DOWN, KC_RSFT, KC_SPC + ), +/* Dvorak layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | Del | | Del | 6 | 7 | 8 | 9 | 0 | = | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Tab | ' | , | . | P | Y |Backsp| |Backsp| F | G | C | R | L | / | + * |--------+------+------+------+------+------|ace | |ace |------+------+------+------+------+--------| + * | LShift | A | O | E | U | I |------| |------| D | H | T | N | S | -/Shift| + * |--------+------+------+------+------+------|Enter | |Enter |------+------+------+------+------+--------| + * | LShift | ; | Q | J | K | X | | | | B | M | W | V | Z | \/Shift| + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |LCtrl | fn | LGui | Play |App/Alt| | RAlt | [ | Home | ] |End/Ctl| + * `-----------------------------------' `-----------------------------------' + * ,--------------. ,-------------. + * |Esc/Alt| num | | Left |Right | + * ,------+-------+------| |------+------+------. + * | | | PgUp | | Up | | | + * |Space |LShift |------| |------|RShift|Space | + * | | | PgDn | | Down | | | + * `---------------------' `--------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* +[DVRK] = KEYMAP( // layer 0 : default + // left hand + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_DELT, + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_BSPC, + KC_LSFT, KC_A, KC_O, KC_E, KC_U, KC_I, + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_ENT, + KC_LCTL, M(MFNLR), KC_LGUI, KC_MPLY, ALT_T(KC_APP), + + ALT_T(KC_ESC), TG(NUMR), + KC_PGUP, + KC_SPC, KC_LSFT, KC_PGDN, + + // right hand + KC_DELT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_EQL, + KC_BSPC, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, + KC_D, KC_H, KC_T, KC_N, KC_S, SFT_T(KC_MINS), + KC_ENT, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_T(KC_BSLS), + KC_RALT, KC_LBRC, KC_HOME, KC_RBRC, CTL_T(KC_END), + + KC_LEFT, KC_RGHT, + KC_UP, + KC_DOWN, KC_RSFT, KC_SPC + ), +/* Numeric Layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | F1 | F2 | F3 | F4 | F5 | | | | | | Tab | / | * | - | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | F6 | F7 | F8 | F9 | F10 | | | | | Home | 7 | 8 | 9 | + | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | F11 | F12 | | | |------| |------| Up | End | 4 | 5 | 6 | + | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | | | | Left | Down | Right| 1 | 2 | 3 |KpEnter | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | 0 | 00 | . |Etr/Ctl| + * `----------------------------------' `-----------------------------------' + * ,-------------. ,-------------. + * | | | |n.lock|c.lock| + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// SYMBOLS +[NUMR] = KEYMAP( + // left hand + KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, + KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS, + 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,KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS,KC_TRNS, + // right hand + KC_INS, KC_F6, KC_F7, KC_TAB, KC_PSLS, KC_PAST, KC_PMNS, + KC_TRNS, KC_TRNS, KC_HOME, KC_P7, KC_P8, KC_P9, KC_PPLS, + KC_UP, KC_END, KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_LEFT, KC_DOWN, KC_RGHT, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_TRNS, KC_P0, M(MDBL0),KC_PDOT, CTL_T(KC_PENT), + + KC_NLCK, KC_CAPS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS +), +/* fn layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | |Insert| |Insert|Eject |Power |Sleep | Wake |PrtScr|ScrollLk| + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | | | |VolUp | | | | | | | | Pause | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | Calc | Mail |Browsr|------| |------| | | | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | cut | copy |paste | Mute |VolDn | | | | | | | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | Next | | | + * | Mute | |------| |------| | | + * | | | | | Prev | | | + * `--------------------' `--------------------' + */ +// MEDIA AND MOUSE +[FNLR] = KEYMAP( + 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_VOLU, + KC_TRNS, KC_TRNS, KC_TRNS, KC_CALC, KC_MAIL, KC_WHOM, + KC_TRNS, KC_TRNS, M(MCUT), M(MCOPY), M(MPSTE), KC_MUTE, KC_VOLD, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_MUTE, KC_TRNS, KC_TRNS, + // right hand + KC_INS, KC_EJCT, KC_PWR, KC_SLEP, KC_WAKE, KC_PSCR, KC_SLCK, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PAUS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + + KC_TRNS, KC_TRNS, + KC_MPRV, + KC_MNXT, KC_TRNS, KC_TRNS +), +}; + +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 MDBL0: + if (record->event.pressed) { + return MACRO( I(25), T(P0), T(P0), END ); + } + break; + case MFNLR: + layer_state ^= (1 << NUMR) | (1 << FNLR); + break; + case MCUT: + if (record->event.pressed) { + return MACRO(D(LSFT), T(DELT), U(LSFT), END); + } + break; + case MCOPY: + if (record->event.pressed) { + return MACRO(D(LCTL), T(INS), U(LCTL), END); + } + break; + case MPSTE: + if (record->event.pressed) { + return MACRO(D(LSFT), T(INS), U(LSFT), END); + } + break; + } + return MACRO_NONE; +}; + +// Runs just one time when the keyboard initializes. +void * matrix_init_user(void) { + +}; + +// Runs constantly in the background, in a loop. +void * matrix_scan_user(void) { + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + // led 1: numeric layer + if (layer_state & (1 << NUMR)) { + ergodox_right_led_1_on(); + } + // led 2: Dvorak layer + if (default_layer_state == 1 << DVRK) { + ergodox_right_led_2_on(); + } + // led 3: caps lock + if (host_keyboard_leds() & (1<event.pressed` (see keymap_default.c). + +```c +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // this is the function signature -- just copy/paste it into your keymap file as it is. +{ + switch(id) { + case 0: // this would trigger when you hit a key mapped as M(0) + if (record->event.pressed) { + return MACRO( I(255), T(H), T(E), T(L), T(L), W(255), T(O), END ); // this sends the string 'hello' when the macro executes + } + break; + } + return MACRO_NONE; +}; +``` +A macro can include the following commands: + +* I() change interval of stroke in milliseconds. +* D() press key. +* U() release key. +* T() type key(press and release). +* W() wait (milliseconds). +* END end mark. + +So above you can see the stroke interval changed to 255ms between each keystroke, then a bunch of keys being typed, waits a while, then the macro ends. + +Note: Using macros to have your keyboard send passwords for you is a bad idea. + +### Additional keycode aliases for software-implemented layouts (Colemak, Dvorak, etc) + +Everything is assuming you're in Qwerty (in software) by default, but there is built-in support for using a Colemak or Dvorak layout by including this at the top of your keymap: + + #include "keymap_.h" + +Where is "colemak" or "dvorak". After including this line, you will get access to: + + * `CM_*` for all of the Colemak-equivalent characters + * `DV_*` for all of the Dvorak-equivalent characters + +These implementations assume you're using Colemak or Dvorak on your OS, not on your keyboard - this is referred to as a software-implemented layout. If your computer is in Qwerty and your keymap is in Colemak or Dvorak, this is referred to as a firmware-implemented layout, and you won't need these features. + +To give an example, if you're using software-implemented Colemak, and want to get an `F`, you would use `CM_F` - `KC_F` under these same circumstances would result in `T`. + +## Additional language support + +In `quantum/keymap_extras/`, you'll see various language files - these work the same way as the alternative layout ones do. Most are defined by their two letter country/language code followed by an underscore and a 4-letter abbreviation of its name. `FR_UGRV` which will result in a `ù` when using a software-implemented AZERTY layout. It's currently difficult to send such characters in just the firmware (but it's being worked on - see Unicode support). + +## Unicode support + +You can currently send 4 hex digits with your OS-specific modifier key (RALT for OSX with the "Unicode Hex Input" layout) - this is currently limited to supporting one OS at a time, and requires a recompile for switching. 8 digit hex codes are being worked on. The keycode function is `UC(n)`, where *n* is a 4 digit hexidecimal. Enable from the Makefile. + +## Other firmware shortcut keycodes + +* `RESET` - puts the MCU in DFU mode for flashing new firmware (with `make dfu`) +* `DEBUG` - the firmware into debug mode - you'll need hid_listen to see things +* `BL_ON` - turns the backlight on +* `BL_OFF` - turns the backlight off +* `BL_` - sets the backlight to level *n* +* `BL_INC` - increments the backlight level by one +* `BL_DEC` - decrements the backlight level by one +* `BL_TOGG` - toggles the backlight +* `BL_STEP` - steps through the backlight levels + +Enable the backlight from the Makefile. + +## MIDI functionalty + +This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happening. Enable from the Makefile. + +## Bluetooth functionality + +This requires [some hardware changes](https://www.reddit.com/r/MechanicalKeyboards/comments/3psx0q/the_planck_keyboard_with_bluetooth_guide_and/?ref=search_posts), but can be enabled via the Makefile. The firmware will still output characters via USB, so be aware of this when charging via a computer. It would make sense to have a switch on the Bluefruit to turn it off at will. + +## Building + +Download or clone the whole firmware and navigate to the keyboard/planck folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use `make dfu` to program your PCB once you hit the reset button. + +Depending on which keymap you would like to use, you will have to compile slightly differently. + +### Default +To build with the default keymap, simply run `make`. + +### Other Keymaps +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_.c` and see keymap document (you can find in top README.md) and existent keymap files. + +To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like: +``` +$ make KEYMAP=[default|jack|] +``` +Keymaps follow the format **__keymap\_\.c__** and are stored in the `keymaps` folder. diff --git a/keyboard/hhkb_qmk/config.h b/keyboard/hhkb_qmk/config.h new file mode 100644 index 0000000000..ee66e44571 --- /dev/null +++ b/keyboard/hhkb_qmk/config.h @@ -0,0 +1,71 @@ +/* +Copyright 2012 Jun Wako + +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 . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0xCAFE +#define DEVICE_VER 0x0104 +#define MANUFACTURER q.m.k +#define PRODUCT HHKB mod +#define DESCRIPTION q.m.k keyboard firmware for HHKB + +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 8 + +#define TAPPING_TERM 200 + +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 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)) \ +) + +/* + * 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 diff --git a/keyboard/hhkb_qmk/hhkb_avr.h b/keyboard/hhkb_qmk/hhkb_avr.h new file mode 100644 index 0000000000..7ea6322c73 --- /dev/null +++ b/keyboard/hhkb_qmk/hhkb_avr.h @@ -0,0 +1,167 @@ +#ifndef HHKB_AVR_H +#define HHKB_AVR_H + +#include +#include +#include +#include +#include + + +// Timer resolution check +#if (1000000/TIMER_RAW_FREQ > 20) +# error "Timer resolution(>20us) is not enough for HHKB matrix scan tweak on V-USB." +#endif + + +/* + * HHKB Matrix I/O + * + * row: HC4051[A,B,C] selects scan row0-7 + * row-ext: [En0,En1] row extention for JP + * col: LS145[A,B,C,D] selects scan col0-7 and enable(D) + * key: on: 0/off: 1 + * prev: hysteresis control: assert(1) when previous key state is on + */ + + +#if defined(__AVR_ATmega32U4__) +/* + * For TMK HHKB alt controller(ATMega32U4) + * + * row: PB0-2 + * col: PB3-5,6 + * key: PD7(pull-uped) + * prev: PB7 + * power: PD4(L:off/H:on) + * row-ext: PC6,7 for HHKB JP(active low) + */ +static inline void KEY_ENABLE(void) { (PORTB &= ~(1<<6)); } +static inline void KEY_UNABLE(void) { (PORTB |= (1<<6)); } +static inline bool KEY_STATE(void) { return (PIND & (1<<7)); } +static inline void KEY_PREV_ON(void) { (PORTB |= (1<<7)); } +static inline void KEY_PREV_OFF(void) { (PORTB &= ~(1<<7)); } +#ifdef HHKB_POWER_SAVING +static inline void KEY_POWER_ON(void) { + DDRB = 0xFF; PORTB = 0x40; // change pins output + DDRD |= (1<<4); PORTD |= (1<<4); // MOS FET switch on + /* Without this wait you will miss or get false key events. */ + _delay_ms(5); // wait for powering up +} +static inline void KEY_POWER_OFF(void) { + /* input with pull-up consumes less than without it when pin is open. */ + DDRB = 0x00; PORTB = 0xFF; // change pins input with pull-up + DDRD |= (1<<4); PORTD &= ~(1<<4); // MOS FET switch off +} +static inline bool KEY_POWER_STATE(void) { return PORTD & (1<<4); } +#else +static inline void KEY_POWER_ON(void) {} +static inline void KEY_POWER_OFF(void) {} +static inline bool KEY_POWER_STATE(void) { return true; } +#endif +static inline void KEY_INIT(void) +{ + /* row,col,prev: output */ + DDRB = 0xFF; + PORTB = 0x40; // unable + /* key: input with pull-up */ + DDRD &= ~0x80; + PORTD |= 0x80; +#ifdef HHKB_JP + /* row extention for HHKB JP */ + DDRC |= (1<<6|1<<7); + PORTC |= (1<<6|1<<7); +#endif + KEY_UNABLE(); + KEY_PREV_OFF(); + + KEY_POWER_OFF(); +} +static inline void KEY_SELECT(uint8_t ROW, uint8_t COL) +{ + PORTB = (PORTB & 0xC0) | (((COL) & 0x07)<<3) | ((ROW) & 0x07); +#ifdef HHKB_JP + if ((ROW) & 0x08) PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<6); + else PORTC = (PORTC & ~(1<<6|1<<7)) | (1<<7); +#endif +} + + +#elif defined(__AVR_AT90USB1286__) +/* + * For Teensy++(AT90USB1286) + * + * HHKB pro HHKB pro2 + * row: PB0-2 (6-8) (5-7) + * col: PB3-5,6 (9-12) (8-11) + * key: PE6(pull-uped) (4) (3) + * prev: PE7 (5) (4) + * + * TODO: convert into 'staitc inline' function + */ +#define KEY_INIT() do { \ + DDRB |= 0x7F; \ + DDRE |= (1<<7); \ + DDRE &= ~(1<<6); \ + PORTE |= (1<<6); \ +} while (0) +#define KEY_SELECT(ROW, COL) (PORTB = (PORTB & 0xC0) | \ + (((COL) & 0x07)<<3) | \ + ((ROW) & 0x07)) +#define KEY_ENABLE() (PORTB &= ~(1<<6)) +#define KEY_UNABLE() (PORTB |= (1<<6)) +#define KEY_STATE() (PINE & (1<<6)) +#define KEY_PREV_ON() (PORTE |= (1<<7)) +#define KEY_PREV_OFF() (PORTE &= ~(1<<7)) +#define KEY_POWER_ON() +#define KEY_POWER_OFF() +#define KEY_POWER_STATE() true + + +#else +# error "define code for matrix scan" +#endif + + +#if 0 +// For ATMega328P with V-USB +// +// #elif defined(__AVR_ATmega328P__) +// Ports for V-USB +// key: PB0(pull-uped) +// prev: PB1 +// row: PB2-4 +// col: PC0-2,3 +// power: PB5(Low:on/Hi-z:off) +#define KEY_INIT() do { \ + DDRB |= 0x3E; \ + DDRB &= ~(1<<0); \ + PORTB |= 1<<0; \ + DDRC |= 0x0F; \ + KEY_UNABLE(); \ + KEY_PREV_OFF(); \ +} while (0) +#define KEY_SELECT(ROW, COL) do { \ + PORTB = (PORTB & 0xE3) | ((ROW) & 0x07)<<2; \ + PORTC = (PORTC & 0xF8) | ((COL) & 0x07); \ +} while (0) +#define KEY_ENABLE() (PORTC &= ~(1<<3)) +#define KEY_UNABLE() (PORTC |= (1<<3)) +#define KEY_STATE() (PINB & (1<<0)) +#define KEY_PREV_ON() (PORTB |= (1<<1)) +#define KEY_PREV_OFF() (PORTB &= ~(1<<1)) +// Power supply switching +#define KEY_POWER_ON() do { \ + KEY_INIT(); \ + PORTB &= ~(1<<5); \ + _delay_ms(1); \ +} while (0) +#define KEY_POWER_OFF() do { \ + DDRB &= ~0x3F; \ + PORTB &= ~0x3F; \ + DDRC &= ~0x0F; \ + PORTC &= ~0x0F; \ +} while (0) +#endif + +#endif diff --git a/keyboard/hhkb_qmk/hhkb_qmk.c b/keyboard/hhkb_qmk/hhkb_qmk.c new file mode 100644 index 0000000000..9c90e6eb44 --- /dev/null +++ b/keyboard/hhkb_qmk/hhkb_qmk.c @@ -0,0 +1,29 @@ +#include "hhkb_qmk.h" + +__attribute__ ((weak)) +void * matrix_init_user(void) { + // leave these blank +}; + +__attribute__ ((weak)) +void * matrix_scan_user(void) { + // leave these blank +}; + +void * matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + if (matrix_init_user) { + (*matrix_init_user)(); + } +}; + +void * matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + + if (matrix_scan_user) { + (*matrix_scan_user)(); + } +}; diff --git a/keyboard/hhkb_qmk/hhkb_qmk.h b/keyboard/hhkb_qmk/hhkb_qmk.h new file mode 100644 index 0000000000..f6bf20f43b --- /dev/null +++ b/keyboard/hhkb_qmk/hhkb_qmk.h @@ -0,0 +1,30 @@ +#ifndef HHKB_QMK_H +#define HHKB_QMK_H + +#include "matrix.h" +#include "keymap_common.h" +//#include "backlight.h" +#include + +#define KEYMAP( \ + K31, K30, K00, K10, K11, K20, K21, K40, K41, K60, K61, K70, K71, K50, K51, \ + K32, K01, K02, K13, K12, K23, K22, K42, K43, K62, K63, K73, K72, K52, \ + K33, K04, K03, K14, K15, K24, K25, K45, K44, K65, K64, K74, K53, \ + K34, K05, K06, K07, K16, K17, K26, K46, K66, K76, K75, K55, K54, \ + K35, K36, K37, K57, K56) \ + \ +{ \ + { K00, K01, K02, K03, K04, K05, K06, K07 }, \ + { K10, K11, K12, K13, K14, K15, K16, K17 }, \ + { K20, K21, K22, K23, K24, K25, K26, KC_NO }, \ + { K30, K31, K32, K33, K34, K35, K36, K37 }, \ + { K40, K41, K42, K43, K44, K45, K46, KC_NO }, \ + { K50, K51, K52, K53, K54, K55, K56, K57 }, \ + { K60, K61, K62, K63, K64, K65, K66, KC_NO }, \ + { K70, K71, K72, K73, K74, K75, K76, KC_NO } \ +} + +void * matrix_init_user(void); +void * matrix_scan_user(void); + +#endif diff --git a/keyboard/hhkb_qmk/keymaps/keymap_default.c b/keyboard/hhkb_qmk/keymaps/keymap_default.c new file mode 100644 index 0000000000..bcd8ead377 --- /dev/null +++ b/keyboard/hhkb_qmk/keymaps/keymap_default.c @@ -0,0 +1,78 @@ +/* -*- eval: (turn-on-orgtbl); -*- + * default HHKB Layout + */ +#include "hhkb_qmk.h" + +#define BASE 0 +#define HHKB 1 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* BASE Level: Default Layer + |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---| + | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` | + |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---| + | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | Backs | | + |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---| + | Cont | A | S | D | F | G | H | J | K | L | ; | ' | Ent | | | + |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---| + | Shift | Z | X | C | V | B | N | M | , | . | / | Shift | Fn0 | | | + |-------+---+---+---+---+---+---+---+---+---+---+-------+-----+-------+---| + + |------+------+-----------------------+------+------| + | LAlt | LGUI | ******* Space ******* | RGUI | RAlt | + |------+------+-----------------------+------+------| + */ + + [BASE] = KEYMAP( // default layer + 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_BSLS, KC_GRV, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, \ + KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(HHKB), \ + KC_LALT, KC_LGUI, /* */ KC_SPC, KC_RGUI, KC_RALT), + + + + /* Layer HHKB: HHKB mode (HHKB Fn) + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | Pwr | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | Ins | Del | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | Caps | | | | | | | | Psc | Slk | Pus | Up | | Backs | | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | | VoD | VoU | Mut | | | * | / | Hom | PgU | Lef | Rig | Enter | | | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | | | | | | | + | - | End | PgD | Dow | | | | | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + + |------+------+----------------------+------+------+ + | **** | **** | ******************** | **** | **** | + |------+------+----------------------+------+------+ + + */ + + [HHKB] = KEYMAP( + 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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_BSPC, \ + KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_PENT, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)}; + + +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: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; diff --git a/keyboard/hhkb_qmk/keymaps/keymap_lxol.c b/keyboard/hhkb_qmk/keymaps/keymap_lxol.c new file mode 100644 index 0000000000..3256fda516 --- /dev/null +++ b/keyboard/hhkb_qmk/keymaps/keymap_lxol.c @@ -0,0 +1,208 @@ +/* -*- eval: (turn-on-orgtbl); -*- + * lxol HHKB Layout + */ +#include "hhkb_qmk.h" + +#define BASE 0 +#define WIN 1 +#define HHKB 2 +#define RGUILEV 3 +#define LGUILEV 4 +#define RALTLEV 5 +#define LALTLEV 6 + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Layer 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 | [ | ] | Backs | | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Contro | A | S | D | F | G | H | J | K | L | ; | ' | RCtl/Ent | | | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Shift | Z | X | C | V | B | N | M | , | . | Fn2 | Shift | Fn0 | | | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + + |------+------+-------+------+------| + | LAlt | LGUI | Space | RGUI | RAlt | + |------+------+-------+------+------| + */ + + [BASE] = KEYMAP( // layer 0 : default + + + 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_BSLS, KC_GRV, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, \ + KC_LCTL, LT(LALTLEV,KC_A), LT(LGUILEV,KC_S), KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, LT(RGUILEV,KC_L), LT(RALTLEV,KC_SCLN), KC_QUOT, KC_FN0, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(HHKB), \ + KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT), + + + + /* Layer 1: HHKB mode (HHKB Fn) + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | Pwr | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | Ins | Del | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | Caps | | | | | | | | Psc | Slk | Pus | Up | | Backs | | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | | VoD | VoU | Mut | | | * | / | Hom | PgU | Lef | Rig | Enter | | | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + | | | | | | | + | - | End | PgD | Dow | | | | | + |------+-----+-----+-----+----+----+----+----+-----+-----+-----+-----+-------+-------+-----| + + |---+---+---+---+---| + | | | | | | + |---+---+---+---+---| + */ + + [HHKB] = KEYMAP( + 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, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_BSPC, \ + KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_PENT, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, \ + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + + + /* Layer LGUI: All keys with RGUI modifier + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | Backs | | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Contro | A | S | D | F | G | H | J | K | | ; | ' | RCtl/Ent | | | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Shift | Z | X | C | V | B | N | M | , | . | Fn2 | Shift | Fn0 | | | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + + |------+------+-------+------+------| + | LAlt | LGUI | Space | RGUI | RAlt | + |------+------+-------+------+------| + */ + + [RGUILEV] = KEYMAP( // Right GUI layer by KC_L + + RGUI(KC_ESC), RGUI(KC_1), RGUI(KC_2), RGUI(KC_3), RGUI(KC_4), RGUI(KC_5), RGUI(KC_6), RGUI(KC_7), RGUI(KC_8), RGUI(KC_9), RGUI(KC_0), RGUI(KC_MINS), RGUI(KC_EQL), RGUI(KC_BSLS), RGUI(KC_GRV), \ + RGUI(KC_TAB), RGUI(KC_Q), RGUI(KC_W), RGUI(KC_E), RGUI(KC_R), RGUI(KC_T), RGUI(KC_Y), RGUI(KC_U), RGUI(KC_I), RGUI(KC_O), RGUI(KC_P), RGUI(KC_LBRC), RGUI(KC_RBRC), RGUI(KC_BSPC), \ + RGUI(KC_LCTL), RGUI(KC_A), RGUI(KC_S), RGUI(KC_D), RGUI(KC_F), RGUI(KC_G), RGUI(KC_H), RGUI(KC_J), RGUI(KC_K), KC_TRNS, KC_TRNS, RGUI(KC_QUOT), KC_FN0, \ + RGUI(KC_LSFT), RGUI(KC_Z), RGUI(KC_X), RGUI(KC_C), RGUI(KC_V), RGUI(KC_B), RGUI(KC_N), RGUI(KC_M), RGUI(KC_COMM), RGUI(KC_DOT), RGUI(KC_SLSH), RGUI(KC_RSFT), KC_TRNS, \ + KC_LALT, KC_LGUI, RGUI(KC_SPC), KC_RGUI, KC_RALT), + + /* Layer LGUI: All keys with LGUI modifier + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | Backs | | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Contro | A | S | D | F | G | H | J | K | | ; | ' | RCtl/Ent | | | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Shift | Z | X | C | V | B | N | M | , | . | Fn2 | Shift | Fn0 | | | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + + |------+------+-------+------+------| + | LAlt | LGUI | Space | LGUI | RAlt | + |------+------+-------+------+------| + */ + + [LGUILEV] = KEYMAP( // Right GUI layer by KC_L + + LGUI(KC_ESC), LGUI(KC_1), LGUI(KC_2), LGUI(KC_3), LGUI(KC_4), LGUI(KC_5), LGUI(KC_6), LGUI(KC_7), LGUI(KC_8), LGUI(KC_9), LGUI(KC_0), LGUI(KC_MINS), LGUI(KC_EQL), LGUI(KC_BSLS), LGUI(KC_GRV), \ + LGUI(KC_TAB), LGUI(KC_Q), LGUI(KC_W), LGUI(KC_E), LGUI(KC_R), LGUI(KC_T), LGUI(KC_Y), LGUI(KC_U), LGUI(KC_I), LGUI(KC_O), LGUI(KC_P), LGUI(KC_LBRC), LGUI(KC_RBRC), LGUI(KC_BSPC), \ + LGUI(KC_LCTL), KC_TRNS, KC_TRNS, LGUI(KC_D), LGUI(KC_F), LGUI(KC_G), LGUI(KC_H), LGUI(KC_J), LGUI(KC_K), LGUI(KC_L), LGUI(KC_SCLN), LGUI(KC_QUOT), KC_FN0, \ + KC_LSFT, LGUI(KC_Z), LGUI(KC_X), LGUI(KC_C), LGUI(KC_V), LGUI(KC_B), LGUI(KC_N), LGUI(KC_M), LGUI(KC_COMM), LGUI(KC_DOT), LGUI(KC_SLSH), KC_RSFT, KC_TRNS, \ + KC_LALT, KC_LGUI, LGUI(KC_SPC), KC_LGUI, KC_RALT), + + /* Layer LALT: All keys with RALT modifier + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | Backs | | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Contro | A | S | D | F | G | H | J | K | | ; | ' | RCtl/Ent | | | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Shift | Z | X | C | V | B | N | M | , | . | Fn2 | Shift | Fn0 | | | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + + |------+------+-------+------+------| + | LAlt | LGUI | Space | RGUI | RAlt | + |------+------+-------+------+------| + */ + + [RALTLEV] = KEYMAP( // Right ALT layer by KC_L + + RALT(KC_ESC), RALT(KC_1), RALT(KC_2), RALT(KC_3), RALT(KC_4), RALT(KC_5), RALT(KC_6), RALT(KC_7), RALT(KC_8), RALT(KC_9), RALT(KC_0), RALT(KC_MINS), RALT(KC_EQL), RALT(KC_BSLS), RALT(KC_GRV), \ + RALT(KC_TAB), RALT(KC_Q), RALT(KC_W), RALT(KC_E), RALT(KC_R), RALT(KC_T), RALT(KC_Y), RALT(KC_U), RALT(KC_I), RALT(KC_O), RALT(KC_P), RALT(KC_LBRC), RALT(KC_RBRC), RALT(KC_BSPC), \ + RALT(KC_LCTL), RALT(KC_A), RALT(KC_S), RALT(KC_D), RALT(KC_F), RALT(KC_G), RALT(KC_H), RALT(KC_J), RALT(KC_K), KC_TRNS, KC_TRNS, RALT(KC_QUOT), KC_FN0, \ + RALT(KC_LSFT), RALT(KC_Z), RALT(KC_X), RALT(KC_C), RALT(KC_V), RALT(KC_B), RALT(KC_N), RALT(KC_M), RALT(KC_COMM), RALT(KC_DOT), RALT(KC_SLSH), RALT(KC_RSFT), KC_TRNS, \ + KC_LALT, KC_LGUI, RALT(KC_SPC), KC_RGUI, KC_RALT), + + /* Layer LALT: All keys with LALT modifier + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | Backs | | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Contro | A | S | D | F | G | H | J | K | | ; | ' | RCtl/Ent | | | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + | Shift | Z | X | C | V | B | N | M | , | . | Fn2 | Shift | Fn0 | | | + |--------+---+---+---+---+---+---+---+---+---+-----+-------+----------+-------+---| + + |------+------+-------+------+------| + | LAlt | LGUI | Space | LGUI | RAlt | + |------+------+-------+------+------| + */ + + [LALTLEV] = KEYMAP( // Right ALT layer by KC_L + + LALT(KC_ESC), LALT(KC_1), LALT(KC_2), LALT(KC_3), LALT(KC_4), LALT(KC_5), LALT(KC_6), LALT(KC_7), LALT(KC_8), LALT(KC_9), LALT(KC_0), LALT(KC_MINS), LALT(KC_EQL), LALT(KC_BSLS), LALT(KC_GRV), \ + LALT(KC_TAB), LALT(KC_Q), LALT(KC_W), LALT(KC_E), LALT(KC_R), LALT(KC_T), LALT(KC_Y), LALT(KC_U), LALT(KC_I), LALT(KC_O), LALT(KC_P), LALT(KC_LBRC), LALT(KC_RBRC), LALT(KC_BSPC), \ + LALT(KC_LCTL), KC_TRNS, KC_TRNS, LALT(KC_D), LALT(KC_F), LALT(KC_G), LALT(KC_H), LALT(KC_J), LALT(KC_K), LALT(KC_L), LALT(KC_SCLN), LALT(KC_QUOT), KC_FN0, \ + KC_LSFT, LALT(KC_Z), LALT(KC_X), LALT(KC_C), LALT(KC_V), LALT(KC_B), LALT(KC_N), LALT(KC_M), LALT(KC_COMM), LALT(KC_DOT), LALT(KC_SLSH), KC_RSFT, KC_TRNS, \ + KC_LALT, KC_LGUI, LALT(KC_SPC), KC_LGUI, KC_RALT), + + + /* Layer WIN: Win layer + |--------+---+---+---+---+---+---+---+---+---+---+-------+----------+-------+---| + | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` | + |--------+---+---+---+---+---+---+---+---+---+---+-------+----------+-------+---| + | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | Backs | | + |--------+---+---+---+---+---+---+---+---+---+---+-------+----------+-------+---| + | Contro | A | S | D | F | G | H | J | K | L | ; | ' | RCtl/Ent | | | + |--------+---+---+---+---+---+---+---+---+---+---+-------+----------+-------+---| + | Shift | Z | X | C | V | B | N | M | , | . | / | Shift | Fn0 | | | + |--------+---+---+---+---+---+---+---+---+---+---+-------+----------+-------+---| + + |------+------+-------+------+------| + | LGui | LAlt | Space | RGui | Ralt | + |------+------+-------+------+------| + */ + + [WIN] = KEYMAP( // BASE level with swapped GUI/ALT + + + 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_BSLS, KC_GRV, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, \ + KC_LCTL, LT(LGUILEV,KC_A), LT(LALTLEV,KC_S), KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, LT(RALTLEV,KC_L), LT(RGUILEV,KC_SCLN), KC_QUOT, KC_FN0, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(HHKB), \ + KC_RGUI, KC_RALT, KC_SPC, KC_RALT, KC_RGUI)}; + + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT) // RControl with tap Enter* +}; + +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: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; diff --git a/keyboard/hhkb_qmk/matrix.c b/keyboard/hhkb_qmk/matrix.c new file mode 100644 index 0000000000..14fae0b82c --- /dev/null +++ b/keyboard/hhkb_qmk/matrix.c @@ -0,0 +1,196 @@ +/* +Copyright 2011 Jun Wako + +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 . +*/ + +/* + * scan matrix + */ +#include +#include +#include +#include "print.h" +#include "debug.h" +#include "util.h" +#include "timer.h" +#include "matrix.h" +#include "hhkb_avr.h" +#include +#include "suspend.h" +#include "lufa.h" + + +// matrix power saving +#define MATRIX_POWER_SAVE 10000 +static uint32_t matrix_last_modified = 0; + +// matrix state buffer(1:on, 0:off) +static matrix_row_t *matrix; +static matrix_row_t *matrix_prev; +static matrix_row_t _matrix0[MATRIX_ROWS]; +static matrix_row_t _matrix1[MATRIX_ROWS]; + + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +void matrix_init(void) +{ +#ifdef DEBUG + debug_enable = true; + debug_keyboard = true; +#endif + + KEY_INIT(); + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix0[i] = 0x00; + for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix1[i] = 0x00; + matrix = _matrix0; + matrix_prev = _matrix1; +} + +uint8_t matrix_scan(void) +{ + uint8_t *tmp; + + tmp = matrix_prev; + matrix_prev = matrix; + matrix = tmp; + + // power on + if (!KEY_POWER_STATE()) KEY_POWER_ON(); + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + KEY_SELECT(row, col); + _delay_us(5); + + // Not sure this is needed. This just emulates HHKB controller's behaviour. + if (matrix_prev[row] & (1< 20/(1000000/TIMER_RAW_FREQ)) { + matrix[row] = matrix_prev[row]; + } + + _delay_us(5); + KEY_PREV_OFF(); + KEY_UNABLE(); + + // NOTE: KEY_STATE keep its state in 20us after KEY_ENABLE. + // This takes 25us or more to make sure KEY_STATE returns to idle state. +#ifdef HHKB_JP + // Looks like JP needs faster scan due to its twice larger matrix + // or it can drop keys in fast key typing + _delay_us(30); +#else + _delay_us(75); +#endif + } + if (matrix[row] ^ matrix_prev[row]) matrix_last_modified = timer_read32(); + } + // power off + if (KEY_POWER_STATE() && + (USB_DeviceState == DEVICE_STATE_Suspended || + USB_DeviceState == DEVICE_STATE_Unattached ) && + timer_elapsed32(matrix_last_modified) > MATRIX_POWER_SAVE) { + KEY_POWER_OFF(); + suspend_power_down(); + } + return 1; +} + +bool matrix_is_modified(void) +{ + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + if (matrix[i] != matrix_prev[i]) + return true; + } + return false; +} + +inline +bool matrix_has_ghost(void) +{ + return false; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & (1< and | +#define DE_MINS KC_SLSH // - and _ + +// shifted characters +#define DE_RING LSFT(DE_CIRC) // ° +#define DE_EXLM LSFT(KC_1) // ! +#define DE_DQOT LSFT(KC_2) // " +#define DE_PARA LSFT(KC_3) // § +#define DE_DLR LSFT(KC_4) // $ +#define DE_PERC LSFT(KC_5) // % +#define DE_AMPR LSFT(KC_6) // & +#define DE_SLSH LSFT(KC_7) // / +#define DE_LPRN LSFT(KC_8) // ( +#define DE_RPRN LSFT(KC_9) // ) +#define DE_EQL LSFT(KC_0) // = +#define DE_QST LSFT(DE_SS) // ? +#define DE_GRV LSFT(DE_ACUT) // ` +#define DE_ASTR LSFT(DE_PLUS) // * +#define DE_QUOT LSFT(DE_HASH) // ' +#define DE_MORE LSFT(DE_LESS) // > +#define DE_COLN LSFT(KC_DOT) // : +#define DE_SCLN LSFT(KC_COMM) // ; +#define DE_UNDS LSFT(DE_MINS) // _ + +// Alt-ed characters +#define DE_SQ2 LALT(KC_2) // ² +#define DE_SQ3 LALT(KC_3) // ³ +#define DE_LCBR LALT(KC_7) // { +#define DE_LBRC LALT(KC_5) // [ +#define DE_RBRC LALT(KC_6) // ] +#define DE_RCBR LALT(KC_9) // } +#define DE_BSLS LALT(LSFT(KC_7)) // backslash +#define DE_AT LALT(DE_L) // @ +#define DE_EURO LALT(KC_E) // € +#define DE_TILD LALT(DE_N) // ~ +#define DE_PIPE LALT(DE_7) // | + +#endif diff --git a/tmk_core/doc/build.md b/tmk_core/doc/build.md index 20702e94c9..dffc699a3a 100644 --- a/tmk_core/doc/build.md +++ b/tmk_core/doc/build.md @@ -6,7 +6,7 @@ Download and Install -------------------- ### 1. Install Tools -1. **Toolchain** On Windows install [MHV AVR Tools][mhv] for AVR GCC compiler and [Cygwin][cygwin](or [MinGW][mingw]) for shell terminal. On Mac you can use [CrossPack][crosspack]. On Linux you can install AVR GCC with your favorite package manager. +1. **Toolchain** On Windows install [MHV AVR Tools][mhv] for AVR GCC compiler and [Cygwin][cygwin](or [MinGW][mingw]) for shell terminal. On Mac you can use [CrossPack][crosspack]. On Linux you can install AVR GCC (and avr-libc) with your favorite package manager. 2. **Programmer** On Windows install [Atmel FLIP][flip]. On Mac and Linux install [dfu-programmer][dfu-prog].