Skip to content

Instantly share code, notes, and snippets.

@al3xandru
Forked from manuhabitela/kc60_end_user_notes.md
Created August 3, 2016 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save al3xandru/da346db8e3f1ddc82416c72b3a19389e to your computer and use it in GitHub Desktop.
Save al3xandru/da346db8e3f1ddc82416c72b3a19389e to your computer and use it in GitHub Desktop.
KC60 Notes

KC60 Keyboard end-user tips, tricks, programming notes, etc.

Leimi's note: removed lots of stuff from the original gist of scottjl, (thanks to him by the way!), as in the end some wasn't useful for me. If you are intestered, go check the gist revisions.

The KC60 is kinda like a premade GH60 that was first sold on Massdrop during summer 2015.
It runs on TMK firmware, or something based on it at least (not sure this is the real source for the keyboard but it seems it is), which means it's heavily programmable.
There is a GUI tool (the source of this tool seems to be here) and a command-line tool to ease up the process of programming the board.
Go check this great article on Keychatter about programming the KC60: it explains how to use the TKG-Toolkit and the Configurator web page to customize the keyboard layers easily.

SpaceFN on the KC60

I bought the KC60 to have a cheap, fully programmable, already-assembled keyboard. By "fully programmable", I mean something letting me use the SpaceFN layout without trouble. It is easily doable via the GUI tool the manufacturer provides :) When editing your layout on the website:

  • click on the spacebar: a popup appears, letting choose you the key you want to map on the spacebar
  • choose the same as in this screenshot : select "瞬时开启、 按键", then select the wanted layer (most of the time, 1), then select "Space"
  • that's it! Do as usual (follow the guide), flash the keyboard and there you have it.

Troubleshooting

If you're on Linux like me, you might get stuck when wanting to flash the firmware on the keyboard via the command ./reflash.sh kc60.hex (this assumes you're in the tkg toolkit folder and you created your layout via the web gui).

Even after holding down the reset button a few seconds, you might be stuck on "waiting for bootloader", certainly because of unnecessary access rights on the USB stuff. Try to run in with sudo and see where it gets you!

All info below is from the original gist written by scottjl, thanks to him for gathering all this :)

User notes from Massdrop Discussion

The programming guide is linked below, but it doesn't mention anything about the Fn layer options. You can infer the functionality on a few entries in the drop down menu based on the options offered to the right, and the default layout: Layer 0 Fn (function #2 in drop down) should be enable Fn layer 1 while pressed down. Layer 1 Fn (function #3 in drop down) should be to enable Fn layer 2 once pressed (and released). Layer 2 Fn (function #4 in drop down) I'm not 100% sure about, but since 2 is selected I imagine it means removing Fn layer 2 and going back to the previous layer. The last entry is macro. The few entries with Ctrl/Shift/Alt/Win options shouldn't be hard to figure out by trial and error. The ones without options I'd be careful about. https://www.keychatter.com/2015/07/05/programming-the-kc60/


Decided to just run it through Google translate:
空操作 - No operation
瞬时开启层 - Instantaneous open layer
开启层 - Open layer
关闭层 - Close Layer
开关层 - Switch layer
瞬时开启、 按键 - Momentary open , button
修饰键 - Modifier keys
组合键 - Key combination
单击修饰键 - Click modifier keys
开关修饰键 - Switch modifier keys
清除层状态 - Clear layer status
宏 - Macros


Anyone who is having problems flashing and is getting the "did you remember to press the reset button?" message: it's simply a matter of holding the button down for a very long time. It takes about a full minute of holding the reset button before the chip restarts. Just keep holding even after the error message comes up, and eventually it will flash! Good luck and have fun!


I start holding it before the "did you forget..." prompt, and continue holding it for a bit after. If it still doesn't work, you may need to install some drivers. Go into the "tkg-toolkit-master\windows\tool" folder, and run zadig_2.1.2.exe. Once it comes up, hold down the reset button until the chip restarts. This could take up to a minute, and you'll know it happens, because the leds suddenly dim. At this point "ATm32U4DFU" will suddenly appear in the drop down box. When that happens, click "install WCID driver" and it will install the USB driver for the atmel chip. After that, restart your computer just to be safe, then attempt to flash the firmware. (drag drop the .hex file onto reflash.bat, hit 'y'es, then immediately hold down the reset button until you see the firmware install script running, which could take up to 60 seconds)


This worked for me. Opened zadig, held down the reset button for what felt like a very long time (I was starting to doubt) and then it recognized the board and I clicked "Install driver". I restarted my computer and the board did not work initially (don't panic) but I made it to dropping the hex file onto and it loaded the firmware right after I entered [y]es, so my guess why the board wasn't working is because it was still in bootloader mode. Main takeaway is that you really do have to press and hold and hold and hold the reset button.


That worked for me thank you so much. For anyone else when opening zadig hold and release the reset button until you see one device found. Proceed to restart your PC after installing the drivers. Now the scary part, when I dropped the new HEX file in the reflash.bat I still got the error "did you remember to press the reset button?" DONT WORRY! just push the reset button down once again and the firmware will update. Hope this helps for others.


I haven't figured out the "No" button yet, but it seems to me like the pressing a layer function key "adds" the layer on top of your current layer, erasing only keys that have been assigned. To get to additional layers, you can press the first fn key (mine is mapped to caps lock option 3 "open layer", and goes to layer 1). Then map an additional key on that layer to go to the next layer. Make sure you have a key set to "clear layers" on every layer other than 0, or you can get stuck! I like to use escape for this purpose. For your colemak example, you can map caps lock to the "open layer" option, and go to layer 1. Then on the layer 1 page, map escape to "clear layers", and map capslock to "open layer", and set it to go to layer 2. This would be your colemak layer, and would also need a clear layers key. To get to it, you would simply tap capslock twice. To go back, hit escape once from either layer. Another useful function is the sixth one down, with the comma. This will switch to a layer only as long as the button is held down. For example: I have capslock set to open layer 1. This contains a variety of vim-style key bindings like d being mapped to delete. I then have shift on layer 1 set to move to layer 2, only when it's held down. So if I'm in "vim mode", I can hit shift so that D will now delete the whole line instead of just a character. Has anyone figured out how to get the "start" key into macros yet? I'd like to have a key to open notepad, but I need Start+R in the macro, and the interface won't snag that key for some reason. It also won't let you type out a macro and copy-paste it in, so I can't make an alt-F4 macro either.


When 'Unknown Device #1' appears is when you want to start instaling the drivers. Once you complete the driver install the reflash.bat file should work.


Aright guys, here is how to reprogram the KC60 on a Mac: NOTE: Massdrop's online comments system automatically parses the text and moves all URLs to the bottom of the post. There are a few files that you will need to use that end in ".sh". The parser thinks that this is a URL, and it is removing all refrences to .sh files. In order to get around this I have placed a space before ".sh". The same holds true for the ".hex" extension. You will need to manually remove the space when you attempt to run the following commands!

  1. Download the TKG-Toolk from Github (click on download zip on the right).
  2. Unzip the folder and go into the "Linux" folder.
  3. Go into the "bin" folder.
  4. The supplied "jq" file is a JSON parser, but it was compiled for Linux. Because of this it will not work on a Mac. You can Download the Mac version of jq and replace the linux version in the bin folder. You can get it from jq's Github page (link listed below). Download the version that best suits your OSX, if you are on an older version, like Snow Leopoard then you should download the oldest Mac version.
  5. Exit the "bin" folder and return to the "Linux" Folder
  6. Open the file called "reflash .sh" in a text editor.
  7. There is a bug within the reflash script where the variables are not being parsed correctly from the config file. The original code is using declare with the -g flag to create the variables. But bash doesn't have the -g flag for declare. Go to line 43, or search for the word "declare". Replace this line with: eval "$line"
  8. You now need to install the dfu-programmer, you can do this via Homebrew. If you don't have Homebrew installed you can get it by following the instructions at Homebrew's site. (Link listed below) Press command + space to open up Spotlight and search for "Terminal". Open Terminal and input the following: brew install dfu-programmer
  9. Place the .hex file from the online configurator into the "Linux" folder.
  10. You need to point your terminal to the "Linux" folder. Here is the easiest way to do that: Type "cd " into the terminal, those are the letters cd and a space. Now drag and drop the "Linux" folder into Terminal. The path to the "Linux" folder should now be autofilled. Press Enter. You should now be in the folder.
  11. You need to set the permissions of the scripts so that they can be executed. If you skip this step the scripts can not run. Input these commands one at a time. Make sure you do this from within the "Linux" folder. Remember to remove the spaces before .sh! chmod +x reflash .sh chmod +x setup .sh chmod +x bin/jq
  12. Run the setup script. Input the following into your Terminal: ./setup .sh
  13. Select GHPad -> Default Firmware -> atmel_dfu Bootloader
  14. Run the reflash script: Remember to remove the space before .hex! ./reflash kc60 .hex Note: Replace "kc60 .hex" with the name of you hex file if it has a different name.
  15. Press "y" when it asks you if you want to continue.
  16. Flip over the keyboard and press the reset button when you see the message "Wating for Bootloader...". If everything works out you should get a "Success!" message. https://github.com/kairyu/tkg-toolkit https://stedolan.github.io/jq/download/ http://brew.sh/

I see, looks like I forgot a step. Go to the jq site and download the OSX binary. Unzip it, the file will be named "jq-osx-x86_64" or something similar. Go to the "bin" folder and delete the original jq file and replace it with the file you downloaded. Now rename the file from "jq-osx-x86_64" to "jq". It should now work if you follow the rest of the steps, specifically the one about setting permissions. https://stedolan.github.io/jq/download/


If you are still having problems with jq you can just skip this step, along with the setup script steps. The only thing the setup script does is create a file that contains some info about which settings you want the reflash script to use. Fixing these issues will allow you to program other keyboards, but if you are only ever going to use this for the KC60 you can simply go into a text editor and paste the following: Name=GHPad MCU=atmega32u4 Firmware=ghpad.hex Bootloader=atmel_dfu Then save this file in the "conf" folder and name it "default.ini". It should work if you complete the rest of the instructions.


Since the KC60 is using TMK for it's firmware, the following document will shed some light as to what the different function modes in the configurator do. Scroll down to "3. Layer switching Example". Right now I have settled on this pretty cool setup: Tapping f uses the key as normal, but holding f takes me to go to another layer which has vim style arrow keys (hjkl) and the number keys mimic the mac keyboard's media keys. If I hold d while holding f it will take me to another layer which gives me the standard function keys. https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md


KC60 does use TMK, and I also found the code of its online programmer. Hopefully Massdrop @AlexPeterkin can request the developer to release the files under tmk_keyboard/keyboard/kc60 so we can do a lot with this keyboard!!!

https://github.com/jichuntao/online_compiler


to whom want do advanced reprogramming of this keyboard, you should check this fork of tmk_keyboard on github. Pretty everything you need for this hardware are there and you could even write your own keyboard firmware based on this one.

https://github.com/jichuntao/tmk_keyboard


Tried and managed to flash a new layout. Some notes:

  • In the web tool, after clicking the blue Save button, the URL in the address bar changes and now contains a representation of your layout. You can bookmark it and resume editing at a later time.
  • At the "waiting for Bootloader" stage I found that I only had to press the button for about 5 seconds and release it, then the flashing started.
  • If you flash under OSX, you can use homebrew to install jq, and modify setup.sh to point to it: JQ=/usr/local/bin/jq

Acknowledgements

Information on this page was gathered from the many postings to Massdrop, Reddit, GIT, and other sources. Thanks go to all the original publishers including (but not limited to):

AlexPeterkin, asphodel, Frostbyte, hjc1710, livingspeedbump, Makami, NanoGEEK, Nickajeglin, Regus, ruiwui, vppl

If I forgot someone please accept my apologies and add yourself to the list, or send me a note.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment