Create a gist now

Instantly share code, notes, and snippets.

@Leimi /Satan.md forked from tofagerl/Satan.md
Last active Aug 31, 2017

What would you like to do?

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 git@github.com:kairyu/tkg-toolkit.git tkg
  5. Still using git, download Kairyu's fork of TMK. https://github.com/kairyu/tmk_keyboard_custom git@github.com: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:
  7. 2 - GH60 RevCHN
  8. y - .. Yes...
  9. 1 - Default
  10. 1 - atmel_dfu (Yes, I know the file says lufa. That doesn't matter!)
  11. Cheat.
  12. Rename tkg/common/firmware/gh60-revchn.hex to gh60-revchn.original.hex
  13. Copy your firmware from one of your several backups to the same folder, and rename it gh60-revchn.hex
  14. 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.
  15. 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.
  16. You are now finished!
  17. Enjoy!!!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment