Skip to content

Instantly share code, notes, and snippets.

@manuhabitela
Last active May 22, 2019 01:17
Show Gist options
  • Save manuhabitela/bca49d02e48c018ce4c8 to your computer and use it in GitHub Desktop.
Save manuhabitela/bca49d02e48c018ce4c8 to your computer and use it in GitHub Desktop.

This is a quick guide to changing the keymap on the GH60 "Satan" or RevCHN. Note that the Satan is NOT a true GH60, and using the GH60 with the normal TMK would not work.

Note that installing dependencies or compiling TMK is not a part of the scope of this document. If you have problems with this part, seek help elsewhere. Not also that these instructions are written for Linux and Mac. If you're using windows, just use the Command Prompt for the git commands, and Windows Explorer to move and delete files.

  1. Dependencies.
  2. Download and install GIT: https://git-scm.com/downloads
  3. Download and install the dependencies for compiling TMK: https://github.com/tmk/tmk_keyboard/blob/master/doc/build.md (Point 1 only)
  4. Using git, download the TKG toolkit. https://github.com/kairyu/tkg-toolkit git clone [email protected]:kairyu/tkg-toolkit.git tkg
  5. Still using git, download Kairyu's fork of TMK. https://github.com/kairyu/tmk_keyboard_custom [email protected]:kairyu/tmk_keyboard_custom.git tmk (Note that I've renamed the folders and that they're named quite similarly. Take care of which you're working in in order not to get things wrong.)
  6. Delete the TMK folders inside of the TMK folder. (Yes, confusing, but it will make sense.) rm -rf tmk/tmk_core*
  7. Using git again, download Kairyu's fork of tmk_core. https://github.com/kairyu/tmk_core_custom git clone https://github.com/kairyu/tmk_core_custom tmk/tmk_core
  8. Compile the keymap
  9. First, you need to actually write your keymap. This is explained here: https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md
  10. Assuming you now have a keymap, we need to edit it slightly to make it work with the satan. Add these lines at the end of your keymap.c: ``` #ifdef KEYMAP_IN_EEPROM_ENABLE uint16_t keys_count(void) { return sizeof(keymaps) / sizeof(keymaps[0]) * MATRIX_ROWS * MATRIX_COLS; }
uint16_t fn_actions_count(void) {
    return sizeof(fn_actions) / sizeof(fn_actions[0]);
}
#endif
```
And save the file as ```tmk/keyboard/gh60/keymap_custom.c```
  1. Edit the file tmk/keyboard/gh60/config.h and add this line somewhere: #define GH60_REV_CHN 1
  2. Finally, run this command in tmk/keyboard/gh60 make KEYBOARD=custom
  3. Wait. At the end there should be lots of new files there. We only need one. Copy the file gh60_lufa.hex somewhere safe for now. Keep backups of this, it's your new firmware.
  4. Flash the firmware
  5. Now go to the TKG folder. Enter either the tkg/linux or the tkg/windows folder depending on your OS.
  6. Run the setup script. Use these options: 1. 2 - GH60 RevCHN 2. y - .. Yes... 3. 1 - Default 4. 1 - atmel_dfu (Yes, I know the file says lufa. That doesn't matter!)
  7. Cheat. 1. Rename tkg/common/firmware/gh60-revchn.hex to gh60-revchn.original.hex 2. Copy your firmware from one of your several backups to the same folder, and rename it gh60-revchn.hex 3. Back in the windows/linux folder, run reflash. Press enter, and when it says "Waiting for bootloader", press the little button on the bottom of the PCB. If on linux, running it as root might by necessary. 4. After the commands stop and you get control of your keyboard back, run the util script and select option 2, erase EEPROM. If on linux, no util tool is there, so execute the command by hand from the tkg-toolkit/linux dir: TARGET=atmega32u4 ./script/reflash-dfu.sh ../common/firmware/gh60-revchn.hex ../common/misc/empty.ee. Running this as root might by necessary. 5. You are now finished!
  8. Enjoy!!!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment